APE Price: $1.04 (+1.27%)

Contract

0xee86576502771Ed56696364C8Ee46881474098cf

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Parent Transaction Hash Block From To
65271102024-12-11 12:50:4639 days ago1733921446  Contract Creation0 APE

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DiamondLoupeFacet

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
paris EvmVersion
File 1 of 8 : DiamondLoupeFacet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

//Originally from https://github.com/mudgen/diamond-1
//******************************************************************************\
//* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)
//* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
//******************************************************************************/

// The functions in DiamondLoupeFacet MUST be added to a diamond.
// The EIP-2535 Diamond standard requires these functions.

import {IDiamondLoupe} from "./IDiamondLoupe.sol";
import {DiamondLoupeLib} from "./DiamondLoupeLib.sol";

contract DiamondLoupeFacet is IDiamondLoupe {
    // Diamond Loupe Functions
    ////////////////////////////////////////////////////////////////////
    /// These functions are expected to be called frequently by tools.
    //
    // struct Facet {
    //     address facetAddress;
    //     bytes4[] functionSelectors;
    // }
    /// @notice Gets all facets and their selectors.
    /// @return facets_ Facet
    function facets() external view override returns (Facet[] memory) {
        return DiamondLoupeLib.facets();
    }

    /// @notice Gets all the function selectors supported by a specific facet.
    /// @param _facet The facet address.
    /// @return _facetFunctionSelectors The selectors associated with a facet address.
    function facetFunctionSelectors(address _facet) external view override returns (bytes4[] memory) {
        return DiamondLoupeLib.facetFunctionSelectors(_facet);
    }

    /// @notice Get all the facet addresses used by a diamond.
    /// @return facetAddresses_
    function facetAddresses() external view override returns (address[] memory) {
        return DiamondLoupeLib.facetAddresses();
    }

    /// @notice Gets the facet address that supports the given selector.
    /// @dev If facet is not found return address(0).
    /// @param _functionSelector The function selector.
    /// @return facetAddress_ The facet address.
    function facetAddress(bytes4 _functionSelector) external view override returns (address) {
        return DiamondLoupeLib.facetAddress(_functionSelector);
    }
}

File 2 of 8 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) 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 FailedInnerCall();
        }
    }
}

File 3 of 8 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.20;

/**
 * @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 is the index of the value in the `values` array plus 1.
        // Position 0 is used to mean a value is not in the set.
        mapping(bytes32 value => uint256) _positions;
    }

    /**
     * @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._positions[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 cache the value's position to prevent multiple reads from the same storage slot
        uint256 position = set._positions[value];

        if (position != 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 valueIndex = position - 1;
            uint256 lastIndex = set._values.length - 1;

            if (valueIndex != lastIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

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

            // Delete the tracked position for the deleted slot
            delete set._positions[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._positions[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;
    }
}

File 4 of 8 : DiamondLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {EnumerableMapAddressToSetBytes4} from "../utils/structs/EnumerableMapAddressToSetBytes4.sol";

error FunctionNotFound(bytes4 _functionSelector);

library DiamondLib {
    bytes32 constant DIAMOND_STORAGE =
        keccak256(abi.encode(uint256(keccak256("diamond.standard.diamond.storage")) - 1)) & ~bytes32(uint256(0xff));

    /// @custom:storage-location erc7201:diamond.standard.diamond.storage
    struct DiamondStorage {
        EnumerableMapAddressToSetBytes4.AddressToSetBytes4Map facets;
        mapping(bytes4 selector => address) selectors;
    }

    function diamondStorage() internal pure returns (DiamondStorage storage ds) {
        bytes32 position = DIAMOND_STORAGE;
        assembly {
            ds.slot := position
        }
    }

    function _fallback(bytes calldata data) internal returns (bytes memory) {
        DiamondLib.DiamondStorage storage ds = DiamondLib.diamondStorage();
        bytes4 sig = bytes4(data[:4]);
        // get facet from function selector
        address facet = ds.selectors[sig];
        if (facet == address(0)) {
            revert FunctionNotFound(sig);
        }

        return Address.functionDelegateCall(facet, data);
    }
}

File 5 of 8 : DiamondLoupeLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

//Originally from https://github.com/mudgen/diamond-1
//******************************************************************************\
//* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)
//* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
//******************************************************************************/

