ETH Price: $2,412.54 (+2.78%)

Contract

0x334c73633eCD1b7fec145B9e5430343eF32f9Fe6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
195643362024-04-01 23:45:35164 days ago1712015135  Contract Creation0 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xa0a2140C...DAc73de46
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
ConicPoolWeightManager

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion, GNU GPLv3 license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2024-04-01
*/

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.17;

// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

/**
 * @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.
 *
 * ```solidity
 * 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.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
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) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // 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;

        /// @solidity memory-safe-assembly
        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 in 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;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableMap.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableMap.js.

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * The following map types are supported:
 *
 * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0
 * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableMap.
 * ====
 */
library EnumerableMap {
    using EnumerableSet for EnumerableSet.Bytes32Set;

    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct Bytes32ToBytes32Map {
        // Storage of keys
        EnumerableSet.Bytes32Set _keys;
        mapping(bytes32 => bytes32) _values;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) {
        map._values[key] = value;
        return map._keys.add(key);
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {
        delete map._values[key];
        return map._keys.remove(key);
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {
        return map._keys.contains(key);
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {
        return map._keys.length();
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {
        bytes32 value = map._values[key];
        if (value == bytes32(0)) {
            return (contains(map, key), bytes32(0));
        } else {
            return (true, value);
        }
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key");
        return value;
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        Bytes32ToBytes32Map storage map,
        bytes32 key,
        string memory errorMessage
    ) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), errorMessage);
        return value;
    }

    /**
     * @dev Return the an array containing all the keys
     *
     * 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) {
        return map._keys.values();
    }

    // UintToUintMap

    struct UintToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) {
        return set(map._inner, bytes32(key), bytes32(value));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

    /**
     * @dev Returns the element stored at position `index` in the map. 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(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) {
        (bytes32 key, bytes32 value) = at(map._inner, index);
        return (uint256(key), uint256(value));
    }

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(key)));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(key), errorMessage));
    }

    /**
     * @dev Return the an array containing all the keys
     *
     * 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function keys(UintToUintMap storage map) internal view returns (uint256[] memory) {
        bytes32[] memory store = keys(map._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
        return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToAddressMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

    /**
     * @dev Returns the element stored at position `index` in the map. 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(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
        (bytes32 key, bytes32 value) = at(map._inner, index);
        return (uint256(key), address(uint160(uint256(value))));
    }

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint160(uint256(get(map._inner, bytes32(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        UintToAddressMap storage map,
        uint256 key,
        string memory errorMessage
    ) internal view returns (address) {
        return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage))));
    }

    /**
     * @dev Return the an array containing all the keys
     *
     * 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) {
        bytes32[] memory store = keys(map._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressToUintMap

    struct AddressToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) {
        return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(AddressToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

    /**
     * @dev Returns the element stored at position `index` in the map. 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(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) {
        (bytes32 key, bytes32 value) = at(map._inner, index);
        return (address(uint160(uint256(key))), uint256(value));
    }

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key))));
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(AddressToUintMap storage map, address key) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(uint256(uint160(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        AddressToUintMap storage map,
        address key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));
    }

    /**
     * @dev Return the an array containing all the keys
     *
     * 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function keys(AddressToUintMap storage map) internal view returns (address[] memory) {
        bytes32[] memory store = keys(map._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // Bytes32ToUintMap

    struct Bytes32ToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) {
        return set(map._inner, key, bytes32(value));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(Bytes32ToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

    /**
     * @dev Returns the element stored at position `index` in the map. 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(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) {
        (bytes32 key, bytes32 value) = at(map._inner, index);
        return (key, uint256(value));
    }

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, key);
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {
        return uint256(get(map._inner, key));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        Bytes32ToUintMap storage map,
        bytes32 key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, key, errorMessage));
    }

    /**
     * @dev Return the an array containing all the keys
     *
     * 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) {
        bytes32[] memory store = keys(map._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

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

// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

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

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.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);
}

interface ILpToken is IERC20Metadata {
    function minter() external view returns (address);

    function mint(address account, uint256 amount, address ubo) external returns (uint256);

    function burn(address _owner, uint256 _amount, address ubo) external returns (uint256);

    function taint(address from, address to, uint256 amount) external;
}

interface IRewardManager {
    event ClaimedRewards(uint256 claimedCrv, uint256 claimedCvx);
    event SoldRewardTokens(uint256 targetTokenReceived);
    event ExtraRewardAdded(address reward);
    event ExtraRewardRemoved(address reward);
    event ExtraRewardsCurvePoolSet(address extraReward, address curvePool);
    event FeesSet(uint256 feePercentage);
    event FeesEnabled(uint256 feePercentage);
    event EarningsClaimed(
        address indexed claimedBy,
        uint256 cncEarned,
        uint256 crvEarned,
        uint256 cvxEarned
    );

    function accountCheckpoint(address account) external;

    function poolCheckpoint() external returns (bool);

    function addExtraReward(address reward) external returns (bool);

    function addBatchExtraRewards(address[] memory rewards) external;

    function conicPool() external view returns (address);

    function setFeePercentage(uint256 _feePercentage) external;

    function claimableRewards(
        address account
    ) external view returns (uint256 cncRewards, uint256 crvRewards, uint256 cvxRewards);

    function claimEarnings() external returns (uint256, uint256, uint256);

    function claimPoolEarningsAndSellRewardTokens() external;

    function feePercentage() external view returns (uint256);

    function feesEnabled() external view returns (bool);
}

interface IOracle {
    event TokenUpdated(address indexed token, address feed, uint256 maxDelay, bool isEthPrice);

    /// @notice returns the price in USD of symbol.
    function getUSDPrice(address token) external view returns (uint256);

    /// @notice returns if the given token is supported for pricing.
    function isTokenSupported(address token) external view returns (bool);
}

interface IConicPoolWeightManagement {
    struct PoolWeight {
        address poolAddress;
        uint256 weight;
    }

    function addPool(address pool) external;

    function removePool(address pool) external;

    function updateWeights(PoolWeight[] memory poolWeights) external;

    function handleDepeggedCurvePool(address curvePool_) external;

    function handleInvalidConvexPid(address pool) external returns (uint256);

    function allPools() external view returns (address[] memory);

    function poolsCount() external view returns (uint256);

    function getPoolAtIndex(uint256 _index) external view returns (address);

    function getWeight(address curvePool) external view returns (uint256);

    function getWeights() external view returns (PoolWeight[] memory);

    function isRegisteredPool(address _pool) external view returns (bool);
}

interface IGenericOracle is IOracle {
    /// @notice returns the oracle to be used to price `token`
    function getOracle(address token) external view returns (IOracle);

    /// @notice converts the price of an LP token to the given underlying
    function curveLpToUnderlying(
        address curveLpToken,
        address underlying,
        uint256 curveLpAmount
    ) external view returns (uint256);

    /// @notice same as above but avoids fetching the underlying price again
    function curveLpToUnderlying(
        address curveLpToken,
        address underlying,
        uint256 curveLpAmount,
        uint256 underlyingPrice
    ) external view returns (uint256);

    /// @notice converts the price an underlying asset to a given Curve LP token
    function underlyingToCurveLp(
        address underlying,
        address curveLpToken,
        uint256 underlyingAmount
    ) external view returns (uint256);
}

interface IInflationManager {
    event TokensClaimed(address indexed pool, uint256 cncAmount);
    event RebalancingRewardHandlerAdded(address indexed pool, address indexed handler);
    event RebalancingRewardHandlerRemoved(address indexed pool, address indexed handler);
    event PoolWeightsUpdated();

    function executeInflationRateUpdate() external;

    function updatePoolWeights() external;

    /// @notice returns the weights of the Conic pools to know how much inflation
    /// each of them will receive, as well as the total amount of USD value in all the pools
    function computePoolWeights()
        external
        view
        returns (address[] memory _pools, uint256[] memory poolWeights, uint256 totalUSDValue);

    function computePoolWeight(
        address pool
    ) external view returns (uint256 poolWeight, uint256 totalUSDValue);

    function currentInflationRate() external view returns (uint256);

    function getCurrentPoolInflationRate(address pool) external view returns (uint256);

    function handleRebalancingRewards(
        address account,
        uint256 deviationBefore,
        uint256 deviationAfter
    ) external;

    function addPoolRebalancingRewardHandler(
        address poolAddress,
        address rebalancingRewardHandler
    ) external;

    function removePoolRebalancingRewardHandler(
        address poolAddress,
        address rebalancingRewardHandler
    ) external;

    function rebalancingRewardHandlers(
        address poolAddress
    ) external view returns (address[] memory);

    function hasPoolRebalancingRewardHandler(
        address poolAddress,
        address handler
    ) external view returns (bool);
}

interface ILpTokenStaker {
    event LpTokenStaked(address indexed account, uint256 amount);
    event LpTokenUnstaked(address indexed account, uint256 amount);
    event TokensClaimed(address indexed pool, uint256 cncAmount);
    event Shutdown();

    function stake(uint256 amount, address conicPool) external;

    function unstake(uint256 amount, address conicPool) external;

    function stakeFor(uint256 amount, address conicPool, address account) external;

    function unstakeFor(uint256 amount, address conicPool, address account) external;

    function unstakeFrom(uint256 amount, address account) external;

    function getUserBalanceForPool(
        address conicPool,
        address account
    ) external view returns (uint256);

    function getBalanceForPool(address conicPool) external view returns (uint256);

    function updateBoost(address user) external;

    function claimCNCRewardsForPool(address pool) external;

    function claimableCnc(address pool) external view returns (uint256);

    function checkpoint(address pool) external returns (uint256);

    function shutdown() external;

    function getBoost(address user) external view returns (uint256);

    function isShutdown() external view returns (bool);
}

interface IBonding {
    event CncStartPriceSet(uint256 startPrice);
    event PriceIncreaseFactorSet(uint256 factor);
    event MinBondingAmountSet(uint256 amount);
    event Bonded(
        address indexed account,
        address indexed recipient,
        uint256 lpTokenAmount,
        uint256 cncReceived,
        uint256 lockTime
    );
    event DebtPoolSet(address indexed pool);
    event DebtPoolFeesClaimed(uint256 crvAmount, uint256 cvxAmount, uint256 cncAmount);
    event StreamClaimed(address indexed account, uint256 amount);
    event BondingStarted(uint256 amount, uint256 epochs);
    event RemainingCNCRecovered(uint256 amount);

    function startBonding() external;

    function setCncStartPrice(uint256 _cncStartPrice) external;

    function setCncPriceIncreaseFactor(uint256 _priceIncreaseFactor) external;

    function setMinBondingAmount(uint256 _minBondingAmount) external;

    function setDebtPool(address _debtPool) external;

    function bondCncCrvUsd(
        uint256 lpTokenAmount,
        uint256 minCncReceived,
        uint64 cncLockTime
    ) external returns (uint256);

    function recoverRemainingCNC() external;

    function claimStream() external;

    function claimFeesForDebtPool() external;

    function streamCheckpoint() external;

    function accountCheckpoint(address account) external;

    function computeCurrentCncBondPrice() external view returns (uint256);

    function cncAvailable() external view returns (uint256);

    function cncBondPrice() external view returns (uint256);

    function bondCncCrvUsdFor(
        uint256 lpTokenAmount,
        uint256 minCncReceived,
        uint64 cncLockTime,
        address recipient
    ) external returns (uint256);
}

interface IPoolAdapter {
    /// @notice This is to set which LP token price the value computation should use
    /// `Latest` uses a freshly computed price
    /// `Cached` uses the price in cache
    /// `Minimum` uses the minimum of these two
    enum PriceMode {
        Latest,
        Cached,
        Minimum
    }

    /// @notice Deposit `underlyingAmount` of `underlying` into `pool`
    /// @dev This function should be written with the assumption that it will be delegate-called into
    function deposit(address pool, address underlying, uint256 underlyingAmount) external;

    /// @notice Withdraw `underlyingAmount` of `underlying` from `pool`
    /// @dev This function should be written with the assumption that it will be delegate-called into
    function withdraw(address pool, address underlying, uint256 underlyingAmount) external;

    /// @notice Returns the amount of of assets that `conicPool` holds in `pool`, in terms of USD
    function computePoolValueInUSD(
        address conicPool,
        address pool
    ) external view returns (uint256 usdAmount);

    /// @notice Updates the price caches of the given pools
    function updatePriceCache(address pool) external;

    /// @notice Returns the amount of of assets that `conicPool` holds in `pool`, in terms of USD
    /// using the given price mode
    function computePoolValueInUSD(
        address conicPool,
        address pool,
        PriceMode priceMode
    ) external view returns (uint256 usdAmount);

    /// @notice Returns the amount of of assets that `conicPool` holds in `pool`, in terms of underlying
    function computePoolValueInUnderlying(
        address conicPool,
        address pool,
        address underlying,
        uint256 underlyingPrice
    ) external view returns (uint256 underlyingAmount);

    /// @notice Returns the amount of of assets that `conicPool` holds in `pool`, in terms of underlying
    /// using the given price mode
    function computePoolValueInUnderlying(
        address conicPool,
        address pool,
        address underlying,
        uint256 underlyingPrice,
        PriceMode priceMode
    ) external view returns (uint256 underlyingAmount);

    /// @notice Claim earnings of `conicPool` from `pool`
    function claimEarnings(address conicPool, address pool) external;

    /// @notice Returns the LP token of a given `pool`
    function lpToken(address pool) external view returns (address);

    /// @notice Returns true if `pool` supports `asset`
    function supportsAsset(address pool, address asset) external view returns (bool);

    /// @notice Returns the amount of CRV earned by `pool` on Convex
    function getCRVEarnedOnConvex(
        address account,
        address curvePool
    ) external view returns (uint256);

    /// @notice Executes a sanity check, e.g. checking for reentrancy
    function executeSanityCheck(address pool) external;

    /// @notice returns all the underlying coins of the pool
    function getAllUnderlyingCoins(address pool) external view returns (address[] memory);
}

interface IFeeRecipient {
    event FeesReceived(address indexed sender, uint256 crvAmount, uint256 cvxAmount);

    function receiveFees(uint256 amountCrv, uint256 amountCvx) external;
}

interface IBooster {
    function poolInfo(
        uint256 pid
    )
        external
        view
        returns (
            address lpToken,
            address token,
            address gauge,
            address crvRewards,
            address stash,
            bool shutdown
        );

    function poolLength() external view returns (uint256);

    function deposit(uint256 _pid, uint256 _amount, bool _stake) external returns (bool);

    function withdraw(uint256 _pid, uint256 _amount) external returns (bool);

    function withdrawAll(uint256 _pid) external returns (bool);

    function depositAll(uint256 _pid, bool _stake) external returns (bool);

    function earmarkRewards(uint256 _pid) external returns (bool);

    function isShutdown() external view returns (bool);
}

interface ICurvePoolV2 {
    function token() external view returns (address);

    function coins(uint256 i) external view returns (address);

    function factory() external view returns (address);

    function exchange(
        uint256 i,
        uint256 j,
        uint256 dx,
        uint256 min_dy,
        bool use_eth,
        address receiver
    ) external returns (uint256);

    function exchange_underlying(
        uint256 i,
        uint256 j,
        uint256 dx,
        uint256 min_dy,
        address receiver
    ) external returns (uint256);

    function add_liquidity(
        uint256[2] memory amounts,
        uint256 min_mint_amount,
        bool use_eth,
        address receiver
    ) external returns (uint256);

    function add_liquidity(
        uint256[2] memory amounts,
        uint256 min_mint_amount
    ) external returns (uint256);

    function add_liquidity(
        uint256[3] memory amounts,
        uint256 min_mint_amount,
        bool use_eth,
        address receiver
    ) external returns (uint256);

    function add_liquidity(
        uint256[3] memory amounts,
        uint256 min_mint_amount
    ) external returns (uint256);

    function remove_liquidity(
        uint256 _amount,
        uint256[2] memory min_amounts,
        bool use_eth,
        address receiver
    ) external;

    function remove_liquidity(uint256 _amount, uint256[2] memory min_amounts) external;

    function remove_liquidity(
        uint256 _amount,
        uint256[3] memory min_amounts,
        bool use_eth,
        address receiver
    ) external;

    function remove_liquidity(uint256 _amount, uint256[3] memory min_amounts) external;

    function remove_liquidity_one_coin(
        uint256 token_amount,
        uint256 i,
        uint256 min_amount,
        bool use_eth,
        address receiver
    ) external returns (uint256);

    function get_dy(uint256 i, uint256 j, uint256 dx) external view returns (uint256);

    function calc_token_amount(uint256[] memory amounts) external view returns (uint256);

    function calc_withdraw_one_coin(
        uint256 token_amount,
        uint256 i
    ) external view returns (uint256);

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

interface ICurvePoolV1 {
    function get_virtual_price() external view returns (uint256);

    function add_liquidity(uint256[8] calldata amounts, uint256 min_mint_amount) external;

    function add_liquidity(uint256[7] calldata amounts, uint256 min_mint_amount) external;

    function add_liquidity(uint256[6] calldata amounts, uint256 min_mint_amount) external;

    function add_liquidity(uint256[5] calldata amounts, uint256 min_mint_amount) external;

    function add_liquidity(uint256[4] calldata amounts, uint256 min_mint_amount) external;

    function add_liquidity(uint256[3] calldata amounts, uint256 min_mint_amount) external;

    function add_liquidity(uint256[2] calldata amounts, uint256 min_mint_amount) external;

    function remove_liquidity_imbalance(
        uint256[4] calldata amounts,
        uint256 max_burn_amount
    ) external;

    function remove_liquidity_imbalance(
        uint256[3] calldata amounts,
        uint256 max_burn_amount
    ) external;

    function remove_liquidity_imbalance(
        uint256[2] calldata amounts,
        uint256 max_burn_amount
    ) external;

    function lp_token() external view returns (address);

    function A_PRECISION() external view returns (uint256);

    function A_precise() external view returns (uint256);

    function remove_liquidity(uint256 _amount, uint256[3] calldata min_amounts) external;

    function exchange(
        int128 from,
        int128 to,
        uint256 _from_amount,
        uint256 _min_to_amount
    ) external;

    function coins(uint256 i) external view returns (address);

    function balances(uint256 i) external view returns (uint256);

    function get_dy(int128 i, int128 j, uint256 _dx) external view returns (uint256);

    function calc_token_amount(
        uint256[4] calldata amounts,
        bool deposit
    ) external view returns (uint256);

    function calc_token_amount(
        uint256[3] calldata amounts,
        bool deposit
    ) external view returns (uint256);

    function calc_token_amount(
        uint256[2] calldata amounts,
        bool deposit
    ) external view returns (uint256);

    function calc_withdraw_one_coin(
        uint256 _token_amount,
        int128 i
    ) external view returns (uint256);

    function remove_liquidity_one_coin(
        uint256 _token_amount,
        int128 i,
        uint256 min_amount
    ) external;

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

library ScaledMath {
    uint256 internal constant DECIMALS = 18;
    uint256 internal constant ONE = 10 ** DECIMALS;

    function mulDown(uint256 a, uint256 b) internal pure returns (uint256) {
        return (a * b) / ONE;
    }

    function mulDown(uint256 a, uint256 b, uint256 decimals) internal pure returns (uint256) {
        return (a * b) / (10 ** decimals);
    }

    function divDown(uint256 a, uint256 b) internal pure returns (uint256) {
        return (a * ONE) / b;
    }

    function divDown(uint256 a, uint256 b, uint256 decimals) internal pure returns (uint256) {
        return (a * 10 ** decimals) / b;
    }

    function divUp(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }
        return ((a * ONE) - 1) / b + 1;
    }

    function mulDown(int256 a, int256 b) internal pure returns (int256) {
        return (a * b) / int256(ONE);
    }

    function mulDownUint128(uint128 a, uint128 b) internal pure returns (uint128) {
        return (a * b) / uint128(ONE);
    }

    function mulDown(int256 a, int256 b, uint256 decimals) internal pure returns (int256) {
        return (a * b) / int256(10 ** decimals);
    }

    function divDown(int256 a, int256 b) internal pure returns (int256) {
        return (a * int256(ONE)) / b;
    }

    function divDownUint128(uint128 a, uint128 b) internal pure returns (uint128) {
        return (a * uint128(ONE)) / b;
    }

    function divDown(int256 a, int256 b, uint256 decimals) internal pure returns (int256) {
        return (a * int256(10 ** decimals)) / b;
    }

    function convertScale(
        uint256 a,
        uint8 fromDecimals,
        uint8 toDecimals
    ) internal pure returns (uint256) {
        if (fromDecimals == toDecimals) return a;
        if (fromDecimals > toDecimals) return downscale(a, fromDecimals, toDecimals);
        return upscale(a, fromDecimals, toDecimals);
    }

    function convertScale(
        int256 a,
        uint8 fromDecimals,
        uint8 toDecimals
    ) internal pure returns (int256) {
        if (fromDecimals == toDecimals) return a;
        if (fromDecimals > toDecimals) return downscale(a, fromDecimals, toDecimals);
        return upscale(a, fromDecimals, toDecimals);
    }

    function upscale(
        uint256 a,
        uint8 fromDecimals,
        uint8 toDecimals
    ) internal pure returns (uint256) {
        return a * (10 ** (toDecimals - fromDecimals));
    }

    function downscale(
        uint256 a,
        uint8 fromDecimals,
        uint8 toDecimals
    ) internal pure returns (uint256) {
        return a / (10 ** (fromDecimals - toDecimals));
    }

    function upscale(
        int256 a,
        uint8 fromDecimals,
        uint8 toDecimals
    ) internal pure returns (int256) {
        return a * int256(10 ** (toDecimals - fromDecimals));
    }

    function downscale(
        int256 a,
        uint8 fromDecimals,
        uint8 toDecimals
    ) internal pure returns (int256) {
        return a / int256(10 ** (fromDecimals - toDecimals));
    }

    function intPow(uint256 a, uint256 n) internal pure returns (uint256) {
        uint256 result = ONE;
        for (uint256 i; i < n; ) {
            result = mulDown(result, a);
            unchecked {
                ++i;
            }
        }
        return result;
    }

    function absSub(uint256 a, uint256 b) internal pure returns (uint256) {
        unchecked {
            return a >= b ? a - b : b - a;
        }
    }

    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a <= b ? a : b;
    }
}

library CurvePoolUtils {
    using ScaledMath for uint256;

    error NotWithinThreshold(address pool, uint256 assetA, uint256 assetB);

    /// @dev by default, allow for 30 bps deviation regardless of pool fees
    uint256 internal constant _DEFAULT_IMBALANCE_BUFFER = 30e14;

    /// @dev Curve scales the `fee` by 1e10
    uint8 internal constant _CURVE_POOL_FEE_DECIMALS = 10;

    /// @dev allow imbalance to be buffer + 3x the fee, e.g. if fee is 3.6 bps and buffer is 30 bps, allow 40.8 bps
    uint256 internal constant _FEE_IMBALANCE_MULTIPLIER = 3;

    enum AssetType {
        USD,
        ETH,
        BTC,
        OTHER,
        CRYPTO
    }

    struct PoolMeta {
        address pool;
        uint256 numberOfCoins;
        AssetType assetType;
        uint256[] decimals;
        uint256[] prices;
        uint256[] imbalanceBuffers;
    }

    function ensurePoolBalanced(PoolMeta memory poolMeta) internal view {
        uint256 poolFee = ICurvePoolV1(poolMeta.pool).fee().convertScale(
            _CURVE_POOL_FEE_DECIMALS,
            18
        );

        for (uint256 i = 0; i < poolMeta.numberOfCoins - 1; i++) {
            uint256 fromDecimals = poolMeta.decimals[i];
            uint256 fromBalance = 10 ** fromDecimals;
            uint256 fromPrice = poolMeta.prices[i];

            for (uint256 j = i + 1; j < poolMeta.numberOfCoins; j++) {
                uint256 toDecimals = poolMeta.decimals[j];
                uint256 toPrice = poolMeta.prices[j];
                uint256 toExpectedUnscaled = (fromBalance * fromPrice) / toPrice;
                uint256 toExpected = toExpectedUnscaled.convertScale(
                    uint8(fromDecimals),
                    uint8(toDecimals)
                );

                uint256 toActual;

                if (poolMeta.assetType == AssetType.CRYPTO) {
                    // Handling crypto pools
                    toActual = ICurvePoolV2(poolMeta.pool).get_dy(i, j, fromBalance);
                } else {
                    // Handling other pools
                    toActual = ICurvePoolV1(poolMeta.pool).get_dy(
                        int128(uint128(i)),
                        int128(uint128(j)),
                        fromBalance
                    );
                }
                uint256 _maxImbalanceBuffer = poolMeta.imbalanceBuffers[i].max(
                    poolMeta.imbalanceBuffers[j]
                );

                if (!_isWithinThreshold(toExpected, toActual, poolFee, _maxImbalanceBuffer))
                    revert NotWithinThreshold(poolMeta.pool, i, j);
            }
        }
    }

    function _isWithinThreshold(
        uint256 a,
        uint256 b,
        uint256 poolFee,
        uint256 imbalanceBuffer
    ) internal pure returns (bool) {
        if (imbalanceBuffer == 0) imbalanceBuffer = _DEFAULT_IMBALANCE_BUFFER;
        uint256 imbalanceTreshold = imbalanceBuffer + poolFee * _FEE_IMBALANCE_MULTIPLIER;
        if (a > b) return (a - b).divDown(a) <= imbalanceTreshold;
        return (b - a).divDown(b) <= imbalanceTreshold;
    }
}

library Types {
    struct Coin {
        address coinAddress;
        uint8 decimals;
    }

    struct CliffInfo {
        uint256 currentCliff;
        bool withinThreshold;
    }

    struct PoolInfo {
        address lpToken;
        address basePool;
        uint256 assetType;
    }
}

interface ICurveRegistryCache {
    event PoolInitialized(address indexed pool, uint256 indexed pid);

    function BOOSTER() external view returns (IBooster);

    function initPool(address pool_) external;

    function initPool(address pool_, uint256 pid_) external;

    function initPool(address pool_, Types.PoolInfo memory poolInfo_) external;

    function initPool(address pool_, uint256 pid_, Types.PoolInfo memory poolInfo_) external;

    function lpToken(address pool_) external view returns (address);

    function assetType(address pool_) external view returns (CurvePoolUtils.AssetType);

    function isRegistered(address pool_) external view returns (bool);

    function hasCoinDirectly(address pool_, address coin_) external view returns (bool);

    function hasCoinAnywhere(address pool_, address coin_) external view returns (bool);

    function basePool(address pool_) external view returns (address);

    function coinIndex(address pool_, address coin_) external view returns (int128);

    function nCoins(address pool_) external view returns (uint256);

    function coinIndices(
        address pool_,
        address from_,
        address to_
    ) external view returns (int128, int128, bool);

    function decimals(address pool_) external view returns (uint256[] memory);

    function interfaceVersion(address pool_) external view returns (uint256);

    function poolFromLpToken(address lpToken_) external view returns (address);

    function coins(address pool_) external view returns (address[] memory);

    function getPid(address _pool) external view returns (uint256);

    function getRewardPool(address _pool) external view returns (address);

    function isShutdownPid(uint256 pid_) external view returns (bool);

    /// @notice this returns the underlying coins of a pool, including the underlying of the base pool
    /// if the given pool is a meta pool
    /// This does not return the LP token of the base pool as an underlying
    /// e.g. if the pool is 3CrvFrax, this will return FRAX, DAI, USDC, USDT
    function getAllUnderlyingCoins(address pool) external view returns (address[] memory);
}

interface IController {
    event PoolAdded(address indexed pool);
    event PoolRemoved(address indexed pool);
    event PoolShutdown(address indexed pool);
    event ConvexBoosterSet(address convexBooster);
    event CurveHandlerSet(address curveHandler);
    event ConvexHandlerSet(address convexHandler);
    event CurveRegistryCacheSet(address curveRegistryCache);
    event InflationManagerSet(address inflationManager);
    event BondingSet(address bonding);
    event FeeRecipientSet(address feeRecipient);
    event PriceOracleSet(address priceOracle);
    event WeightUpdateMinDelaySet(uint256 weightUpdateMinDelay);
    event PauseManagerSet(address indexed manager, bool isManager);
    event MultiDepositsWithdrawsWhitelistSet(address pool, bool allowed);
    event MinimumTaintedTransferAmountSet(address indexed token, uint256 amount);
    event DefaultPoolAdapterSet(address poolAdapter);
    event CustomPoolAdapterSet(address indexed pool, address poolAdapter);

    struct WeightUpdate {
        address conicPoolAddress;
        IConicPoolWeightManagement.PoolWeight[] weights;
    }

    function initialize(address _lpTokenStaker) external;

    // inflation manager

    function inflationManager() external view returns (IInflationManager);

    function setInflationManager(address manager) external;

    // views
    function curveRegistryCache() external view returns (ICurveRegistryCache);

    // pool adapter
    function poolAdapterFor(address pool) external view returns (IPoolAdapter);

    function defaultPoolAdapter() external view returns (IPoolAdapter);

    function setDefaultPoolAdapter(address poolAdapter) external;

    function setCustomPoolAdapter(address pool, address poolAdapter) external;

    /// lp token staker
    function switchLpTokenStaker(address _lpTokenStaker) external;

    function lpTokenStaker() external view returns (ILpTokenStaker);

    // bonding
    function bonding() external view returns (IBonding);

    function setBonding(address _bonding) external;

    // fees
    function feeRecipient() external view returns (IFeeRecipient);

    function setFeeRecipient(address _feeRecipient) external;

    // oracle
    function priceOracle() external view returns (IGenericOracle);

    function setPriceOracle(address oracle) external;

    // pool functions

    function listPools() external view returns (address[] memory);

    function listActivePools() external view returns (address[] memory);

    function isPool(address poolAddress) external view returns (bool);

    function isActivePool(address poolAddress) external view returns (bool);

    function addPool(address poolAddress) external;

    function shutdownPool(address poolAddress) external;

    function removePool(address poolAddress) external;

    function cncToken() external view returns (address);

    function lastWeightUpdate(address poolAddress) external view returns (uint256);

    function updateWeights(WeightUpdate memory update) external;

    function updateAllWeights(WeightUpdate[] memory weights) external;

    // handler functions

    function convexBooster() external view returns (address);

    function curveHandler() external view returns (address);

    function convexHandler() external view returns (address);

    function setConvexBooster(address _convexBooster) external;

    function setCurveHandler(address _curveHandler) external;

    function setConvexHandler(address _convexHandler) external;

    function setCurveRegistryCache(address curveRegistryCache_) external;

    function setWeightUpdateMinDelay(uint256 delay) external;

    function isPauseManager(address account) external view returns (bool);

    function listPauseManagers() external view returns (address[] memory);

    function setPauseManager(address account, bool isManager) external;

    // deposit/withdrawal whitelist
    function isAllowedMultipleDepositsWithdraws(address poolAddress) external view returns (bool);

    function setAllowedMultipleDepositsWithdraws(address account, bool allowed) external;

    function getMultipleDepositsWithdrawsWhitelist() external view returns (address[] memory);

    // tainted transfer amount
    function setMinimumTaintedTransferAmount(address token, uint256 amount) external;

    function getMinimumTaintedTransferAmount(address token) external view returns (uint256);

    // constants

    function MAX_WEIGHT_UPDATE_MIN_DELAY() external view returns (uint256);

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

// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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);
    }
}

interface IPausable {
    event Paused(uint256 pausedUntil);
    event PauseDurationSet(uint256 pauseDuration);

    function controller() external view returns (IController);

    function pausedUntil() external view returns (uint256);

    function pauseDuration() external view returns (uint256);

    function isPaused() external view returns (bool);

    function setPauseDuration(uint256 _pauseDuration) external;

    function pause() external;
}

interface IConicPool is IConicPoolWeightManagement, IPausable {
    event Deposit(
        address indexed sender,
        address indexed receiver,
        uint256 depositedAmount,
        uint256 lpReceived
    );
    event Withdraw(address indexed account, uint256 amount);
    event NewWeight(address indexed curvePool, uint256 newWeight);
    event NewMaxIdleCurveLpRatio(uint256 newRatio);
    event ClaimedRewards(uint256 claimedCrv, uint256 claimedCvx);
    event HandledDepeggedCurvePool(address curvePool_);
    event HandledInvalidConvexPid(address curvePool_, uint256 pid_);
    event CurvePoolAdded(address curvePool_);
    event CurvePoolRemoved(address curvePool_);
    event Shutdown();
    event DepegThresholdUpdated(uint256 newThreshold);
    event MaxDeviationUpdated(uint256 newMaxDeviation);
    event RebalancingRewardsEnabledSet(bool enabled);
    event EmergencyRebalancingRewardFactorUpdated(uint256 factor);

    struct PoolWithAmount {
        address poolAddress;
        uint256 amount;
    }

    function underlying() external view returns (IERC20Metadata);

    function lpToken() external view returns (ILpToken);

    function rewardManager() external view returns (IRewardManager);

    function depegThreshold() external view returns (uint256);

    function maxDeviation() external view returns (uint256);

    function maxIdleCurveLpRatio() external view returns (uint256);

    function setMaxIdleCurveLpRatio(uint256 value) external;

    function setMaxDeviation(uint256 maxDeviation_) external;

    function updateDepegThreshold(uint256 value) external;

    function depositFor(
        address _account,
        uint256 _amount,
        uint256 _minLpReceived,
        bool stake
    ) external returns (uint256);

    function deposit(uint256 _amount, uint256 _minLpReceived) external returns (uint256);

    function deposit(
        uint256 _amount,
        uint256 _minLpReceived,
        bool stake
    ) external returns (uint256);

    function exchangeRate() external view returns (uint256);

    function usdExchangeRate() external view returns (uint256);

    function unstakeAndWithdraw(uint256 _amount, uint256 _minAmount) external returns (uint256);

    function unstakeAndWithdraw(
        uint256 _amount,
        uint256 _minAmount,
        address _to
    ) external returns (uint256);

    function withdraw(uint256 _amount, uint256 _minAmount) external returns (uint256);

    function withdraw(uint256 _amount, uint256 _minAmount, address _to) external returns (uint256);

    function getAllocatedUnderlying() external view returns (PoolWithAmount[] memory);

    function rebalancingRewardActive() external view returns (bool);

    function totalDeviationAfterWeightUpdate() external view returns (uint256);

    function computeTotalDeviation() external view returns (uint256);

    /// @notice returns the total amount of funds held by this pool in terms of underlying
    function totalUnderlying() external view returns (uint256);

    function getTotalAndPerPoolUnderlying()
        external
        view
        returns (
            uint256 totalUnderlying_,
            uint256 totalAllocated_,
            uint256[] memory perPoolUnderlying_
        );

    /// @notice same as `totalUnderlying` but returns a cached version
    /// that might be slightly outdated if oracle prices have changed
    /// @dev this is useful in cases where we want to reduce gas usage and do
    /// not need a precise value
    function cachedTotalUnderlying() external view returns (uint256);

    function updateRewardSpendingApproval(address token, bool approved) external;

    function shutdownPool() external;

    function isShutdown() external view returns (bool);

    function isBalanced() external view returns (bool);

    function rebalancingRewardsEnabled() external view returns (bool);

    function setRebalancingRewardsEnabled(bool enabled) external;

    function getAllUnderlyingCoins() external view returns (address[] memory result);

    function rebalancingRewardsFactor() external view returns (uint256);

    function rebalancingRewardsActivatedAt() external view returns (uint64);

    function getWeights() external view returns (PoolWeight[] memory);

    function runSanityChecks() external;
}

interface IConicPoolWeightManager is IConicPoolWeightManagement {
    function getDepositPool(
        uint256 totalUnderlying_,
        uint256[] memory allocatedPerPool,
        uint256 maxDeviation
    ) external view returns (uint256 poolIndex, uint256 maxDepositAmount);

    function getWithdrawPool(
        uint256 totalUnderlying_,
        uint256[] memory allocatedPerPool,
        uint256 maxDeviation
    ) external view returns (uint256 withdrawPoolIndex, uint256 maxWithdrawalAmount);

    function computeTotalDeviation(
        uint256 allocatedUnderlying_,
        uint256[] memory perPoolAllocations_
    ) external view returns (uint256);

    function isBalanced(
        uint256[] memory allocatedPerPool_,
        uint256 totalAllocated_,
        uint256 maxDeviation
    ) external view returns (bool);
}

contract ConicPoolWeightManager is IConicPoolWeightManager {
    using EnumerableSet for EnumerableSet.AddressSet;
    using EnumerableMap for EnumerableMap.AddressToUintMap;
    using ScaledMath for uint256;
    using SafeERC20 for IERC20;

    event CurvePoolAdded(address curvePool_);
    event CurvePoolRemoved(address curvePool_);
    event NewWeight(address indexed curvePool, uint256 newWeight);

    uint256 internal constant _MAX_USD_VALUE_FOR_REMOVING_POOL = 100e18;
    uint256 internal constant _MAX_CURVE_POOLS = 10;

    IConicPool public immutable conicPool;
    IController public immutable controller;
    IERC20Metadata public immutable underlying;

    EnumerableSet.AddressSet internal _pools;
    EnumerableMap.AddressToUintMap internal weights; // liquidity allocation weights

    modifier onlyController() {
        require(msg.sender == address(controller), "not authorized");
        _;
    }

    modifier onlyConicPool() {
        require(msg.sender == address(conicPool), "not authorized");
        _;
    }

    constructor(IController _controller, IERC20Metadata _underlying) {
        conicPool = IConicPool(msg.sender);
        controller = _controller;
        underlying = _underlying;
    }

    function addPool(address _pool) external onlyConicPool {
        require(_pools.length() < _MAX_CURVE_POOLS, "max pools reached");
        require(!_pools.contains(_pool), "pool already added");
        IPoolAdapter poolAdapter = controller.poolAdapterFor(_pool);
        bool supported_ = poolAdapter.supportsAsset(_pool, address(underlying));
        require(supported_, "coin not in pool");
        address lpToken_ = poolAdapter.lpToken(_pool);
        require(controller.priceOracle().isTokenSupported(lpToken_), "cannot price LP Token");

        if (!weights.contains(_pool)) weights.set(_pool, 0);
        require(_pools.add(_pool), "failed to add pool");
        emit CurvePoolAdded(_pool);
    }

    // This requires that the weight of the pool is first set to 0
    function removePool(address _pool) external onlyConicPool {
        require(_pools.contains(_pool), "pool not added");
        require(_pools.length() > 1, "cannot remove last pool");
        IPoolAdapter poolAdapter = controller.poolAdapterFor(_pool);
        uint256 usdValue = poolAdapter.computePoolValueInUSD(address(conicPool), _pool);
        require(usdValue < _MAX_USD_VALUE_FOR_REMOVING_POOL, "pool has allocated funds");
        uint256 weight = weights.get(_pool);
        require(weight == 0, "pool has weight set");
        require(_pools.remove(_pool), "pool not removed");
        require(weights.remove(_pool), "weight not removed");
        emit CurvePoolRemoved(_pool);
    }

    function updateWeights(PoolWeight[] memory poolWeights) external onlyConicPool {
        require(poolWeights.length == _pools.length(), "invalid pool weights");
        uint256 total;

        address previousPool;
        for (uint256 i; i < poolWeights.length; i++) {
            address pool_ = poolWeights[i].poolAddress;
            require(pool_ > previousPool, "pools not sorted");
            require(isRegisteredPool(pool_), "pool is not registered");
            uint256 newWeight = poolWeights[i].weight;
            weights.set(pool_, newWeight);
            emit NewWeight(pool_, newWeight);
            total += newWeight;
            previousPool = pool_;
        }

        require(total == ScaledMath.ONE, "weights do not sum to 1");
    }

    function handleDepeggedCurvePool(address curvePool_) external onlyConicPool {
        // Validation
        require(isRegisteredPool(curvePool_), "pool is not registered");
        require(weights.get(curvePool_) != 0, "pool weight already 0");

        // Set target curve pool weight to 0
        // Scale up other weights to compensate
        _setWeightToZero(curvePool_);
    }

    function handleInvalidConvexPid(address curvePool_) external onlyConicPool returns (uint256) {
        require(isRegisteredPool(curvePool_), "curve pool not registered");
        ICurveRegistryCache registryCache_ = controller.curveRegistryCache();
        uint256 pid = registryCache_.getPid(curvePool_);
        require(registryCache_.isShutdownPid(pid), "convex pool pid is not shut down");
        _setWeightToZero(curvePool_);
        return pid;
    }

    function getDepositPool(
        uint256 totalUnderlying_,
        uint256[] memory allocatedPerPool,
        uint256 maxDeviation
    ) external view returns (uint256 poolIndex, uint256 maxDepositAmount) {
        uint256 poolsCount_ = allocatedPerPool.length;
        int256 iPoolIndex = -1;
        for (uint256 i; i < poolsCount_; i++) {
            address pool_ = _pools.at(i);
            uint256 allocatedUnderlying_ = allocatedPerPool[i];
            uint256 weight_ = weights.get(pool_);
            uint256 targetAllocation_ = totalUnderlying_.mulDown(weight_);
            if (allocatedUnderlying_ >= targetAllocation_) continue;
            // Compute max balance with deviation
            uint256 weightWithDeviation_ = weight_.mulDown(ScaledMath.ONE + maxDeviation);
            weightWithDeviation_ = weightWithDeviation_ > ScaledMath.ONE
                ? ScaledMath.ONE
                : weightWithDeviation_;
            uint256 maxBalance_ = totalUnderlying_.mulDown(weightWithDeviation_);
            uint256 maxDepositAmount_ = maxBalance_ - allocatedUnderlying_;
            if (maxDepositAmount_ <= maxDepositAmount) continue;
            maxDepositAmount = maxDepositAmount_;
            iPoolIndex = int256(i);
        }
        require(iPoolIndex > -1, "error retrieving deposit pool");
        poolIndex = uint256(iPoolIndex);
    }

    function getWithdrawPool(
        uint256 totalUnderlying_,
        uint256[] memory allocatedPerPool,
        uint256 maxDeviation
    ) external view returns (uint256 withdrawPoolIndex, uint256 maxWithdrawalAmount) {
        uint256 poolsCount_ = allocatedPerPool.length;
        int256 iWithdrawPoolIndex = -1;
        for (uint256 i; i < poolsCount_; i++) {
            address curvePool_ = _pools.at(i);
            uint256 weight_ = weights.get(curvePool_);
            uint256 allocatedUnderlying_ = allocatedPerPool[i];

            // If a pool has a weight of 0,
            // withdraw from it if it has more than the max lp value
            if (weight_ == 0) {
                uint256 price_ = controller.priceOracle().getUSDPrice(address(underlying));
                uint256 allocatedUsd = (price_ * allocatedUnderlying_) /
                    10 ** underlying.decimals();
                if (allocatedUsd >= _MAX_USD_VALUE_FOR_REMOVING_POOL / 2) {
                    return (uint256(i), allocatedUnderlying_);
                }
            }

            uint256 targetAllocation_ = totalUnderlying_.mulDown(weight_);
            if (allocatedUnderlying_ <= targetAllocation_) continue;
            uint256 minBalance_ = targetAllocation_ - targetAllocation_.mulDown(maxDeviation);
            uint256 maxWithdrawalAmount_ = allocatedUnderlying_ - minBalance_;
            if (maxWithdrawalAmount_ <= maxWithdrawalAmount) continue;
            maxWithdrawalAmount = maxWithdrawalAmount_;
            iWithdrawPoolIndex = int256(i);
        }
        require(iWithdrawPoolIndex > -1, "error retrieving withdraw pool");
        withdrawPoolIndex = uint256(iWithdrawPoolIndex);
    }

    function allPools() external view returns (address[] memory) {
        return _pools.values();
    }

    function poolsCount() external view returns (uint256) {
        return _pools.length();
    }

    function getPoolAtIndex(uint256 _index) external view returns (address) {
        return _pools.at(_index);
    }

    function isRegisteredPool(address _pool) public view returns (bool) {
        return _pools.contains(_pool);
    }

    function getWeight(address pool) external view returns (uint256) {
        return weights.get(pool);
    }

    function getWeights() external view returns (IConicPool.PoolWeight[] memory) {
        uint256 length_ = _pools.length();
        IConicPool.PoolWeight[] memory weights_ = new IConicPool.PoolWeight[](length_);
        for (uint256 i; i < length_; i++) {
            (address pool_, uint256 weight_) = weights.at(i);
            weights_[i] = PoolWeight(pool_, weight_);
        }
        return weights_;
    }

    function computeTotalDeviation(
        uint256 allocatedUnderlying_,
        uint256[] memory perPoolAllocations_
    ) external view returns (uint256) {
        uint256 totalDeviation;
        for (uint256 i; i < perPoolAllocations_.length; i++) {
            uint256 weight = weights.get(_pools.at(i));
            uint256 targetAmount = allocatedUnderlying_.mulDown(weight);
            totalDeviation += targetAmount.absSub(perPoolAllocations_[i]);
        }
        return totalDeviation;
    }

    function isBalanced(
        uint256[] memory allocatedPerPool_,
        uint256 totalAllocated_,
        uint256 maxDeviation
    ) external view returns (bool) {
        if (totalAllocated_ == 0) return true;
        for (uint256 i; i < allocatedPerPool_.length; i++) {
            uint256 weight_ = weights.get(_pools.at(i));
            uint256 currentAllocated_ = allocatedPerPool_[i];

            // If a curve pool has a weight of 0,
            if (weight_ == 0) {
                uint256 price_ = controller.priceOracle().getUSDPrice(address(underlying));
                uint256 allocatedUsd_ = (price_ * currentAllocated_) / 10 ** underlying.decimals();
                if (allocatedUsd_ >= _MAX_USD_VALUE_FOR_REMOVING_POOL / 2) {
                    return false;
                }
                continue;
            }

            uint256 targetAmount = totalAllocated_.mulDown(weight_);
            uint256 deviation = targetAmount.absSub(currentAllocated_);
            uint256 deviationRatio = deviation.divDown(targetAmount);

            if (deviationRatio > maxDeviation) return false;
        }
        return true;
    }

    function _setWeightToZero(address zeroedPool) internal {
        uint256 weight_ = weights.get(zeroedPool);
        if (weight_ == 0) return;
        require(weight_ != ScaledMath.ONE, "can't remove last pool");
        uint256 scaleUp_ = ScaledMath.ONE.divDown(ScaledMath.ONE - weights.get(zeroedPool));
        uint256 curvePoolLength_ = _pools.length();

        weights.set(zeroedPool, 0);
        emit NewWeight(zeroedPool, 0);

        address[] memory nonZeroPools = new address[](curvePoolLength_ - 1);
        uint256[] memory nonZeroWeights = new uint256[](curvePoolLength_ - 1);
        uint256 nonZeroPoolsCount;
        for (uint256 i; i < curvePoolLength_; i++) {
            address pool_ = _pools.at(i);
            uint256 currentWeight = weights.get(pool_);
            if (currentWeight == 0) continue;
            nonZeroPools[nonZeroPoolsCount] = pool_;
            nonZeroWeights[nonZeroPoolsCount] = currentWeight;
            nonZeroPoolsCount++;
        }

        uint256 totalWeight;
        for (uint256 i; i < nonZeroPoolsCount; i++) {
            address pool_ = nonZeroPools[i];
            uint256 newWeight_ = nonZeroWeights[i].mulDown(scaleUp_);
            // ensure that the sum of the weights is 1 despite potential rounding errors
            if (i == nonZeroPoolsCount - 1) {
                newWeight_ = ScaledMath.ONE - totalWeight;
            }
            totalWeight += newWeight_;
            weights.set(pool_, newWeight_);
            emit NewWeight(pool_, newWeight_);
        }
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IController","name":"_controller","type":"address"},{"internalType":"contract IERC20Metadata","name":"_underlying","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"curvePool_","type":"address"}],"name":"CurvePoolAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"curvePool_","type":"address"}],"name":"CurvePoolRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"curvePool","type":"address"},{"indexed":false,"internalType":"uint256","name":"newWeight","type":"uint256"}],"name":"NewWeight","type":"event"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"addPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allPools","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"allocatedUnderlying_","type":"uint256"},{"internalType":"uint256[]","name":"perPoolAllocations_","type":"uint256[]"}],"name":"computeTotalDeviation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"conicPool","outputs":[{"internalType":"contract IConicPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"contract IController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalUnderlying_","type":"uint256"},{"internalType":"uint256[]","name":"allocatedPerPool","type":"uint256[]"},{"internalType":"uint256","name":"maxDeviation","type":"uint256"}],"name":"getDepositPool","outputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"internalType":"uint256","name":"maxDepositAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getPoolAtIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"getWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWeights","outputs":[{"components":[{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"uint256","name":"weight","type":"uint256"}],"internalType":"struct IConicPoolWeightManagement.PoolWeight[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalUnderlying_","type":"uint256"},{"internalType":"uint256[]","name":"allocatedPerPool","type":"uint256[]"},{"internalType":"uint256","name":"maxDeviation","type":"uint256"}],"name":"getWithdrawPool","outputs":[{"internalType":"uint256","name":"withdrawPoolIndex","type":"uint256"},{"internalType":"uint256","name":"maxWithdrawalAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"curvePool_","type":"address"}],"name":"handleDepeggedCurvePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"curvePool_","type":"address"}],"name":"handleInvalidConvexPid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"allocatedPerPool_","type":"uint256[]"},{"internalType":"uint256","name":"totalAllocated_","type":"uint256"},{"internalType":"uint256","name":"maxDeviation","type":"uint256"}],"name":"isBalanced","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"isRegisteredPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"removePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"uint256","name":"weight","type":"uint256"}],"internalType":"struct IConicPoolWeightManagement.PoolWeight[]","name":"poolWeights","type":"tuple[]"}],"name":"updateWeights","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101165760003560e01c80637e412a7a116100a2578063ac6c525111610071578063ac6c525114610283578063c5c63e6514610296578063c699e633146102ab578063d914cd4b146102be578063f77c4791146102d157600080fd5b80637e412a7a146102345780638c788de0146102555780638dbfb25b1461025d5780639765ca151461027057600080fd5b806339d82513116100e957806339d825131461019d5780633b7d0946146101b0578063519703de146101c35780636f307dc3146101e65780637d59ce011461020d57600080fd5b80631010b58c1461011b57806312968a291461014b57806322acb8671461017357806336797aec14610188575b600080fd5b61012e610129366004612116565b6102f8565b6040516001600160a01b0390911681526020015b60405180910390f35b61015e61015936600461222e565b61030a565b60408051928352602083019190915201610142565b61017b61047d565b604051610142919061227e565b61019b6101963660046122eb565b610564565b005b61015e6101ab36600461222e565b610658565b61019b6101be3660046122eb565b610963565b6101d66101d1366004612308565b610cf9565b6040519015158152602001610142565b61012e7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781565b61012e7f00000000000000000000000072c23c94f68669c7b6a5b6e8c87aa9b70c26314081565b610247610242366004612356565b610fa4565b604051908152602001610142565b610247611027565b61019b61026b36600461239d565b611038565b61024761027e3660046122eb565b6112a2565b6102476102913660046122eb565b6114f6565b61029e611503565b604051610142919061245c565b6101d66102b93660046122eb565b61150f565b61019b6102cc3660046122eb565b61151b565b61012e7f0000000000000000000000002790ec478f150a98f5d96755601a26403df57eae81565b600061030481836119ab565b92915050565b81516000908190600019825b8281101561041a57600061032a81836119ab565b90506000888381518110610340576103406124a9565b6020026020010151905060006103608360026119b790919063ffffffff16565b9050600061036e8c836119cc565b90508083106103805750505050610408565b60006103a38b6103926012600a6125b9565b61039c91906125c5565b84906119cc565b90506103b16012600a6125b9565b81116103bd57806103c9565b6103c96012600a6125b9565b905060006103d78e836119cc565b905060006103e586836125d8565b90508a81116103fa5750505050505050610408565b809a50879850505050505050505b80610412816125eb565b915050610316565b5060001981136104715760405162461bcd60e51b815260206004820152601d60248201527f6572726f722072657472696576696e67206465706f73697420706f6f6c00000060448201526064015b60405180910390fd5b96919550909350505050565b6060600061048b60006119ee565b905060008167ffffffffffffffff8111156104a8576104a861212f565b6040519080825280602002602001820160405280156104ed57816020015b60408051808201909152600080825260208201528152602001906001900390816104c65790505b50905060005b8281101561055d576000806105096002846119f8565b915091506040518060400160405280836001600160a01b031681526020018281525084848151811061053d5761053d6124a9565b602002602001018190525050508080610555906125eb565b9150506104f3565b5092915050565b336001600160a01b037f00000000000000000000000072c23c94f68669c7b6a5b6e8c87aa9b70c26314016146105ac5760405162461bcd60e51b815260040161046890612604565b6105b58161150f565b6105fa5760405162461bcd60e51b81526020600482015260166024820152751c1bdbdb081a5cc81b9bdd081c9959da5cdd195c995960521b6044820152606401610468565b6106056002826119b7565b60000361064c5760405162461bcd60e51b81526020600482015260156024820152740706f6f6c2077656967687420616c7265616479203605c1b6044820152606401610468565b61065581611a14565b50565b81516000908190600019825b8281101561090957600061067881836119ab565b905060006106876002836119b7565b9050600089848151811061069d5761069d6124a9565b60200260200101519050816000036108945760007f0000000000000000000000002790ec478f150a98f5d96755601a26403df57eae6001600160a01b0316632630c12f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561070f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610733919061262c565b604051638b2f0f4f60e01b81526001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7811660048301529190911690638b2f0f4f90602401602060405180830381865afa15801561079b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bf9190612649565b905060007f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610821573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108459190612662565b61085090600a612685565b61085a8484612694565b61086491906126ab565b905061087a600268056bc75e2d631000006126ab565b81106108915750939750955061095b945050505050565b50505b60006108a08c846119cc565b90508082116108b257505050506108f7565b60006108be828c6119cc565b6108c890836125d8565b905060006108d682856125d8565b90508981116108ea575050505050506108f7565b8099508697505050505050505b80610901816125eb565b915050610664565b5060001981136104715760405162461bcd60e51b815260206004820152601e60248201527f6572726f722072657472696576696e6720776974686472617720706f6f6c00006044820152606401610468565b935093915050565b336001600160a01b037f00000000000000000000000072c23c94f68669c7b6a5b6e8c87aa9b70c26314016146109ab5760405162461bcd60e51b815260040161046890612604565b6109b6600082611d6b565b6109f35760405162461bcd60e51b815260206004820152600e60248201526d1c1bdbdb081b9bdd08185919195960921b6044820152606401610468565b60016109ff60006119ee565b11610a4c5760405162461bcd60e51b815260206004820152601760248201527f63616e6e6f742072656d6f7665206c61737420706f6f6c0000000000000000006044820152606401610468565b6040516355eb6b3560e01b81526001600160a01b0382811660048301526000917f0000000000000000000000002790ec478f150a98f5d96755601a26403df57eae909116906355eb6b3590602401602060405180830381865afa158015610ab7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adb919061262c565b604051633dfa59d160e01b81526001600160a01b037f00000000000000000000000072c23c94f68669c7b6a5b6e8c87aa9b70c263140811660048301528481166024830152919250600091831690633dfa59d190604401602060405180830381865afa158015610b4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b739190612649565b905068056bc75e2d631000008110610bcd5760405162461bcd60e51b815260206004820152601860248201527f706f6f6c2068617320616c6c6f63617465642066756e647300000000000000006044820152606401610468565b6000610bda6002856119b7565b90508015610c205760405162461bcd60e51b81526020600482015260136024820152721c1bdbdb081a185cc81dd95a59da1d081cd95d606a1b6044820152606401610468565b610c2b600085611d8d565b610c6a5760405162461bcd60e51b815260206004820152601060248201526f1c1bdbdb081b9bdd081c995b5bdd995960821b6044820152606401610468565b610c75600285611da2565b610cb65760405162461bcd60e51b81526020600482015260126024820152711dd95a59da1d081b9bdd081c995b5bdd995960721b6044820152606401610468565b6040516001600160a01b03851681527fca2456580e344539a90d4d0369fc77866a3135141e2e51621b88d2f010c6bbe2906020015b60405180910390a150505050565b600082600003610d0b57506001610f9d565b60005b8451811015610f97576000610d2e610d2682846119ab565b6002906119b7565b90506000868381518110610d4457610d446124a9565b6020026020010151905081600003610f3e5760007f0000000000000000000000002790ec478f150a98f5d96755601a26403df57eae6001600160a01b0316632630c12f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610db6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dda919061262c565b604051638b2f0f4f60e01b81526001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7811660048301529190911690638b2f0f4f90602401602060405180830381865afa158015610e42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e669190612649565b905060007f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ec8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eec9190612662565b610ef790600a612685565b610f018484612694565b610f0b91906126ab565b9050610f21600268056bc75e2d631000006126ab565b8110610f3557600095505050505050610f9d565b50505050610f85565b6000610f4a87846119cc565b90506000610f588284611db7565b90506000610f668284611dcf565b905087811115610f7f5760009650505050505050610f9d565b50505050505b80610f8f816125eb565b915050610d0e565b50600190505b9392505050565b60008060005b835181101561101f576000610fc2610d2682846119ab565b90506000610fd087836119cc565b9050610ffe868481518110610fe757610fe76124a9565b602002602001015182611db790919063ffffffff16565b61100890856125c5565b935050508080611017906125eb565b915050610faa565b509392505050565b600061103360006119ee565b905090565b336001600160a01b037f00000000000000000000000072c23c94f68669c7b6a5b6e8c87aa9b70c26314016146110805760405162461bcd60e51b815260040161046890612604565b61108a60006119ee565b8151146110d05760405162461bcd60e51b8152602060048201526014602482015273696e76616c696420706f6f6c207765696768747360601b6044820152606401610468565b60008060005b83518110156112425760008482815181106110f3576110f36124a9565b6020026020010151600001519050826001600160a01b0316816001600160a01b0316116111555760405162461bcd60e51b815260206004820152601060248201526f1c1bdbdb1cc81b9bdd081cdbdc9d195960821b6044820152606401610468565b61115e8161150f565b6111a35760405162461bcd60e51b81526020600482015260166024820152751c1bdbdb081a5cc81b9bdd081c9959da5cdd195c995960521b6044820152606401610468565b60008583815181106111b7576111b76124a9565b60200260200101516020015190506111db82826002611de89092919063ffffffff16565b50816001600160a01b03167f49175c3467edeba7662e939bf84305eaf5084072855b0560f6ac3e145cd172ae8260405161121791815260200190565b60405180910390a261122981866125c5565b945090925081905061123a816125eb565b9150506110d6565b5061124f6012600a6125b9565b821461129d5760405162461bcd60e51b815260206004820152601760248201527f7765696768747320646f206e6f742073756d20746f20310000000000000000006044820152606401610468565b505050565b6000336001600160a01b037f00000000000000000000000072c23c94f68669c7b6a5b6e8c87aa9b70c26314016146112ec5760405162461bcd60e51b815260040161046890612604565b6112f58261150f565b6113415760405162461bcd60e51b815260206004820152601960248201527f637572766520706f6f6c206e6f742072656769737465726564000000000000006044820152606401610468565b60007f0000000000000000000000002790ec478f150a98f5d96755601a26403df57eae6001600160a01b0316639f82b2176040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c5919061262c565b6040516343b55f3560e01b81526001600160a01b0385811660048301529192506000918316906343b55f3590602401602060405180830381865afa158015611411573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114359190612649565b604051631cec69e560e11b8152600481018290529091506001600160a01b038316906339d8d3ca90602401602060405180830381865afa15801561147d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a191906126cd565b6114ed5760405162461bcd60e51b815260206004820181905260248201527f636f6e76657820706f6f6c20706964206973206e6f74207368757420646f776e6044820152606401610468565b610f9d84611a14565b60006103046002836119b7565b60606110336000611e06565b60006103048183611d6b565b336001600160a01b037f00000000000000000000000072c23c94f68669c7b6a5b6e8c87aa9b70c26314016146115635760405162461bcd60e51b815260040161046890612604565b600a61156f60006119ee565b106115b05760405162461bcd60e51b81526020600482015260116024820152701b585e081c1bdbdb1cc81c995858da1959607a1b6044820152606401610468565b6115bb600082611d6b565b156115fd5760405162461bcd60e51b81526020600482015260126024820152711c1bdbdb08185b1c9958591e48185919195960721b6044820152606401610468565b6040516355eb6b3560e01b81526001600160a01b0382811660048301526000917f0000000000000000000000002790ec478f150a98f5d96755601a26403df57eae909116906355eb6b3590602401602060405180830381865afa158015611668573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168c919061262c565b604051632aa2d3f760e21b81526001600160a01b0384811660048301527f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec78116602483015291925060009183169063aa8b4fdc90604401602060405180830381865afa158015611700573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172491906126cd565b9050806117665760405162461bcd60e51b815260206004820152601060248201526f18dbda5b881b9bdd081a5b881c1bdbdb60821b6044820152606401610468565b604051631da958a960e21b81526001600160a01b038481166004830152600091908416906376a562a490602401602060405180830381865afa1580156117b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d4919061262c565b90507f0000000000000000000000002790ec478f150a98f5d96755601a26403df57eae6001600160a01b0316632630c12f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611834573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611858919061262c565b6040516375151b6360e01b81526001600160a01b03838116600483015291909116906375151b6390602401602060405180830381865afa1580156118a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c491906126cd565b6119085760405162461bcd60e51b815260206004820152601560248201527431b0b73737ba10383934b1b2902628102a37b5b2b760591b6044820152606401610468565b611913600285611e13565b611926576119246002856000611de8565b505b611931600085611e28565b6119725760405162461bcd60e51b815260206004820152601260248201527119985a5b1959081d1bc8185919081c1bdbdb60721b6044820152606401610468565b6040516001600160a01b03851681527fbadad752e47b51d72487f7881b9baa7c0ed207b8d84f37c0e23eb0a6d67e5b1590602001610ceb565b6000610f9d8383611e3d565b6000610f9d836001600160a01b038416611e67565b60006119da6012600a6125b9565b6119e48385612694565b610f9d91906126ab565b6000610304825490565b6000808080611a078686611ed7565b9097909650945050505050565b6000611a216002836119b7565b905080600003611a2f575050565b611a3b6012600a6125b9565b8103611a825760405162461bcd60e51b815260206004820152601660248201527518d85b89dd081c995b5bdd99481b185cdd081c1bdbdb60521b6044820152606401610468565b6000611aba611a926002856119b7565b611a9e6012600a6125b9565b611aa891906125d8565b611ab46012600a6125b9565b90611dcf565b90506000611ac860006119ee565b9050611ad76002856000611de8565b50836001600160a01b03167f49175c3467edeba7662e939bf84305eaf5084072855b0560f6ac3e145cd172ae6000604051611b1491815260200190565b60405180910390a26000611b296001836125d8565b67ffffffffffffffff811115611b4157611b4161212f565b604051908082528060200260200182016040528015611b6a578160200160208202803683370190505b5090506000611b7a6001846125d8565b67ffffffffffffffff811115611b9257611b9261212f565b604051908082528060200260200182016040528015611bbb578160200160208202803683370190505b5090506000805b84811015611c69576000611bd681836119ab565b90506000611be56002836119b7565b905080600003611bf6575050611c57565b81868581518110611c0957611c096124a9565b60200260200101906001600160a01b031690816001600160a01b03168152505080858581518110611c3c57611c3c6124a9565b602090810291909101015283611c51816125eb565b94505050505b80611c61816125eb565b915050611bc2565b506000805b82811015611d60576000858281518110611c8a57611c8a6124a9565b602002602001015190506000611cc289878581518110611cac57611cac6124a9565b60200260200101516119cc90919063ffffffff16565b9050611ccf6001866125d8565b8303611cef5783611ce26012600a6125b9565b611cec91906125d8565b90505b611cf981856125c5565b9350611d0760028383611de8565b50816001600160a01b03167f49175c3467edeba7662e939bf84305eaf5084072855b0560f6ac3e145cd172ae82604051611d4391815260200190565b60405180910390a250508080611d58906125eb565b915050611c6e565b505050505050505050565b6001600160a01b03811660009081526001830160205260408120541515610f9d565b6000610f9d836001600160a01b038416611f02565b6000610f9d836001600160a01b038416611ff5565b600081831015611dc957828203610f9d565b50900390565b600081611dde6012600a6125b9565b6119e49085612694565b6000611dfe846001600160a01b03851684612012565b949350505050565b60606000610f9d8361202f565b6000610f9d836001600160a01b03841661208b565b6000610f9d836001600160a01b038416612097565b6000826000018281548110611e5457611e546124a9565b9060005260206000200154905092915050565b600081815260028301602052604081205480151580611e8b5750611e8b848461208b565b610f9d5760405162461bcd60e51b815260206004820152601e60248201527f456e756d657261626c654d61703a206e6f6e6578697374656e74206b657900006044820152606401610468565b60008080611ee585856119ab565b600081815260029690960160205260409095205494959350505050565b60008181526001830160205260408120548015611feb576000611f266001836125d8565b8554909150600090611f3a906001906125d8565b9050818114611f9f576000866000018281548110611f5a57611f5a6124a9565b9060005260206000200154905080876000018481548110611f7d57611f7d6124a9565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611fb057611fb06126ef565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610304565b6000915050610304565b60008181526002830160205260408120819055610f9d83836120e6565b60008281526002840160205260408120829055611dfe84846120f2565b60608160000180548060200260200160405190810160405280929190818152602001828054801561207f57602002820191906000526020600020905b81548152602001906001019080831161206b575b50505050509050919050565b6000610f9d83836120fe565b60008181526001830160205260408120546120de57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610304565b506000610304565b6000610f9d8383611f02565b6000610f9d8383612097565b60008181526001830160205260408120541515610f9d565b60006020828403121561212857600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156121685761216861212f565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156121975761219761212f565b604052919050565b600067ffffffffffffffff8211156121b9576121b961212f565b5060051b60200190565b600082601f8301126121d457600080fd5b813560206121e96121e48361219f565b61216e565b82815260059290921b8401810191818101908684111561220857600080fd5b8286015b84811015612223578035835291830191830161220c565b509695505050505050565b60008060006060848603121561224357600080fd5b83359250602084013567ffffffffffffffff81111561226157600080fd5b61226d868287016121c3565b925050604084013590509250925092565b602080825282518282018190526000919060409081850190868401855b828110156122c957815180516001600160a01b0316855286015186850152928401929085019060010161229b565b5091979650505050505050565b6001600160a01b038116811461065557600080fd5b6000602082840312156122fd57600080fd5b8135610f9d816122d6565b60008060006060848603121561231d57600080fd5b833567ffffffffffffffff81111561233457600080fd5b612340868287016121c3565b9660208601359650604090950135949350505050565b6000806040838503121561236957600080fd5b82359150602083013567ffffffffffffffff81111561238757600080fd5b612393858286016121c3565b9150509250929050565b600060208083850312156123b057600080fd5b823567ffffffffffffffff8111156123c757600080fd5b8301601f810185136123d857600080fd5b80356123e66121e48261219f565b81815260069190911b8201830190838101908783111561240557600080fd5b928401925b8284101561245157604084890312156124235760008081fd5b61242b612145565b8435612436816122d6565b8152848601358682015282526040909301929084019061240a565b979650505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561249d5783516001600160a01b031683529284019291840191600101612478565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600181815b808511156125105781600019048211156124f6576124f66124bf565b8085161561250357918102915b93841c93908002906124da565b509250929050565b60008261252757506001610304565b8161253457506000610304565b816001811461254a576002811461255457612570565b6001915050610304565b60ff841115612565576125656124bf565b50506001821b610304565b5060208310610133831016604e8410600b8410161715612593575081810a610304565b61259d83836124d5565b80600019048211156125b1576125b16124bf565b029392505050565b6000610f9d8383612518565b80820180821115610304576103046124bf565b81810381811115610304576103046124bf565b6000600182016125fd576125fd6124bf565b5060010190565b6020808252600e908201526d1b9bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b60006020828403121561263e57600080fd5b8151610f9d816122d6565b60006020828403121561265b57600080fd5b5051919050565b60006020828403121561267457600080fd5b815160ff81168114610f9d57600080fd5b6000610f9d60ff841683612518565b8082028115828204841417610304576103046124bf565b6000826126c857634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156126df57600080fd5b81518015158114610f9d57600080fd5b634e487b7160e01b600052603160045260246000fdfea2646970667358221220c22a397659fc9441e8e988d083b67e516de23ce2f8d711207471eeb7895a6dfe64736f6c63430008110033

Deployed Bytecode Sourcemap

98529:11829:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;106300:115;;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;363:32:1;;;345:51;;333:2;318:18;106300:115:0;;;;;;;;102954:1387;;;;;;:::i;:::-;;:::i;:::-;;;;2599:25:1;;;2655:2;2640:18;;2633:34;;;;2572:18;102954:1387:0;2425:248:1;106663:418:0;;;:::i;:::-;;;;;;;:::i;102084:390::-;;;;;;:::i;:::-;;:::i;:::-;;104349:1730;;;;;;:::i;:::-;;:::i;100590:705::-;;;;;;:::i;:::-;;:::i;107608:1172::-;;;;;;:::i;:::-;;:::i;:::-;;;4545:14:1;;4538:22;4520:41;;4508:2;4493:18;107608:1172:0;4380:187:1;99167:42:0;;;;;99077:37;;;;;107089:511;;;;;;:::i;:::-;;:::i;:::-;;;5597:25:1;;;5585:2;5570:18;107089:511:0;5451:177:1;106197:95:0;;;:::i;101303:773::-;;;;;;:::i;:::-;;:::i;102482:464::-;;;;;;:::i;:::-;;:::i;106547:108::-;;;;;;:::i;:::-;;:::i;106087:102::-;;;:::i;:::-;;;;;;;:::i;106423:116::-;;;;;;:::i;:::-;;:::i;99797:717::-;;;;;;:::i;:::-;;:::i;99121:39::-;;;;;106300:115;106363:7;106390:17;106363:7;106400:6;106390:9;:17::i;:::-;106383:24;106300:115;-1:-1:-1;;106300:115:0:o;102954:1387::-;103196:23;;103118:17;;;;-1:-1:-1;;103118:17:0;103263:961;103283:11;103279:1;:15;103263:961;;;103316:13;103332:12;103316:13;103342:1;103332:9;:12::i;:::-;103316:28;;103359;103390:16;103407:1;103390:19;;;;;;;;:::i;:::-;;;;;;;103359:50;;103424:15;103442:18;103454:5;103442:7;:11;;:18;;;;:::i;:::-;103424:36;-1:-1:-1;103475:25:0;103503:33;:16;103424:36;103503:24;:33::i;:::-;103475:61;;103579:17;103555:20;:41;103551:55;;103598:8;;;;;;103551:55;103672:28;103703:46;103736:12;75252:14;75211:2;75252;:14;:::i;:::-;103719:29;;;;:::i;:::-;103703:7;;:15;:46::i;:::-;103672:77;-1:-1:-1;75252:14:0;75211:2;75252;:14;:::i;:::-;103787:20;:37;:111;;103878:20;103787:111;;;75252:14;75211:2;75252;:14;:::i;:::-;103764:134;-1:-1:-1;103913:19:0;103935:46;:16;103764:134;103935:24;:46::i;:::-;103913:68;-1:-1:-1;103996:25:0;104024:34;104038:20;103913:68;104024:34;:::i;:::-;103996:62;;104098:16;104077:17;:37;104073:51;;104116:8;;;;;;;;;104073:51;104158:17;104139:36;;104210:1;104190:22;;103301:923;;;;;;;103263:961;103296:3;;;;:::i;:::-;;;;103263:961;;;;-1:-1:-1;;104242:10:0;:15;104234:57;;;;-1:-1:-1;;;104234:57:0;;10049:2:1;104234:57:0;;;10031:21:1;10088:2;10068:18;;;10061:30;10127:31;10107:18;;;10100:59;10176:18;;104234:57:0;;;;;;;;;104322:10;102954:1387;;-1:-1:-1;102954:1387:0;;-1:-1:-1;;;;102954:1387:0:o;106663:418::-;106708:30;106751:15;106769;:6;:13;:15::i;:::-;106751:33;;106795:39;106865:7;106837:36;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;;;;;;;106837:36:0;;;;;;;;;;;;;;;;106795:78;;106889:9;106884:164;106904:7;106900:1;:11;106884:164;;;106934:13;;106968;:7;106979:1;106968:10;:13::i;:::-;106933:48;;;;107010:26;;;;;;;;107021:5;-1:-1:-1;;;;;107010:26:0;;;;;107028:7;107010:26;;;106996:8;107005:1;106996:11;;;;;;;;:::i;:::-;;;;;;:40;;;;106918:130;;106913:3;;;;;:::i;:::-;;;;106884:164;;;-1:-1:-1;107065:8:0;106663:418;-1:-1:-1;;106663:418:0:o;102084:390::-;99522:10;-1:-1:-1;;;;;99544:9:0;99522:32;;99514:59;;;;-1:-1:-1;;;99514:59:0;;;;;;;:::i;:::-;102202:28:::1;102219:10;102202:16;:28::i;:::-;102194:63;;;::::0;-1:-1:-1;;;102194:63:0;;10750:2:1;102194:63:0::1;::::0;::::1;10732:21:1::0;10789:2;10769:18;;;10762:30;-1:-1:-1;;;10808:18:1;;;10801:52;10870:18;;102194:63:0::1;10548:346:1::0;102194:63:0::1;102276:23;:7;102288:10:::0;102276:11:::1;:23::i;:::-;102303:1;102276:28:::0;102268:62:::1;;;::::0;-1:-1:-1;;;102268:62:0;;11101:2:1;102268:62:0::1;::::0;::::1;11083:21:1::0;11140:2;11120:18;;;11113:30;-1:-1:-1;;;11159:18:1;;;11152:51;11220:18;;102268:62:0::1;10899:345:1::0;102268:62:0::1;102438:28;102455:10;102438:16;:28::i;:::-;102084:390:::0;:::o;104349:1730::-;104603:23;;104514:25;;;;-1:-1:-1;;104514:25:0;104678:1259;104698:11;104694:1;:15;104678:1259;;;104731:18;104752:12;104731:18;104762:1;104752:9;:12::i;:::-;104731:33;-1:-1:-1;104779:15:0;104797:23;:7;104731:33;104797:11;:23::i;:::-;104779:41;;104835:28;104866:16;104883:1;104866:19;;;;;;;;:::i;:::-;;;;;;;104835:50;;105021:7;105032:1;105021:12;105017:411;;105054:14;105071:10;-1:-1:-1;;;;;105071:22:0;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:57;;-1:-1:-1;;;105071:57:0;;-1:-1:-1;;;;;105116:10:0;363:32:1;;105071:57:0;;;345:51:1;105071:36:0;;;;;;;318:18:1;;105071:57:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;105054:74;;105147:20;105231:10;-1:-1:-1;;;;;105231:19:0;;:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;105225:27;;:2;:27;:::i;:::-;105171:29;105180:20;105171:6;:29;:::i;:::-;105170:82;;;;:::i;:::-;105147:105;-1:-1:-1;105291:36:0;105326:1;99008:6;105291:36;:::i;:::-;105275:12;:52;105271:142;;-1:-1:-1;105368:1:0;;-1:-1:-1;105372:20:0;-1:-1:-1;105352:41:0;;-1:-1:-1;;;;;105352:41:0;105271:142;105035:393;;105017:411;105444:25;105472:33;:16;105497:7;105472:24;:33::i;:::-;105444:61;;105548:17;105524:20;:41;105520:55;;105567:8;;;;;;105520:55;105590:19;105632:39;:17;105658:12;105632:25;:39::i;:::-;105612:59;;:17;:59;:::i;:::-;105590:81;-1:-1:-1;105686:28:0;105717:34;105590:81;105717:20;:34;:::i;:::-;105686:65;;105794:19;105770:20;:43;105766:57;;105815:8;;;;;;;;105766:57;105860:20;105838:42;;105923:1;105895:30;;104716:1221;;;;;;104678:1259;104711:3;;;;:::i;:::-;;;;104678:1259;;;;-1:-1:-1;;105955:18:0;:23;105947:66;;;;-1:-1:-1;;;105947:66:0;;12737:2:1;105947:66:0;;;12719:21:1;12776:2;12756:18;;;12749:30;12815:32;12795:18;;;12788:60;12865:18;;105947:66:0;12535:354:1;104349:1730:0;;;;;;;:::o;100590:705::-;99522:10;-1:-1:-1;;;;;99544:9:0;99522:32;;99514:59;;;;-1:-1:-1;;;99514:59:0;;;;;;;:::i;:::-;100667:22:::1;:6;100683:5:::0;100667:15:::1;:22::i;:::-;100659:49;;;::::0;-1:-1:-1;;;100659:49:0;;13096:2:1;100659:49:0::1;::::0;::::1;13078:21:1::0;13135:2;13115:18;;;13108:30;-1:-1:-1;;;13154:18:1;;;13147:44;13208:18;;100659:49:0::1;12894:338:1::0;100659:49:0::1;100745:1;100727:15;:6;:13;:15::i;:::-;:19;100719:55;;;::::0;-1:-1:-1;;;100719:55:0;;13439:2:1;100719:55:0::1;::::0;::::1;13421:21:1::0;13478:2;13458:18;;;13451:30;13517:25;13497:18;;;13490:53;13560:18;;100719:55:0::1;13237:347:1::0;100719:55:0::1;100812:32;::::0;-1:-1:-1;;;100812:32:0;;-1:-1:-1;;;;;363:32:1;;;100812::0::1;::::0;::::1;345:51:1::0;100785:24:0::1;::::0;100812:10:::1;:25:::0;;::::1;::::0;::::1;::::0;318:18:1;;100812:32:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;100874:60;::::0;-1:-1:-1;;;100874:60:0;;-1:-1:-1;;;;;100916:9:0::1;14096:15:1::0;;100874:60:0::1;::::0;::::1;14078:34:1::0;14148:15;;;14128:18;;;14121:43;100785:59:0;;-1:-1:-1;;;100874:33:0;::::1;::::0;::::1;::::0;14013:18:1;;100874:60:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;100855:79;;99008:6;100953:8;:43;100945:80;;;::::0;-1:-1:-1;;;100945:80:0;;14377:2:1;100945:80:0::1;::::0;::::1;14359:21:1::0;14416:2;14396:18;;;14389:30;14455:26;14435:18;;;14428:54;14499:18;;100945:80:0::1;14175:348:1::0;100945:80:0::1;101036:14;101053:18;:7;101065:5:::0;101053:11:::1;:18::i;:::-;101036:35:::0;-1:-1:-1;101090:11:0;;101082:43:::1;;;::::0;-1:-1:-1;;;101082:43:0;;14730:2:1;101082:43:0::1;::::0;::::1;14712:21:1::0;14769:2;14749:18;;;14742:30;-1:-1:-1;;;14788:18:1;;;14781:49;14847:18;;101082:43:0::1;14528:343:1::0;101082:43:0::1;101144:20;:6;101158:5:::0;101144:13:::1;:20::i;:::-;101136:49;;;::::0;-1:-1:-1;;;101136:49:0;;15078:2:1;101136:49:0::1;::::0;::::1;15060:21:1::0;15117:2;15097:18;;;15090:30;-1:-1:-1;;;15136:18:1;;;15129:46;15192:18;;101136:49:0::1;14876:340:1::0;101136:49:0::1;101204:21;:7;101219:5:::0;101204:14:::1;:21::i;:::-;101196:52;;;::::0;-1:-1:-1;;;101196:52:0;;15423:2:1;101196:52:0::1;::::0;::::1;15405:21:1::0;15462:2;15442:18;;;15435:30;-1:-1:-1;;;15481:18:1;;;15474:48;15539:18;;101196:52:0::1;15221:342:1::0;101196:52:0::1;101264:23;::::0;-1:-1:-1;;;;;363:32:1;;345:51;;101264:23:0::1;::::0;333:2:1;318:18;101264:23:0::1;;;;;;;;100648:647;;;100590:705:::0;:::o;107608:1172::-;107768:4;107789:15;107808:1;107789:20;107785:37;;-1:-1:-1;107818:4:0;107811:11;;107785:37;107838:9;107833:918;107853:17;:24;107849:1;:28;107833:918;;;107899:15;107917:25;107929:12;107899:15;107939:1;107929:9;:12::i;:::-;107917:7;;:11;:25::i;:::-;107899:43;;107957:25;107985:17;108003:1;107985:20;;;;;;;;:::i;:::-;;;;;;;107957:48;;108077:7;108088:1;108077:12;108073:387;;108110:14;108127:10;-1:-1:-1;;;;;108127:22:0;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:57;;-1:-1:-1;;;108127:57:0;;-1:-1:-1;;;;;108172:10:0;363:32:1;;108127:57:0;;;345:51:1;108127:36:0;;;;;;;318:18:1;;108127:57:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;108110:74;;108203:21;108264:10;-1:-1:-1;;;;;108264:19:0;;:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;108258:27;;:2;:27;:::i;:::-;108228:26;108237:17;108228:6;:26;:::i;:::-;108227:58;;;;:::i;:::-;108203:82;-1:-1:-1;108325:36:0;108360:1;99008:6;108325:36;:::i;:::-;108308:13;:53;108304:114;;108393:5;108386:12;;;;;;;;;108304:114;108436:8;;;;;;108073:387;108476:20;108499:32;:15;108523:7;108499:23;:32::i;:::-;108476:55;-1:-1:-1;108546:17:0;108566:38;108476:55;108586:17;108566:19;:38::i;:::-;108546:58;-1:-1:-1;108619:22:0;108644:31;108546:58;108662:12;108644:17;:31::i;:::-;108619:56;;108713:12;108696:14;:29;108692:47;;;108734:5;108727:12;;;;;;;;;;108692:47;107884:867;;;;;107833:918;107879:3;;;;:::i;:::-;;;;107833:918;;;;108768:4;108761:11;;107608:1172;;;;;;:::o;107089:511::-;107236:7;107256:22;107294:9;107289:272;107309:19;:26;107305:1;:30;107289:272;;;107357:14;107374:25;107386:12;107357:14;107396:1;107386:9;:12::i;107374:25::-;107357:42;-1:-1:-1;107414:20:0;107437:36;:20;107357:42;107437:28;:36::i;:::-;107414:59;;107506:43;107526:19;107546:1;107526:22;;;;;;;;:::i;:::-;;;;;;;107506:12;:19;;:43;;;;:::i;:::-;107488:61;;;;:::i;:::-;;;107342:219;;107337:3;;;;;:::i;:::-;;;;107289:272;;;-1:-1:-1;107578:14:0;107089:511;-1:-1:-1;;;107089:511:0:o;106197:95::-;106242:7;106269:15;:6;:13;:15::i;:::-;106262:22;;106197:95;:::o;101303:773::-;99522:10;-1:-1:-1;;;;;99544:9:0;99522:32;;99514:59;;;;-1:-1:-1;;;99514:59:0;;;;;;;:::i;:::-;101423:15:::1;:6;:13;:15::i;:::-;101401:11;:18;:37;101393:70;;;::::0;-1:-1:-1;;;101393:70:0;;15770:2:1;101393:70:0::1;::::0;::::1;15752:21:1::0;15809:2;15789:18;;;15782:30;-1:-1:-1;;;15828:18:1;;;15821:50;15888:18;;101393:70:0::1;15568:344:1::0;101393:70:0::1;101474:13;101500:20:::0;101536:9:::1;101531:466;101551:11;:18;101547:1;:22;101531:466;;;101591:13;101607:11;101619:1;101607:14;;;;;;;;:::i;:::-;;;;;;;:26;;;101591:42;;101664:12;-1:-1:-1::0;;;;;101656:20:0::1;:5;-1:-1:-1::0;;;;;101656:20:0::1;;101648:49;;;::::0;-1:-1:-1;;;101648:49:0;;16119:2:1;101648:49:0::1;::::0;::::1;16101:21:1::0;16158:2;16138:18;;;16131:30;-1:-1:-1;;;16177:18:1;;;16170:46;16233:18;;101648:49:0::1;15917:340:1::0;101648:49:0::1;101720:23;101737:5;101720:16;:23::i;:::-;101712:58;;;::::0;-1:-1:-1;;;101712:58:0;;10750:2:1;101712:58:0::1;::::0;::::1;10732:21:1::0;10789:2;10769:18;;;10762:30;-1:-1:-1;;;10808:18:1;;;10801:52;10870:18;;101712:58:0::1;10548:346:1::0;101712:58:0::1;101785:17;101805:11;101817:1;101805:14;;;;;;;;:::i;:::-;;;;;;;:21;;;101785:41;;101841:29;101853:5;101860:9;101841:7;:11;;:29;;;;;:::i;:::-;;101900:5;-1:-1:-1::0;;;;;101890:27:0::1;;101907:9;101890:27;;;;5597:25:1::0;;5585:2;5570:18;;5451:177;101890:27:0::1;;;;;;;;101932:18;101941:9:::0;101932:18;::::1;:::i;:::-;::::0;-1:-1:-1;101980:5:0;;-1:-1:-1;101571:3:0;;-1:-1:-1;101571:3:0::1;::::0;::::1;:::i;:::-;;;;101531:466;;;-1:-1:-1::0;75252:14:0::1;75211:2;75252;:14;:::i;:::-;102017:5;:23;102009:59;;;::::0;-1:-1:-1;;;102009:59:0;;16464:2:1;102009:59:0::1;::::0;::::1;16446:21:1::0;16503:2;16483:18;;;16476:30;16542:25;16522:18;;;16515:53;16585:18;;102009:59:0::1;16262:347:1::0;102009:59:0::1;101382:694;;101303:773:::0;:::o;102482:464::-;102566:7;99522:10;-1:-1:-1;;;;;99544:9:0;99522:32;;99514:59;;;;-1:-1:-1;;;99514:59:0;;;;;;;:::i;:::-;102594:28:::1;102611:10;102594:16;:28::i;:::-;102586:66;;;::::0;-1:-1:-1;;;102586:66:0;;16816:2:1;102586:66:0::1;::::0;::::1;16798:21:1::0;16855:2;16835:18;;;16828:30;16894:27;16874:18;;;16867:55;16939:18;;102586:66:0::1;16614:349:1::0;102586:66:0::1;102663:34;102700:10;-1:-1:-1::0;;;;;102700:29:0::1;;:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;102756:33;::::0;-1:-1:-1;;;102756:33:0;;-1:-1:-1;;;;;363:32:1;;;102756:33:0::1;::::0;::::1;345:51:1::0;102663:68:0;;-1:-1:-1;102742:11:0::1;::::0;102756:21;::::1;::::0;::::1;::::0;318:18:1;;102756:33:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;102808;::::0;-1:-1:-1;;;102808:33:0;;::::1;::::0;::::1;5597:25:1::0;;;102742:47:0;;-1:-1:-1;;;;;;102808:28:0;::::1;::::0;::::1;::::0;5570:18:1;;102808:33:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;102800:78;;;::::0;-1:-1:-1;;;102800:78:0;;17736:2:1;102800:78:0::1;::::0;::::1;17718:21:1::0;;;17755:18;;;17748:30;17814:34;17794:18;;;17787:62;17866:18;;102800:78:0::1;17534:356:1::0;102800:78:0::1;102889:28;102906:10;102889:16;:28::i;106547:108::-:0;106603:7;106630:17;:7;106642:4;106630:11;:17::i;106087:102::-;106130:16;106166:15;:6;:13;:15::i;106423:116::-;106485:4;106509:22;106485:4;106525:5;106509:15;:22::i;99797:717::-;99522:10;-1:-1:-1;;;;;99544:9:0;99522:32;;99514:59;;;;-1:-1:-1;;;99514:59:0;;;;;;;:::i;:::-;99066:2:::1;99871:15;:6;:13;:15::i;:::-;:34;99863:64;;;::::0;-1:-1:-1;;;99863:64:0;;18097:2:1;99863:64:0::1;::::0;::::1;18079:21:1::0;18136:2;18116:18;;;18109:30;-1:-1:-1;;;18155:18:1;;;18148:47;18212:18;;99863:64:0::1;17895:341:1::0;99863:64:0::1;99947:22;:6;99963:5:::0;99947:15:::1;:22::i;:::-;99946:23;99938:54;;;::::0;-1:-1:-1;;;99938:54:0;;18443:2:1;99938:54:0::1;::::0;::::1;18425:21:1::0;18482:2;18462:18;;;18455:30;-1:-1:-1;;;18501:18:1;;;18494:48;18559:18;;99938:54:0::1;18241:342:1::0;99938:54:0::1;100030:32;::::0;-1:-1:-1;;;100030:32:0;;-1:-1:-1;;;;;363:32:1;;;100030::0::1;::::0;::::1;345:51:1::0;100003:24:0::1;::::0;100030:10:::1;:25:::0;;::::1;::::0;::::1;::::0;318:18:1;;100030:32:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;100091:53;::::0;-1:-1:-1;;;100091:53:0;;-1:-1:-1;;;;;14096:15:1;;;100091:53:0::1;::::0;::::1;14078:34:1::0;100132:10:0::1;14148:15:1::0;;14128:18;;;14121:43;100003:59:0;;-1:-1:-1;100073:15:0::1;::::0;100091:25;::::1;::::0;::::1;::::0;14013:18:1;;100091:53:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;100073:71;;100163:10;100155:39;;;::::0;-1:-1:-1;;;100155:39:0;;18790:2:1;100155:39:0::1;::::0;::::1;18772:21:1::0;18829:2;18809:18;;;18802:30;-1:-1:-1;;;18848:18:1;;;18841:46;18904:18;;100155:39:0::1;18588:340:1::0;100155:39:0::1;100224:26;::::0;-1:-1:-1;;;100224:26:0;;-1:-1:-1;;;;;363:32:1;;;100224:26:0::1;::::0;::::1;345:51:1::0;100205:16:0::1;::::0;100224:19;;::::1;::::0;::::1;::::0;318:18:1;;100224:26:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;100205:45;;100269:10;-1:-1:-1::0;;;;;100269:22:0::1;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:51;::::0;-1:-1:-1;;;100269:51:0;;-1:-1:-1;;;;;363:32:1;;;100269:51:0::1;::::0;::::1;345::1::0;100269:41:0;;;::::1;::::0;::::1;::::0;318:18:1;;100269:51:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;100261:85;;;::::0;-1:-1:-1;;;100261:85:0;;19391:2:1;100261:85:0::1;::::0;::::1;19373:21:1::0;19430:2;19410:18;;;19403:30;-1:-1:-1;;;19449:18:1;;;19442:51;19510:18;;100261:85:0::1;19189:345:1::0;100261:85:0::1;100364:23;:7;100381:5:::0;100364:16:::1;:23::i;:::-;100359:51;;100389:21;:7;100401:5:::0;100408:1:::1;100389:11;:21::i;:::-;;100359:51;100429:17;:6;100440:5:::0;100429:10:::1;:17::i;:::-;100421:48;;;::::0;-1:-1:-1;;;100421:48:0;;19741:2:1;100421:48:0::1;::::0;::::1;19723:21:1::0;19780:2;19760:18;;;19753:30;-1:-1:-1;;;19799:18:1;;;19792:48;19857:18;;100421:48:0::1;19539:342:1::0;100421:48:0::1;100485:21;::::0;-1:-1:-1;;;;;363:32:1;;345:51;;100485:21:0::1;::::0;333:2:1;318:18;100485:21:0::1;199:203:1::0;9856:158:0;9930:7;9981:22;9985:3;9997:5;9981:3;:22::i;29782:170::-;29861:7;29896:47;29900:3;-1:-1:-1;;;;;29920:21:0;;29896:3;:47::i;75275:110::-;75337:7;75252:14;75211:2;75252;:14;:::i;:::-;75365:5;75369:1;75365;:5;:::i;:::-;75364:13;;;;:::i;9385:117::-;9448:7;9475:19;9483:3;4685:18;;4602:109;28999:235;29079:7;;;;29139:21;29142:3;29154:5;29139:2;:21::i;:::-;29108:52;;;;-1:-1:-1;28999:235:0;-1:-1:-1;;;;;28999:235:0:o;108788:1567::-;108854:15;108872:23;:7;108884:10;108872:11;:23::i;:::-;108854:41;;108910:7;108921:1;108910:12;108906:25;;108924:7;108788:1567;:::o;108906:25::-;75252:14;75211:2;75252;:14;:::i;:::-;108949:7;:25;108941:60;;;;-1:-1:-1;;;108941:60:0;;20088:2:1;108941:60:0;;;20070:21:1;20127:2;20107:18;;;20100:30;-1:-1:-1;;;20146:18:1;;;20139:52;20208:18;;108941:60:0;19886:346:1;108941:60:0;109012:16;109031:64;109071:23;:7;109083:10;109071:11;:23::i;:::-;75252:14;75211:2;75252;:14;:::i;:::-;109054:40;;;;:::i;:::-;75252:14;75211:2;75252;:14;:::i;:::-;109031:22;;:64::i;:::-;109012:83;;109106:24;109133:15;:6;:13;:15::i;:::-;109106:42;-1:-1:-1;109161:26:0;:7;109173:10;109185:1;109161:11;:26::i;:::-;;109213:10;-1:-1:-1;;;;;109203:24:0;;109225:1;109203:24;;;;5597:25:1;;5585:2;5570:18;;5451:177;109203:24:0;;;;;;;;109240:29;109286:20;109305:1;109286:16;:20;:::i;:::-;109272:35;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;109272:35:0;-1:-1:-1;109240:67:0;-1:-1:-1;109318:31:0;109366:20;109385:1;109366:16;:20;:::i;:::-;109352:35;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;109352:35:0;;109318:69;;109398:25;109439:9;109434:354;109454:16;109450:1;:20;109434:354;;;109492:13;109508:12;109492:13;109518:1;109508:9;:12::i;:::-;109492:28;-1:-1:-1;109535:21:0;109559:18;:7;109492:28;109559:11;:18::i;:::-;109535:42;;109596:13;109613:1;109596:18;109592:32;;109616:8;;;;109592:32;109673:5;109639:12;109652:17;109639:31;;;;;;;;:::i;:::-;;;;;;:39;-1:-1:-1;;;;;109639:39:0;;;-1:-1:-1;;;;;109639:39:0;;;;;109729:13;109693:14;109708:17;109693:33;;;;;;;;:::i;:::-;;;;;;;;;;:49;109757:19;;;;:::i;:::-;;;;109477:311;;109434:354;109472:3;;;;:::i;:::-;;;;109434:354;;;;109800:19;109835:9;109830:518;109850:17;109846:1;:21;109830:518;;;109889:13;109905:12;109918:1;109905:15;;;;;;;;:::i;:::-;;;;;;;109889:31;;109935:18;109956:35;109982:8;109956:14;109971:1;109956:17;;;;;;;;:::i;:::-;;;;;;;:25;;:35;;;;:::i;:::-;109935:56;-1:-1:-1;110105:21:0;110125:1;110105:17;:21;:::i;:::-;110100:1;:26;110096:108;;110177:11;75252:14;75211:2;75252;:14;:::i;:::-;110160:28;;;;:::i;:::-;110147:41;;110096:108;110218:25;110233:10;110218:25;;:::i;:::-;;-1:-1:-1;110258:30:0;:7;110270:5;110277:10;110258:11;:30::i;:::-;;110318:5;-1:-1:-1;;;;;110308:28:0;;110325:10;110308:28;;;;5597:25:1;;5585:2;5570:18;;5451:177;110308:28:0;;;;;;;;109874:474;;109869:3;;;;;:::i;:::-;;;;109830:518;;;;108843:1512;;;;;;;108788:1567;:::o;9132:167::-;-1:-1:-1;;;;;9266:23:0;;9212:4;4484:19;;;:12;;;:19;;;;;;:24;;9236:55;4387:129;8888:158;8961:4;8985:53;8993:3;-1:-1:-1;;;;;9013:23:0;;8985:7;:53::i;28030:159::-;28107:4;28131:50;28138:3;-1:-1:-1;;;;;28158:21:0;;28131:6;:50::i;78620:154::-;78681:7;78738:1;78733;:6;;:22;;78754:1;78750;:5;78733:22;;;-1:-1:-1;78742:5:0;;;78620:154::o;75542:110::-;75604:7;75643:1;75252:14;75211:2;75252;:14;:::i;:::-;75632:7;;:1;:7;:::i;27680:184::-;27769:4;27793:63;27797:3;-1:-1:-1;;;;;27817:21:0;;27849:5;27793:3;:63::i;:::-;27786:70;27680:184;-1:-1:-1;;;;27680:184:0:o;10564:310::-;10627:16;10656:22;10681:19;10689:3;10681:7;:19::i;28273:168::-;28357:4;28381:52;28390:3;-1:-1:-1;;;;;28410:21:0;;28381:8;:52::i;8560:152::-;8630:4;8654:50;8659:3;-1:-1:-1;;;;;8679:23:0;;8654:4;:50::i;5065:120::-;5132:7;5159:3;:11;;5171:5;5159:18;;;;;;;;:::i;:::-;;;;;;;;;5152:25;;5065:120;;;;:::o;18011:251::-;18093:7;18129:16;;;:11;;;:16;;;;;;18164:10;;;;:32;;;18178:18;18187:3;18192;18178:8;:18::i;:::-;18156:75;;;;-1:-1:-1;;;18156:75:0;;20629:2:1;18156:75:0;;;20611:21:1;20668:2;20648:18;;;20641:30;20707:32;20687:18;;;20680:60;20757:18;;18156:75:0;20427:354:1;17205:194:0;17288:7;;;17331:19;:3;17344:5;17331:12;:19::i;:::-;17374:16;;;;:11;;;;;:16;;;;;;;;;17205:194;-1:-1:-1;;;;17205:194:0:o;2881:1420::-;2947:4;3086:19;;;:12;;;:19;;;;;;3122:15;;3118:1176;;3497:21;3521:14;3534:1;3521:10;:14;:::i;:::-;3570:18;;3497:38;;-1:-1:-1;3550:17:0;;3570:22;;3591:1;;3570:22;:::i;:::-;3550:42;;3626:13;3613:9;:26;3609:405;;3660:17;3680:3;:11;;3692:9;3680:22;;;;;;;;:::i;:::-;;;;;;;;;3660:42;;3834:9;3805:3;:11;;3817:13;3805:26;;;;;;;;:::i;:::-;;;;;;;;;;;;:38;;;;3919:23;;;:12;;;:23;;;;;:36;;;3609:405;4095:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;4190:3;:12;;:19;4203:5;4190:19;;;;;;;;;;;4183:26;;;4233:4;4226:11;;;;;;;3118:1176;4277:5;4270:12;;;;;16227:167;16307:4;16331:16;;;:11;;;:16;;;;;16324:23;;;16365:21;16331:3;16343;16365:16;:21::i;15875:177::-;15967:4;15984:16;;;:11;;;:16;;;;;:24;;;16026:18;15984:3;15996;16026:13;:18::i;5735:111::-;5791:16;5827:3;:11;;5820:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5735:111;;;:::o;16478:142::-;16565:4;16589:23;:3;16608;16589:18;:23::i;2291:414::-;2354:4;4484:19;;;:12;;;:19;;;;;;2371:327;;-1:-1:-1;2414:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;2597:18;;2575:19;;;:12;;;:19;;;;;;:40;;;;2630:11;;2371:327;-1:-1:-1;2681:5:0;2674:12;;6401:131;6474:4;6498:26;6506:3;6518:5;6498:7;:26::i;6100:125::-;6170:4;6194:23;6199:3;6211:5;6194:4;:23::i;6618:140::-;6698:4;4484:19;;;:12;;;:19;;;;;;:24;;6722:28;4387:129;14:180:1;73:6;126:2;114:9;105:7;101:23;97:32;94:52;;;142:1;139;132:12;94:52;-1:-1:-1;165:23:1;;14:180;-1:-1:-1;14:180:1:o;407:127::-;468:10;463:3;459:20;456:1;449:31;499:4;496:1;489:15;523:4;520:1;513:15;539:257;611:4;605:11;;;643:17;;690:18;675:34;;711:22;;;672:62;669:88;;;737:18;;:::i;:::-;773:4;766:24;539:257;:::o;801:275::-;872:2;866:9;937:2;918:13;;-1:-1:-1;;914:27:1;902:40;;972:18;957:34;;993:22;;;954:62;951:88;;;1019:18;;:::i;:::-;1055:2;1048:22;801:275;;-1:-1:-1;801:275:1:o;1081:183::-;1141:4;1174:18;1166:6;1163:30;1160:56;;;1196:18;;:::i;:::-;-1:-1:-1;1241:1:1;1237:14;1253:4;1233:25;;1081:183::o;1269:662::-;1323:5;1376:3;1369:4;1361:6;1357:17;1353:27;1343:55;;1394:1;1391;1384:12;1343:55;1430:6;1417:20;1456:4;1480:60;1496:43;1536:2;1496:43;:::i;:::-;1480:60;:::i;:::-;1574:15;;;1660:1;1656:10;;;;1644:23;;1640:32;;;1605:12;;;;1684:15;;;1681:35;;;1712:1;1709;1702:12;1681:35;1748:2;1740:6;1736:15;1760:142;1776:6;1771:3;1768:15;1760:142;;;1842:17;;1830:30;;1880:12;;;;1793;;1760:142;;;-1:-1:-1;1920:5:1;1269:662;-1:-1:-1;;;;;;1269:662:1:o;1936:484::-;2038:6;2046;2054;2107:2;2095:9;2086:7;2082:23;2078:32;2075:52;;;2123:1;2120;2113:12;2075:52;2159:9;2146:23;2136:33;;2220:2;2209:9;2205:18;2192:32;2247:18;2239:6;2236:30;2233:50;;;2279:1;2276;2269:12;2233:50;2302:61;2355:7;2346:6;2335:9;2331:22;2302:61;:::i;:::-;2292:71;;;2410:2;2399:9;2395:18;2382:32;2372:42;;1936:484;;;;;:::o;2678:820::-;2905:2;2957:21;;;3027:13;;2930:18;;;3049:22;;;2876:4;;2905:2;3090;;3108:18;;;;3149:15;;;2876:4;3192:280;3206:6;3203:1;3200:13;3192:280;;;3265:13;;3307:9;;-1:-1:-1;;;;;3303:35:1;3291:48;;3379:11;;3373:18;3359:12;;;3352:40;3412:12;;;;3447:15;;;;3335:1;3221:9;3192:280;;;-1:-1:-1;3489:3:1;;2678:820;-1:-1:-1;;;;;;;2678:820:1:o;3503:131::-;-1:-1:-1;;;;;3578:31:1;;3568:42;;3558:70;;3624:1;3621;3614:12;3639:247;3698:6;3751:2;3739:9;3730:7;3726:23;3722:32;3719:52;;;3767:1;3764;3757:12;3719:52;3806:9;3793:23;3825:31;3850:5;3825:31;:::i;3891:484::-;3993:6;4001;4009;4062:2;4050:9;4041:7;4037:23;4033:32;4030:52;;;4078:1;4075;4068:12;4030:52;4118:9;4105:23;4151:18;4143:6;4140:30;4137:50;;;4183:1;4180;4173:12;4137:50;4206:61;4259:7;4250:6;4239:9;4235:22;4206:61;:::i;:::-;4196:71;4314:2;4299:18;;4286:32;;-1:-1:-1;4365:2:1;4350:18;;;4337:32;;3891:484;-1:-1:-1;;;;3891:484:1:o;5030:416::-;5123:6;5131;5184:2;5172:9;5163:7;5159:23;5155:32;5152:52;;;5200:1;5197;5190:12;5152:52;5236:9;5223:23;5213:33;;5297:2;5286:9;5282:18;5269:32;5324:18;5316:6;5313:30;5310:50;;;5356:1;5353;5346:12;5310:50;5379:61;5432:7;5423:6;5412:9;5408:22;5379:61;:::i;:::-;5369:71;;;5030:416;;;;;:::o;5633:1277::-;5745:6;5776:2;5819;5807:9;5798:7;5794:23;5790:32;5787:52;;;5835:1;5832;5825:12;5787:52;5875:9;5862:23;5908:18;5900:6;5897:30;5894:50;;;5940:1;5937;5930:12;5894:50;5963:22;;6016:4;6008:13;;6004:27;-1:-1:-1;5994:55:1;;6045:1;6042;6035:12;5994:55;6081:2;6068:16;6104:60;6120:43;6160:2;6120:43;:::i;6104:60::-;6198:15;;;6280:1;6276:10;;;;6268:19;;6264:28;;;6229:12;;;;6304:19;;;6301:39;;;6336:1;6333;6326:12;6301:39;6360:11;;;;6380:500;6396:6;6391:3;6388:15;6380:500;;;6478:4;6472:3;6463:7;6459:17;6455:28;6452:118;;;6524:1;6553:2;6549;6542:14;6452:118;6596:22;;:::i;:::-;6659:3;6646:17;6676:33;6701:7;6676:33;:::i;:::-;6722:22;;6793:12;;;6780:26;6764:14;;;6757:50;6820:18;;6422:4;6413:14;;;;6858:12;;;;6380:500;;;6899:5;5633:1277;-1:-1:-1;;;;;;;5633:1277:1:o;6915:658::-;7086:2;7138:21;;;7208:13;;7111:18;;;7230:22;;;7057:4;;7086:2;7309:15;;;;7283:2;7268:18;;;7057:4;7352:195;7366:6;7363:1;7360:13;7352:195;;;7431:13;;-1:-1:-1;;;;;7427:39:1;7415:52;;7522:15;;;;7487:12;;;;7463:1;7381:9;7352:195;;;-1:-1:-1;7564:3:1;;6915:658;-1:-1:-1;;;;;;6915:658:1:o;7806:127::-;7867:10;7862:3;7858:20;7855:1;7848:31;7898:4;7895:1;7888:15;7922:4;7919:1;7912:15;7938:127;7999:10;7994:3;7990:20;7987:1;7980:31;8030:4;8027:1;8020:15;8054:4;8051:1;8044:15;8070:422;8159:1;8202:5;8159:1;8216:270;8237:7;8227:8;8224:21;8216:270;;;8296:4;8292:1;8288:6;8284:17;8278:4;8275:27;8272:53;;;8305:18;;:::i;:::-;8355:7;8345:8;8341:22;8338:55;;;8375:16;;;;8338:55;8454:22;;;;8414:15;;;;8216:270;;;8220:3;8070:422;;;;;:::o;8497:806::-;8546:5;8576:8;8566:80;;-1:-1:-1;8617:1:1;8631:5;;8566:80;8665:4;8655:76;;-1:-1:-1;8702:1:1;8716:5;;8655:76;8747:4;8765:1;8760:59;;;;8833:1;8828:130;;;;8740:218;;8760:59;8790:1;8781:10;;8804:5;;;8828:130;8865:3;8855:8;8852:17;8849:43;;;8872:18;;:::i;:::-;-1:-1:-1;;8928:1:1;8914:16;;8943:5;;8740:218;;9042:2;9032:8;9029:16;9023:3;9017:4;9014:13;9010:36;9004:2;8994:8;8991:16;8986:2;8980:4;8977:12;8973:35;8970:77;8967:159;;;-1:-1:-1;9079:19:1;;;9111:5;;8967:159;9158:34;9183:8;9177:4;9158:34;:::i;:::-;9228:6;9224:1;9220:6;9216:19;9207:7;9204:32;9201:58;;;9239:18;;:::i;:::-;9277:20;;8497:806;-1:-1:-1;;;8497:806:1:o;9308:131::-;9368:5;9397:36;9424:8;9418:4;9397:36;:::i;9444:125::-;9509:9;;;9530:10;;;9527:36;;;9543:18;;:::i;9574:128::-;9641:9;;;9662:11;;;9659:37;;;9676:18;;:::i;9707:135::-;9746:3;9767:17;;;9764:43;;9787:18;;:::i;:::-;-1:-1:-1;9834:1:1;9823:13;;9707:135::o;10205:338::-;10407:2;10389:21;;;10446:2;10426:18;;;10419:30;-1:-1:-1;;;10480:2:1;10465:18;;10458:44;10534:2;10519:18;;10205:338::o;11249:274::-;11342:6;11395:2;11383:9;11374:7;11370:23;11366:32;11363:52;;;11411:1;11408;11401:12;11363:52;11443:9;11437:16;11462:31;11487:5;11462:31;:::i;11528:184::-;11598:6;11651:2;11639:9;11630:7;11626:23;11622:32;11619:52;;;11667:1;11664;11657:12;11619:52;-1:-1:-1;11690:16:1;;11528:184;-1:-1:-1;11528:184:1:o;11717:273::-;11785:6;11838:2;11826:9;11817:7;11813:23;11809:32;11806:52;;;11854:1;11851;11844:12;11806:52;11886:9;11880:16;11936:4;11929:5;11925:16;11918:5;11915:27;11905:55;;11956:1;11953;11946:12;11995:140;12053:5;12082:47;12123:4;12113:8;12109:19;12103:4;12082:47;:::i;12140:168::-;12213:9;;;12244;;12261:15;;;12255:22;;12241:37;12231:71;;12282:18;;:::i;12313:217::-;12353:1;12379;12369:132;;12423:10;12418:3;12414:20;12411:1;12404:31;12458:4;12455:1;12448:15;12486:4;12483:1;12476:15;12369:132;-1:-1:-1;12515:9:1;;12313:217::o;17252:277::-;17319:6;17372:2;17360:9;17351:7;17347:23;17343:32;17340:52;;;17388:1;17385;17378:12;17340:52;17420:9;17414:16;17473:5;17466:13;17459:21;17452:5;17449:32;17439:60;;17495:1;17492;17485:12;20786:127;20847:10;20842:3;20838:20;20835:1;20828:31;20878:4;20875:1;20868:15;20902:4;20899:1;20892:15

Swarm Source

ipfs://c22a397659fc9441e8e988d083b67e516de23ce2f8d711207471eeb7895a6dfe

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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