/**
 * We updated the DiamondLoupeFacet to be a library that can then be used in DiamondLoupeFacet
 */

import {IDiamondLoupe} from "./IDiamondLoupe.sol";
import {DiamondLib} from "./DiamondLib.sol";
import {EnumerableMapAddressToSetBytes4} from "../utils/structs/EnumerableMapAddressToSetBytes4.sol";
import {EnumerableSetBytes4} from "../utils/structs/EnumerableSetBytes4.sol";

// The functions in DiamondLoupeFacet MUST be added to a diamond.
// The EIP-2535 Diamond standard requires these functions.

library DiamondLoupeLib {
    using EnumerableMapAddressToSetBytes4 for EnumerableMapAddressToSetBytes4.AddressToSetBytes4Map;
    using EnumerableSetBytes4 for EnumerableSetBytes4.Bytes4Set;

    // Diamond Loupe Functions
    ////////////////////////////////////////////////////////////////////
    /// These functions are expected to be called frequently by tools.
    //
    // struct Facet {
    //     address facetAddress;
    //     bytes4[] functionSelectors;
    // }
    /// @notice Gets all facets and their selectors.
    /// @return facets_ Facet
    function facets() internal view returns (IDiamondLoupe.Facet[] memory) {
        DiamondLib.DiamondStorage storage ds = DiamondLib.diamondStorage();
        address[] memory facetAddresses_ = ds.facets.keys();
        IDiamondLoupe.Facet[] memory facets_ = new IDiamondLoupe.Facet[](facetAddresses_.length);
        for (uint256 i; i < facetAddresses_.length; i++) {
            address facetAddress_ = facetAddresses_[i];
            facets_[i] = IDiamondLoupe.Facet(facetAddress_, ds.facets._values[facetAddress_].values());
        }

        return facets_;
    }

    /// @notice Gets all the function selectors supported by a specific facet.
    /// @param _facet The facet address.
    /// @return _facetFunctionSelectors The selectors associated with a facet address.
    function facetFunctionSelectors(address _facet) internal view returns (bytes4[] memory _facetFunctionSelectors) {
        DiamondLib.DiamondStorage storage ds = DiamondLib.diamondStorage();
        return ds.facets._values[_facet].values();
    }

    /// @notice Get all the facet addresses used by a diamond.
    /// @return facetAddresses_
    function facetAddresses() internal view returns (address[] memory) {
        DiamondLib.DiamondStorage storage ds = DiamondLib.diamondStorage();
        return ds.facets.keys();
    }

    /// @notice Gets the facet address that supports the given selector.
    /// @dev If facet is not found return address(0).
    /// @param _functionSelector The function selector.
    /// @return facetAddress_ The facet address.
    function facetAddress(bytes4 _functionSelector) internal view returns (address) {
        DiamondLib.DiamondStorage storage ds = DiamondLib.diamondStorage();
        return ds.selectors[_functionSelector];
    }
}

File 6 of 8 : IDiamondLoupe.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

//Originally from https://github.com/mudgen/diamond-1
//******************************************************************************\
//* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)
//* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
//******************************************************************************/

// A loupe is a small magnifying glass used to look at diamonds.
// These functions look at diamonds
interface IDiamondLoupe {
    /// These functions are expected to be called frequently
    /// by tools.

    struct Facet {
        address facetAddress;
        bytes4[] functionSelectors;
    }

    /// @notice Gets all facet addresses and their four byte function selectors.
    /// @return facets_ Facet
    function facets() external view returns (Facet[] memory facets_);

    /// @notice Gets all the function selectors supported by a specific facet.
    /// @param _facet The facet address.
    /// @return facetFunctionSelectors_
    function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);

    /// @notice Get all the facet addresses used by a diamond.
    /// @return facetAddresses_
    function facetAddresses() external view returns (address[] memory facetAddresses_);

    /// @notice Gets the facet that supports the given selector.
    /// @dev If facet is not found return address(0).
    /// @param _functionSelector The function selector.
    /// @return facetAddress_ The facet address.
    function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_);
}

File 7 of 8 : EnumerableMapAddressToSetBytes4.sol
// SPDX-License-Identifier: MIT
// Originally from
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableMap.sol)
pragma solidity ^0.8.20;

import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {EnumerableSetBytes4} from "./EnumerableSetBytes4.sol";

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps with sets as values 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.
 * - When all items of set are removed, key is removed.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMapAddressToSetBytes4 for EnumerableMapAddressToSetBytes4.AddressToSetBytes4Map;
 *
 *     // Declare a set state variable
 *     EnumerableMapAddressToSetBytes4.AddressToSetBytes4Map private myMap;
 * }
 * ```
 *
 * The following map types are supported:
 *
 * - `address -> Set<bytes4>` (`AddressToSetBytes4Map`)
 *
 * [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 EnumerableMapAddressToSetBytes4 {
    using EnumerableSet for EnumerableSet.AddressSet;
    using EnumerableSetBytes4 for EnumerableSetBytes4.Bytes4Set;

    // 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 `UintToAddressMap` are just wrappers around the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit in bytes32.

    /**
     * @dev Query for a nonexistent map key.
     */
    error EnumerableMapNonexistentKey(address key);

    struct AddressToSetBytes4Map {
        // Storage of keys
        EnumerableSet.AddressSet _keys;
        mapping(address key => EnumerableSetBytes4.Bytes4Set) _values;
    }

    /**
     * @dev Add a value to a set at `key`. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressToSetBytes4Map storage map, address key, bytes4 value) internal returns (bool) {
        //Add value to set
        bool added = map._values[key].add(value);

        if (added) {
            //Value was added, add key if non-existent
            map._keys.add(key);
        }

        return added;
    }

    /**
     * @dev Removes a value from a set at `key`. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was present.
     */
    function remove(AddressToSetBytes4Map storage map, address key, bytes4 value) internal returns (bool) {
        //Remove value from set
        bool removed = map._values[key].remove(value);
        if (removed) {
            //Value was removed, remove key if size zero
            if (map._values[key].length() == 0) {
                map._keys.remove(key);
            }
        }

        return removed;
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(AddressToSetBytes4Map storage map, address 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(AddressToSetBytes4Map 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(
        AddressToSetBytes4Map storage map,
        uint256 index
    ) internal view returns (address, EnumerableSetBytes4.Bytes4Set storage) {
        address 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(
        AddressToSetBytes4Map storage map,
        address key
    ) internal view returns (bool, EnumerableSetBytes4.Bytes4Set storage) {
        return (contains(map, key), map._values[key]);
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(
        AddressToSetBytes4Map storage map,
        address key
    ) internal view returns (EnumerableSetBytes4.Bytes4Set storage) {
        if (!contains(map, key)) {
            revert EnumerableMapNonexistentKey(key);
        }
        return map._values[key];
    }

    /**
     * @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(AddressToSetBytes4Map storage map) internal view returns (address[] memory) {
        return map._keys.values();
    }
}

File 8 of 8 : EnumerableSetBytes4.sol
// SPDX-License-Identifier: MIT
// Originally from
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)

/**
 * We look to adapt the original OpenZeppelin EnumerableBytes4Set for the `bytes4` type
 */

pragma solidity ^0.8.20;

/**
 * @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 EnumerableBytes4Set for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressBytes4Set internal mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes4` (`bytes4Set`), `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 EnumerableSetBytes4 {
    // We can only create new EnumerableSets for types that fit
    // in bytes4.

    struct Bytes4Set {
        // Storage of set values
        bytes4[] _values;
        // Position is the index of the value in the `values` array plus 1.
        // Position 0 is used to mean a value is not in the set.
        mapping(bytes4 value => uint256) _positions;
    }

    /**
     * @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(Bytes4Set storage set, bytes4 value) internal 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._positions[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(Bytes4Set storage set, bytes4 value) internal returns (bool) {
        // We cache the value's position to prevent multiple reads from the same storage slot
        uint256 position = set._positions[value];

        if (position != 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 valueIndex = position - 1;
            uint256 lastIndex = set._values.length - 1;

            if (valueIndex != lastIndex) {
                bytes4 lastValue = set._values[lastIndex];

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

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

            // Delete the tracked position for the deleted slot
            delete set._positions[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes4Set storage set, bytes4 value) internal view returns (bool) {
        return set._positions[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(Bytes4Set storage set) internal 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(Bytes4Set storage set, uint256 index) internal view returns (bytes4) {
        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(Bytes4Set storage set) internal view returns (bytes4[] memory) {
        return set._values;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"bytes4","name":"_functionSelector","type":"bytes4"}],"name":"facetAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"facetAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_facet","type":"address"}],"name":"facetFunctionSelectors","outputs":[{"internalType":"bytes4[]","name":"","type":"bytes4[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"facets","outputs":[{"components":[{"internalType":"address","name":"facetAddress","type":"address"},{"internalType":"bytes4[]","name":"functionSelectors","type":"bytes4[]"}],"internalType":"struct IDiamondLoupe.Facet[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"}]

6080806040523461001657610b44908161001c8239f35b600080fdfe604060808152600436101561001357600080fd5b60009060e08235811c90816352ef6b2c146108885781637a0ed62714610417578163adfca15e146100e6575063cdffacc61461004e57600080fd5b346100e25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100e2576004357fffffffff0000000000000000000000000000000000000000000000000000000081168091036100de578160209373ffffffffffffffffffffffffffffffffffffffff9260036100ce610a5b565b0190825285522054169051908152f35b8280fd5b5080fd5b919050346100de57602091827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104135760043573ffffffffffffffffffffffffffffffffffffffff811680910361040f576002610148959295610a5b565b0190825283528282822083519586879484845492838152019381528481205b82600783011061037d57918593916101cc966101db999896945493838310610348575b50828210610313575b8282106102de575b8282106102a9575b828210610274575b828210610240575b82821061020c575b50106101df575b50905003856109bf565b5192828493845283019061091e565b0390f35b7fffffffff00000000000000000000000000000000000000000000000000000000168152018590386101c2565b600191947fffffffff0000000000000000000000000000000000000000000000000000000085831b168152019301846101bb565b600191947fffffffff00000000000000000000000000000000000000000000000000000000858b1b168152019301846101b3565b600191947fffffffff000000000000000000000000000000000000000000000000000000008560601b168152019301846101ab565b600191947fffffffff000000000000000000000000000000000000000000000000000000008560801b168152019301846101a3565b600191947fffffffff000000000000000000000000000000000000000000000000000000008560a01b1681520193018461019b565b600191947fffffffff000000000000000000000000000000000000000000000000000000008560c01b16815201930184610193565b947fffffffff0000000000000000000000000000000000000000000000000000000085600194971b168152019301843861018a565b9550919361010060089294866001938a8a54928380937fffffffff00000000000000000000000000000000000000000000000000000000809681941b16875260c0938383861b1682890152838360a0928282851b16818c01528a83836060608093818484871b169101521b16908c01521b16908801521b16908401521687820152019501910191879492879492610167565b8480fd5b8380fd5b839150346100e257817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100e25790610451610a5b565b9061045b82610abb565b9283519461048061046b87610a00565b96610478835198896109bf565b808852610a00565b917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe060209301845b8181106108605750506002849501945b86518110156107bd578073ffffffffffffffffffffffffffffffffffffffff6104e286938a610a18565b5116808752878352848720855190818582549182815201918a52858a20908a915b81600784011061072e5792849260019892610568955491848c8383106106fa575b508282106106c6575b828210610692575b82821061065e575b82821061062a575b8d8383106105f6575b508282106105c3575b5010610596575b50905003826109bf565b85519161057483610974565b825286820152610584828b610a18565b5261058f818a610a18565b50016104b8565b7fffffffff000000000000000000000000000000000000000000000000000000001681520189908f61055e565b8b91947fffffffff0000000000000000000000000000000000000000000000000000000085831b16815201930184610557565b947fffffffff00000000000000000000000000000000000000000000000000000000858e94971b168152019301848d61054e565b8b91947fffffffff000000000000000000000000000000000000000000000000000000008560601b16815201930184610545565b8b91947fffffffff000000000000000000000000000000000000000000000000000000008560801b1681520193018461053d565b8b91947fffffffff000000000000000000000000000000000000000000000000000000008560a01b16815201930184610535565b8b91947fffffffff000000000000000000000000000000000000000000000000000000008560c01b1681520193018461052d565b947fffffffff00000000000000000000000000000000000000000000000000000000858e94971b168152019301848c610524565b80547fffffffff00000000000000000000000000000000000000000000000000000000818b1b8116865260c082811b82168b88015260a083811b83168e890152608084811b84166060808b019190915285901b841690890152838e1b8316908801529982901b811699860199909952979097168389015289966101009093019260089290920191600101610503565b8284898783519280840190808552835180925285850181878460051b880101950193965b8388106107ee5786860387f35b9091929394838061084f837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08b6001960301875285838b5173ffffffffffffffffffffffffffffffffffffffff81511684520151918185820152019061091e565b9701930197019690939291936107e1565b8490849897985161087081610974565b87815260608382015282828c010152019695966104a8565b5050346100e257817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100e2576108c86108c3610a5b565b610abb565b815192839260208080860192818752855180945286019401925b8281106108f157505050500390f35b835173ffffffffffffffffffffffffffffffffffffffff16855286955093810193928101926001016108e2565b90815180825260208080930193019160005b82811061093e575050505090565b83517fffffffff000000000000000000000000000000000000000000000000000000001685529381019392810192600101610930565b6040810190811067ffffffffffffffff82111761099057604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761099057604052565b67ffffffffffffffff81116109905760051b60200190565b8051821015610a2c5760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0060405160208101907fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131b825260208152610ab481610974565b5190201690565b90604051918281549182825260209260208301916000526020600020936000905b828210610af457505050610af2925003836109bf565b565b855484526001958601958895509381019390910190610adc56fea2646970667358221220cf201be07fea7e2ebe237ec334bbb68755341ac472846034c2ca8dc67627236264736f6c63430008170033

Deployed Bytecode

0x604060808152600436101561001357600080fd5b60009060e08235811c90816352ef6b2c146108885781637a0ed62714610417578163adfca15e146100e6575063cdffacc61461004e57600080fd5b346100e25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100e2576004357fffffffff0000000000000000000000000000000000000000000000000000000081168091036100de578160209373ffffffffffffffffffffffffffffffffffffffff9260036100ce610a5b565b0190825285522054169051908152f35b8280fd5b5080fd5b919050346100de57602091827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104135760043573ffffffffffffffffffffffffffffffffffffffff811680910361040f576002610148959295610a5b565b0190825283528282822083519586879484845492838152019381528481205b82600783011061037d57918593916101cc966101db999896945493838310610348575b50828210610313575b8282106102de575b8282106102a9575b828210610274575b828210610240575b82821061020c575b50106101df575b50905003856109bf565b5192828493845283019061091e565b0390f35b7fffffffff00000000000000000000000000000000000000000000000000000000168152018590386101c2565b600191947fffffffff0000000000000000000000000000000000000000000000000000000085831b168152019301846101bb565b600191947fffffffff00000000000000000000000000000000000000000000000000000000858b1b168152019301846101b3565b600191947fffffffff000000000000000000000000000000000000000000000000000000008560601b168152019301846101ab565b600191947fffffffff000000000000000000000000000000000000000000000000000000008560801b168152019301846101a3565b600191947fffffffff000000000000000000000000000000000000000000000000000000008560a01b1681520193018461019b565b600191947fffffffff000000000000000000000000000000000000000000000000000000008560c01b16815201930184610193565b947fffffffff0000000000000000000000000000000000000000000000000000000085600194971b168152019301843861018a565b9550919361010060089294866001938a8a54928380937fffffffff00000000000000000000000000000000000000000000000000000000809681941b16875260c0938383861b1682890152838360a0928282851b16818c01528a83836060608093818484871b169101521b16908c01521b16908801521b16908401521687820152019501910191879492879492610167565b8480fd5b8380fd5b839150346100e257817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100e25790610451610a5b565b9061045b82610abb565b9283519461048061046b87610a00565b96610478835198896109bf565b808852610a00565b917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe060209301845b8181106108605750506002849501945b86518110156107bd578073ffffffffffffffffffffffffffffffffffffffff6104e286938a610a18565b5116808752878352848720855190818582549182815201918a52858a20908a915b81600784011061072e5792849260019892610568955491848c8383106106fa575b508282106106c6575b828210610692575b82821061065e575b82821061062a575b8d8383106105f6575b508282106105c3575b5010610596575b50905003826109bf565b85519161057483610974565b825286820152610584828b610a18565b5261058f818a610a18565b50016104b8565b7fffffffff000000000000000000000000000000000000000000000000000000001681520189908f61055e565b8b91947fffffffff0000000000000000000000000000000000000000000000000000000085831b16815201930184610557565b947fffffffff00000000000000000000000000000000000000000000000000000000858e94971b168152019301848d61054e565b8b91947fffffffff000000000000000000000000000000000000000000000000000000008560601b16815201930184610545565b8b91947fffffffff000000000000000000000000000000000000000000000000000000008560801b1681520193018461053d565b8b91947fffffffff000000000000000000000000000000000000000000000000000000008560a01b16815201930184610535565b8b91947fffffffff000000000000000000000000000000000000000000000000000000008560c01b1681520193018461052d565b947fffffffff00000000000000000000000000000000000000000000000000000000858e94971b168152019301848c610524565b80547fffffffff00000000000000000000000000000000000000000000000000000000818b1b8116865260c082811b82168b88015260a083811b83168e890152608084811b84166060808b019190915285901b841690890152838e1b8316908801529982901b811699860199909952979097168389015289966101009093019260089290920191600101610503565b8284898783519280840190808552835180925285850181878460051b880101950193965b8388106107ee5786860387f35b9091929394838061084f837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08b6001960301875285838b5173ffffffffffffffffffffffffffffffffffffffff81511684520151918185820152019061091e565b9701930197019690939291936107e1565b8490849897985161087081610974565b87815260608382015282828c010152019695966104a8565b5050346100e257817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100e2576108c86108c3610a5b565b610abb565b815192839260208080860192818752855180945286019401925b8281106108f157505050500390f35b835173ffffffffffffffffffffffffffffffffffffffff16855286955093810193928101926001016108e2565b90815180825260208080930193019160005b82811061093e575050505090565b83517fffffffff000000000000000000000000000000000000000000000000000000001685529381019392810192600101610930565b6040810190811067ffffffffffffffff82111761099057604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761099057604052565b67ffffffffffffffff81116109905760051b60200190565b8051821015610a2c5760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0060405160208101907fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131b825260208152610ab481610974565b5190201690565b90604051918281549182825260209260208301916000526020600020936000905b828210610af457505050610af2925003836109bf565b565b855484526001958601958895509381019390910190610adc56fea2646970667358221220cf201be07fea7e2ebe237ec334bbb68755341ac472846034c2ca8dc67627236264736f6c63430008170033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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