Sepolia Testnet

Contract

0xFD3b97B44339CDF598dead91F07c4c2DF2514B4e
Source Code Source Code

Overview

ETH Balance

0 ETH

More Info

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Amount

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Method Block
From
To
Amount
0x6080604083324932025-05-15 14:22:24263 days ago1747318944  Contract Creation0 ETH
Loading...
Loading
Loading...
Loading

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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

Contract Name:
SingleStateNonFundedFacet

Compiler Version
v0.8.27+commit.40a35a09

Optimization Enabled:
Yes with 1000 runs

Other Settings:
cancun EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

import {AccessControlFacetStorage} from "../../../genericFacets/accessControlFacet/AccessControlFacetStorage.sol";
import {SingleStateNonFundedFacetStorage} from "./SingleStateNonFundedFacetStorage.sol";
import {DelegateCallee} from "../../../helpers/DelegateCallee.sol";
import {ERC2771RecipientStorage} from "../../../helpers/erc2771Facet/ERC2771RecipientStorage.sol";
import {ERC2771RecipientHelperLib} from "../../../helpers/erc2771Facet/ERC2771RecipientHelperLib.sol";
import {INonFundedStateFacet} from "../../../interfaces/subSkeletonInterfaces/nonFundedPhaseInterfaces/INonFundedStateFacet.sol";

/**
 * @notice SingleStateNonFundedFacet
 */
contract SingleStateNonFundedFacet is INonFundedStateFacet, DelegateCallee {
    using AccessControlFacetStorage for AccessControlFacetStorage.Layout;
    using SingleStateNonFundedFacetStorage for SingleStateNonFundedFacetStorage.Layout;
    using ERC2771RecipientStorage for ERC2771RecipientStorage.Layout;
    using ERC2771RecipientHelperLib for ERC2771RecipientStorage.Layout;

    event NonFundedStateInitialized(uint256 nonFundedState);

    /// @notice Thrown when trying to initialize from non admin account.
    error UnauthorizedInitialization(address account);

    function initNonFundedStateFacet(bytes calldata initNonFundedStateData) external onlyExternalDelegateCall {
        address account = ERC2771RecipientStorage.layout()._msgSender();
        if (!AccessControlFacetStorage.layout().hasRole(AccessControlFacetStorage.ADMIN_ROLE, account)) {
            revert UnauthorizedInitialization(account);
        }

        uint256 nonFundedState_ = SingleStateNonFundedFacetStorage.layout().initNonFundedStateFacet(initNonFundedStateData);

        emit NonFundedStateInitialized(nonFundedState_);
    }

    function checkNonFundedState(uint256 campaignId) external view onlyInternalDelegateCall {
        SingleStateNonFundedFacetStorage.layout().checkNonFundedState(campaignId);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.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;

        assembly ("memory-safe") {
            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;

        assembly ("memory-safe") {
            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;

        assembly ("memory-safe") {
            result := store
        }

        return result;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {ERC2771RecipientStorage} from "../../helpers/erc2771Facet/ERC2771RecipientStorage.sol";
import {ERC2771RecipientHelperLib} from "../../helpers/erc2771Facet/ERC2771RecipientHelperLib.sol";

/**
 * @title AccessControlFacetStorage
 * @author Evergonlabs
 * @notice Library that contains storage and functionality associated with AccessControlFacet.
 */
library AccessControlFacetStorage {
    using EnumerableSet for EnumerableSet.Bytes32Set;
    using EnumerableSet for EnumerableSet.AddressSet;
    using ERC2771RecipientStorage for ERC2771RecipientStorage.Layout;
    using ERC2771RecipientHelperLib for ERC2771RecipientStorage.Layout;

    /* =================================================== ERRORS ================================================== */
    /// @notice Thrown when attempting to re-initialize.
    error AlreadyInitialized();

    /// @notice Thrown when attempting to handle (grant or revoke) a default role (either `OPEN_ROLE` or `ADMIN_ROLE`).
    error RestrictedDefaultRole(bytes32 role);

    /// @notice Thrown when an account attempts to handle (grant or revoke) a role it is not permitted to manage.
    error UnauthorizedRoleHandling(address account, bytes32 role);

    /// @notice Thrown when an account attempts an action without the required role.
    error AccountMissingRole(address account, bytes32 role);

    /// @notice Thrown when attempting to assign the zero address as the admin.
    error InvalidZeroAddressForAdmin();

    /// @notice Thrown when a campaignId of 0 is provided, which is invalid for campaign-scoped role checks.
    error InvalidCampaignIdZero();

    /// @notice Thrown when no accounts provided for role granting.
    error ZeroAccountsToGrant();

    /// @notice Thrown when no accounts provided for role revocation.
    error ZeroAccountsToRevoke();

    /// @notice Thrown when an attempt is made to handle `ADMIN_ROLE`.
    error CannotHandleAdminRole();

    /** ================================================== STORAGE =================================================
     * @dev Unique identifier for the storage slot where the Layout struct is stored. Derived from the ERC7201 formula.
     * STORAGE_SLOT: 0xf38f18dbf28c638dc6bd2b4f1f6d9a444471db909c2346c79451042d2b750100
     */
    bytes32 internal constant STORAGE_SLOT =
        keccak256(abi.encode(uint256(keccak256("Evergonlabs.Tmi-Tokenizer.storage.AccessControlFacetStorage")) - 1)) &
            ~bytes32(uint256(0xff));
    bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
    bytes32 public constant OPEN_ROLE = keccak256("OPEN_ROLE"); // Every user has this role

    struct Layout {
        bool isInitialized;
        // The roles granted to `account`
        mapping(address account => EnumerableSet.Bytes32Set roles) userRoles;
        // The accounts with `role`
        mapping(bytes32 role => EnumerableSet.AddressSet accounts) usersWithRole;
        // The roles granted to account for ID
        mapping(uint256 campaignId => mapping(address account => EnumerableSet.Bytes32Set roles)) userRolesForId;
        // // The accounts with `role` for ID
        mapping(uint256 campaignId => mapping(bytes32 role => EnumerableSet.AddressSet accounts)) usersWithRoleForId;
        // The roles that are handled by account
        mapping(address account => EnumerableSet.Bytes32Set) userHandledRoles;
    }

    /* ================================================= MODIFIERS ================================================= */
    /**
     * @notice Restricts function execution to designated role handlers for a specified role.
     *
     * @dev Checks that the specified role is not `OPEN_ROLE` or `ADMIN_ROLE`, and verifies whether
     * the caller is authorized to handle the specified role.
     * If the caller is neither a designated role handler nor the Admin, the function reverts.
     *
     * @param role The identifier of the role for which the caller must be a designated handler.
     */
    modifier onlyRoleHandler(bytes32 role) {
        address account = ERC2771RecipientStorage.layout()._msgSender();
        if (role == OPEN_ROLE || role == ADMIN_ROLE) revert RestrictedDefaultRole(role);

        if (!(layout().userHandledRoles[account].contains(role) || layout().userRoles[account].contains(ADMIN_ROLE))) {
            revert UnauthorizedRoleHandling(account, role);
        }
        _;
    }

    /**
     * @notice Rrestricts function execution to accounts with the specified role.
     *
     * @dev Checks whether the caller has the specified role, else it reverts.
     * If the specified role is the `OPEN_ROLE` then function proceeds with the execution.
     *
     * @param role The identifier of the role that the caller must hold to proceed.
     */
    modifier onlyRole(bytes32 role) {
        address account = ERC2771RecipientStorage.layout()._msgSender();
        if (!(role == OPEN_ROLE || layout().userRoles[account].contains(role))) {
            revert AccountMissingRole(account, role);
        }
        _;
    }

    /* =================================================== LAYOUT ================================================== */
    /**
     * @dev Retrieves a reference to the Layout struct stored at a specified storage slot
     */
    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly ("memory-safe") {
            l.slot := slot
        }
    }

    /* ================================================= INITIALIZER =============================================== */
    /**
     * @notice Initializes the `AccessControlFacetStorage` by setting the Admin of the tmi-fractions platform.
     * @dev `admin` cannot be address(0).
     * @param l A reference to the Layout struct in storage.
     * @param account The address to be the designated Admin of the platform, responsible for managing permissions.
     */
    function initAccessControlFacet(Layout storage l, address account) internal {
        if (l.isInitialized) revert AlreadyInitialized();
        if (account == address(0)) revert InvalidZeroAddressForAdmin();

        l.isInitialized = true;

        l.userRoles[account].add(ADMIN_ROLE);
        l.usersWithRole[ADMIN_ROLE].add(account);
    }

    /* =================================================== QUERIES ================================================= */
    /**
     * @notice Checks whether a specific account holds a specified role within the tmi-fractions platform.
     * @dev This function verifies role-based permissions within a platform-scoped context.
     * @param l A reference to the Layout struct in storage.
     * @param role The role identifier to check.
     * @param account The address to verify for the specified role.
     * @return `true` if `account` holds `role`; `false` otherwise.
     */
    function hasRole(Layout storage l, bytes32 role, address account) internal view returns (bool) {
        return (role == OPEN_ROLE || l.userRoles[account].contains(role));
    }

    /**
     * @notice Checks whether a specific account holds a specified role within a given campaign.
     * @dev This function verifies role-based permissions within a campaign-scoped context.
     * @param l A reference to the Layout struct in storage.
     * @param campaignId The unique identifier of the targeted campaign.
     * @param role The role identifier to check.
     * @param account The address to verify for the specified role in the given campaign.
     * @return `true` if `account` holds `role` within `campaignId`; `false` otherwise.
     */
    function hasRoleForId(Layout storage l, uint256 campaignId, bytes32 role, address account) internal view returns (bool) {
        return (role == OPEN_ROLE || l.userRolesForId[campaignId][account].contains(role));
    }

    /**
     * @notice Returns all the roles that a specified account holds within a platform-scoped context.
     * @param l A reference to the Layout struct in storage.
     * @param account The address to query for platform-scoped roles.
     * @return An array of all the platform-scoped roles that `account` holds.
     */
    function getRolesOf(Layout storage l, address account) internal view returns (bytes32[] memory) {
        return l.userRoles[account].values();
    }

    /**
     * @notice Returns all the accounts that hold the specified role within a platform-scoped context.
     * @param l A reference to the Layout struct in storage.
     * @param role The role to check for.
     * @return An array of all the accounts that hold the specified role.
     */
    function getAccountsWithRole(Layout storage l, bytes32 role) internal view returns (address[] memory) {
        return l.usersWithRole[role].values();
    }

    /**
     * @notice Returns all the roles that a specified account holds within a campaign-scoped context.
     * @param l A reference to the Layout struct in storage.
     * @param campaignId The unique identifier of the targeted campaign.
     * @param account The address to query for the targeted campaign-scoped roles.
     * @return An array of all the roles held by `account` within `campaignId`.
     */
    function getRolesOfAccountForId(Layout storage l, uint256 campaignId, address account) internal view returns (bytes32[] memory) {
        return l.userRolesForId[campaignId][account].values();
    }

    /**
     * @notice Returns all the accounts that hold a specified role within a given campaign.
     * @param l A reference to the Layout struct in storage.
     * @param campaignId The unique identifier of the targeted campaign.
     * @param role The role to check for.
     * @return An array of all the accounts that hold the specified role within `campaignId`.
     */
    function getAccountsWithRoleForId(Layout storage l, uint256 campaignId, bytes32 role) internal view returns (address[] memory) {
        return l.usersWithRoleForId[campaignId][role].values();
    }

    /**
     * @notice Returns all the roles that a specified account is a role handler for.
     * @dev A role handler manages its role both in a platform-scoped and campaign-scoped context.
     * @param l A reference to the Layout struct in storage.
     * @param account The account to check.
     * @return An array of all the roles that `account` is a role handler for.
     */
    function getHandledRolesOf(Layout storage l, address account) internal view returns (bytes32[] memory) {
        return l.userHandledRoles[account].values();
    }

    /* =================================================== GRANTING ================================================ */
    /**
     * @notice Grants `role` to `account` within a platform-scoped context.
     * @dev Only callable by the Admin or a handler of `role`.
     * @param l A reference to the Layout struct in storage.
     * @param role The identifier of the role to grant.
     * @param account The address to which `role` is granted.
     */
    function grantRole(Layout storage l, bytes32 role, address account) internal onlyRoleHandler(role) {
        l.userRoles[account].add(role);
        l.usersWithRole[role].add(account);
    }

    /**
     * @notice Grants `role` to `account` within a campaign-scoped context.
     * @dev Only callable by the Admin or a handler of `role`.
     * @param l A reference to the Layout struct in storage.
     * @param campaignId The unique identifier of the targeted campaign.
     * @param role The identifier of the role to grant.
     * @param account The address to which `role` is granted.
     */
    function grantRoleForId(Layout storage l, uint256 campaignId, bytes32 role, address account) internal onlyRoleHandler(role) {
        l.userRolesForId[campaignId][account].add(role);
        l.usersWithRoleForId[campaignId][role].add(account);
    }

    /**
     * @notice Grants `role` to multiple `accounts` within a platform-scoped context.
     * @dev Only callable by the Admin or a handler of `role`.
     * @param l A reference to the Layout struct in storage.
     * @param role The identifier of the role to grant.
     * @param accounts An array of addresses to which `role` is granted.
     */
    function grantRoleMultiple(Layout storage l, bytes32 role, address[] calldata accounts) internal onlyRoleHandler(role) {
        uint256 length = accounts.length;

        if (length == 0) revert ZeroAccountsToGrant();

        EnumerableSet.AddressSet storage usersWithRole = l.usersWithRole[role];

        for (uint256 i = 0; i < length; ) {
            l.userRoles[accounts[i]].add(role);
            usersWithRole.add(accounts[i]);

            unchecked {
                i += 1;
            }
        }
    }

    /**
     * @notice Grants `role` to multiple `accounts` within a campaign-scoped context.
     * @dev Only callable by the Admin or a handler of `role`.
     * @param l A reference to the Layout struct in storage.
     * @param campaignId The unique identifier of the targeted campaign.
     * @param role The identifier of the role to grant.
     * @param accounts An array of addresses to which `role` is granted.
     */
    function grantRoleMultipleForId(
        Layout storage l,
        uint256 campaignId,
        bytes32 role,
        address[] calldata accounts
    ) internal onlyRoleHandler(role) {
        if (campaignId == 0) revert InvalidCampaignIdZero();

        uint256 length = accounts.length;

        if (length == 0) revert ZeroAccountsToGrant();

        mapping(address => EnumerableSet.Bytes32Set) storage userRolesForId = l.userRolesForId[campaignId];
        EnumerableSet.AddressSet storage usersWithRoleForId = l.usersWithRoleForId[campaignId][role];

        for (uint256 i = 0; i < length; ) {
            userRolesForId[accounts[i]].add(role);
            usersWithRoleForId.add(accounts[i]);

            unchecked {
                i += 1;
            }
        }
    }

    /* =================================================== REVOKING ================================================ */
    /**
     * @notice Revokes `role` from `account` within a platform-scoped context.
     * @dev Only callable by the Admin or a handler of `role`.
     * @param l A reference to the Layout struct in storage.
     * @param role The identifier of the role to revoke.
     * @param account The address from which `role` is revoked.
     */
    function revokeRole(Layout storage l, bytes32 role, address account) internal onlyRoleHandler(role) {
        l.userRoles[account].remove(role);
        l.usersWithRole[role].remove(account);
    }

    /**
     * @notice Revokes `role` from `account` within a campaign-scoped context.
     * @dev Only callable by the Admin or a handler of `role`.
     * @param l A reference to the Layout struct in storage.
     * @param campaignId The unique identifier of the targeted campaign.
     * @param role The identifier of the role to revoke.
     * @param account The address from which `role` is revoked.
     */
    function revokeRoleForId(Layout storage l, uint256 campaignId, bytes32 role, address account) internal onlyRoleHandler(role) {
        if (campaignId == 0) revert InvalidCampaignIdZero();

        l.userRolesForId[campaignId][account].remove(role);
        l.usersWithRoleForId[campaignId][role].remove(account);
    }

    /**
     * @notice Revokes `role` from multiple `accounts` within a platform-scoped context.
     * @dev Only callable by the Admin or a handler of `role`.
     * @param l A reference to the Layout struct in storage.
     * @param role The identifier of the role to revoke.
     * @param accounts An array of addresses from which `role` is revoked.
     */
    function revokeRoleMultiple(Layout storage l, bytes32 role, address[] calldata accounts) internal onlyRoleHandler(role) {
        uint256 length = accounts.length;

        if (length == 0) revert ZeroAccountsToRevoke();

        EnumerableSet.AddressSet storage usersWithRole = l.usersWithRole[role];

        for (uint256 i = 0; i < length; ) {
            l.userRoles[accounts[i]].remove(role);
            usersWithRole.remove(accounts[i]);

            unchecked {
                i += 1;
            }
        }
    }

    /**
     * @notice Revokes `role` from multiple `accounts` within a campaign-scoped context.
     * @dev Only callable by the Admin or a handler of `role`.
     * @param l A reference to the Layout struct in storage.
     * @param campaignId The unique identifier of the targeted campaign.
     * @param role The identifier of the role to revoke.
     * @param accounts An array of addresses from which `role` is revoked.
     */
    function revokeRoleMultipleForId(
        Layout storage l,
        uint256 campaignId,
        bytes32 role,
        address[] calldata accounts
    ) internal onlyRoleHandler(role) {
        if (campaignId == 0) revert InvalidCampaignIdZero();

        uint256 length = accounts.length;

        if (length == 0) revert ZeroAccountsToRevoke();

        mapping(address => EnumerableSet.Bytes32Set) storage userRolesForId = l.userRolesForId[campaignId];
        EnumerableSet.AddressSet storage usersWithRoleForId = l.usersWithRoleForId[campaignId][role];

        for (uint256 i = 0; i < length; ) {
            userRolesForId[accounts[i]].remove(role);
            usersWithRoleForId.remove(accounts[i]);

            unchecked {
                i += 1;
            }
        }
    }

    /* ================================================ ROLE HANDLING ============================================== */
    /**
     * @notice Delegates the handling of `role` to the specified account, allowing `account` to manage
     * the granting and revocation of this role.
     *
     * @dev Only callable by the Admin.
     *
     * Designated role handlers can manage the associated roles both at the platform level (platform-scoped context)
     * and within individual campaigns (campaign-scoped context).
     *
     * @param l A reference to the Layout struct in storage.
     * @param role The identifier of the role to delegate handling for.
     * @param account The address to be designated as a role handler for `role`.
     */
    function addRoleHandler(Layout storage l, bytes32 role, address account) internal onlyRole(ADMIN_ROLE) {
        if (role == ADMIN_ROLE) revert CannotHandleAdminRole();

        l.userHandledRoles[account].add(role);
    }

    /**
     * @notice Revokes `role` handling privileges from the specified account, preventing `account` from managing
     * the granting and revocation of this role.
     * @dev Only callable by the Admin.
     * @param l A reference to the Layout struct in storage.
     * @param role The identifier of the role to revoke handling for.
     * @param account The address to be removed as a role handler for `role`.
     */
    function removeRoleHandler(Layout storage l, bytes32 role, address account) internal onlyRole(ADMIN_ROLE) {
        l.userHandledRoles[account].remove(role);
    }

    /* ================================================ CHANGE ADMIN =============================================== */
    /**
     * @notice Replaces the current Admin with a new Admin.
     * @dev Only callable by the (current) Admin.
     * In this version, only one Admin is supported per platform.
     * @param l A reference to the Layout struct in storage.
     * @param account The address of the new Admin.
     */
    function changeAdmin(Layout storage l, address account) internal onlyRole(ADMIN_ROLE) {
        address caller = ERC2771RecipientStorage.layout()._msgSender();

        if (account == address(0)) revert InvalidZeroAddressForAdmin();

        l.userRoles[caller].remove(ADMIN_ROLE);
        l.usersWithRole[ADMIN_ROLE].remove(caller);
        l.userRoles[account].add(ADMIN_ROLE);
        l.usersWithRole[ADMIN_ROLE].add(account);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

/**
 * @title StateFacetStorage
 * @author Evergonlabs
 * @notice This library manages the storage and logic for `StateFacet` which acts as a programmable state machine,
 * enabling state transitions within campaigns and triggering specific functions (hooks) based on a defined schema.
 *
 * @dev The campaign states configuration follows a schema where each state has an associated set of states representing
 * the allowed state transitions. Platform facet functions can be designated as either `beforeHooks` or `afterHooks` via
 * their respective function selectors. Each state can have multiple `beforeHooks` and/or `afterHooks` assigned.
 *
 * A state's `beforeHooks` are triggered sequentially when the state is reached from another one. A state's `afterHooks`
 * are triggered sequentially when there is a departure from this state to another.
 *
 * IMPORTANT:
 *  - States are represented internally as `uint256` starting from `0`.
 *  - State `0` is the default state (i.e., campaign does not exist) for any campaign within the platform.
 *  - State `1` is always exclusively reached after the createFractions call (see `CreateFractionsSkeleton.sol`).
 *  - The remaining states (however many they are) are not predefined and can be configured according to the platform's needs.
 */
library StateFacetStorage {
    /* ========================================================== ERRORS =========================================================== */
    /// @notice Thrown when attempting to re-initialize.
    error AlreadyInitialized();
    /// @notice Thrown when input lengths are wrong.
    error InvalidInputLength();
    /// @notice Thrown when changing state and input `fromState` is not the current state.
    error FromStateNotCurrent(uint256 fromState, uint256 currentState);
    /// @notice Thrown when changing state and input `toState` is exceeding the supported state limit.
    error StateExceedsSupportedLimit(uint256 toState, uint256 supportedLimit);
    /// @notice Thrown when changing state and the transition from `fromState` to `toState` is not supported.
    error StateTransitionNotSupported(uint256 fromState, uint256 toState);

    /* =========================================================== LAYOUT ========================================================== */

    /**
     * @dev Unique identifier for the storage slot where the Layout struct is stored. Derived from the ERC7201 formula.
     * STORAGE_SLOT: 0x0da254b06dbae1b11b421a1ec8b60c0a4a6868be607c6d907d78edc499952400
     */
    bytes32 internal constant STORAGE_SLOT =
        keccak256(abi.encode(uint256(keccak256("Evergonlabs.Tmi-Tokenizer.storage.StateFacetStorage")) - 1)) & ~bytes32(uint256(0xff));

    struct Layout {
        // True if initialized, false otherwise.
        bool isInitialized;
        // The total states supported. (State IDs must be strictly less than `totalStatesSupported` value)
        uint256 totalStatesSupported;
        // Maps a campaign ID to its current state.
        mapping(uint256 campaignId => uint256 state) stateOfId;
        // Stores state hook information for each state.
        mapping(uint256 state => StateHooks) stateHooksInfo;
    }

    struct StateHooks {
        // Function selectors executed when the associated state is entered.
        bytes4[] beforeSelectors;
        // Function selectors executed when the associated state is exited.
        bytes4[] afterSelectors;
        // Indicates whether a transition from the associated state to `toState` is supported.
        mapping(uint256 toState => bool) isStateTransitionSupported;
    }

    /**
     * @dev Retrieves a reference to the Layout struct stored at a specified storage slot
     */
    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly ("memory-safe") {
            l.slot := slot
        }
    }

    /* ======================================================== INITIALIZER ======================================================== */

    /**
     * @notice Initializes the `StateFacetStorage` by setting the schema for state transitions and their respective hooks.
     * @param l A reference to the Layout struct in storage.
     * @param initStateData.stateCount: Total number of states supported (e.g., For States: 0,1,2  --> stateCount == 3).
     * @param initStateData.beforeHooks: Before hooks for each state (beforeHooks[i]: Array of before Hooks selectors for state `i`) .
     * @param initStateData.afterHooks: After hooks for each state (afterHooks[i]: Array of after Hooks selectors for state `i`).
     * @param initStateData.transitionsSupported: A matrix where each row represents a state, and each row contains an array
     *                                            of supported states that it can transition to.
     */
    function initStateFacet(Layout storage l, bytes memory initStateData) internal {
        if (l.isInitialized) revert AlreadyInitialized();

        l.isInitialized = true;

        (uint256 stateCount, bytes4[][] memory beforeHooks, bytes4[][] memory afterHooks, uint256[][] memory transitionsSupported) = abi
            .decode(initStateData, (uint256, bytes4[][], bytes4[][], uint256[][]));

        if (!(stateCount == beforeHooks.length && stateCount == afterHooks.length && stateCount == transitionsSupported.length)) {
            revert InvalidInputLength();
        }

        // Set the total states supported
        l.totalStatesSupported = stateCount;

        // Loop through each state
        for (uint256 i; i < stateCount; ) {
            // Get the hooks for state `i`
            StateHooks storage stateHook = l.stateHooksInfo[i];

            // Add beforeHooks for state `i` (if any)
            uint256 beforeHookCounter = beforeHooks[i].length;
            if (beforeHookCounter > 0) {
                for (uint256 j; j < beforeHookCounter; ) {
                    stateHook.beforeSelectors.push(beforeHooks[i][j]);

                    unchecked {
                        j += 1;
                    }
                }
            }

            // Add afterHooks for state `i` (if any)
            uint256 afterHookCounter = afterHooks[i].length;
            if (afterHookCounter > 0) {
                for (uint256 j; j < afterHookCounter; ) {
                    stateHook.afterSelectors.push(afterHooks[i][j]);

                    unchecked {
                        j += 1;
                    }
                }
            }

            // Set supported transitions for state `i` (if any)
            uint256 transitionsSupportedLength = transitionsSupported[i].length;
            if (transitionsSupportedLength > 0) {
                for (uint256 j; j < transitionsSupportedLength; ) {
                    stateHook.isStateTransitionSupported[transitionsSupported[i][j]] = true;

                    unchecked {
                        j += 1;
                    }
                }
            }

            unchecked {
                i += 1;
            }
        }
    }

    /* ==================================================== STATE TRANSITIONS ====================================================== */

    /**
     * @notice Changes the specified campaign's state from `fromState` to `toState`.
     * @dev Can only be called internally by the diamond proxy itself (i.e., from other facets).
     * The campaign's current state must be `fromState`, and `toState` must be a valid transition from the current state;
     * otherwise, the function reverts.
     * @param l A reference to the Layout struct in storage.
     * @param campaignId The unique identifier of the targeted campaign.
     * @param fromState The state to depart from (should be current state).
     * @param toState The destination state (the new state to settle).
     */
    function changeState(Layout storage l, uint256 campaignId, uint256 fromState, uint256 toState) internal {
        if (l.stateOfId[campaignId] != fromState) revert FromStateNotCurrent(fromState, l.stateOfId[campaignId]);
        if (toState >= l.totalStatesSupported) revert StateExceedsSupportedLimit(toState, l.totalStatesSupported);

        StateHooks storage stateHooksInfoFrom = l.stateHooksInfo[fromState];
        StateHooks storage stateHooksInfoTo = l.stateHooksInfo[toState];

        if (!stateHooksInfoFrom.isStateTransitionSupported[toState]) revert StateTransitionNotSupported(fromState, toState);

        execute(stateHooksInfoFrom.afterSelectors, campaignId);
        execute(stateHooksInfoTo.beforeSelectors, campaignId);

        l.stateOfId[campaignId] = toState;
    }

    /* ====================================================== EXECUTE HOOKS ======================================================== */
    /**
     * @notice Executes the hooks that are supposed to be called before or after state. (Details on StateFacet.sol)
     * @param selectorsToExecute The selectors of functions to be executed.
     * @param campaignId The unique identifier of the targeted campaign.
     */
    function execute(bytes4[] memory selectorsToExecute, uint256 campaignId) internal {
        uint256 length = selectorsToExecute.length;

        for (uint256 i; i < length; ) {
            bytes memory input = abi.encodeWithSelector(selectorsToExecute[i], campaignId);
            (bool success, bytes memory result) = address(this).call(input);

            if (!success) {
                assembly ("memory-safe") {
                    revert(add(result, 32), mload(result))
                }
            }

            unchecked {
                i += 1;
            }
        }
    }

    /* ========================================================== QUERIES ========================================================== */

    /**
     * @notice Retrieves the current state of the specified campaign.
     * @param l A reference to the Layout struct in storage.
     * @param campaignId The unique identifier of the targeted campaign.
     * @return The current state of `campaignId`.
     */
    function getStateOfId(Layout storage l, uint256 campaignId) internal view returns (uint256) {
        return l.stateOfId[campaignId];
    }
}

File 5 of 9 : DelegateCallee.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

/**
 * @title DelegateCallee
 * @author Evergonlabs
 * @notice This abstract contract provides modifiers to enforce specific call contexts
 * for functions of facets in a diamond architecture (see EIP-2535). It ensures proper function execution
 * by restricting access based on the caller's address.
 *
 * @dev Functions of facets must always be called via delegate calls from the diamond proxy. If there is no delegate call,
 * the function is not in the context of the diamond, therby eliminating the risk of unintended behavior
 * and storage access.
 *
 * When using `delegatecall`, the `msgSender` within the context of the called contract is the address of the original
 * caller that invoked the function, not the address of the contract executing the delegate call.
 * This distinction allows us to differentiate between "internal" and "external" delegate calls in the context of the
 * diamond architecture.
 */
abstract contract DelegateCallee {
    /* =================================================== ERRORS ================================================== */

    /// @notice Thrown when a function should not be called by an address other than the diamond proxy itself.
    error OnlyInternalDelegateCall(address invalidCaller, bytes4 functionSignature);

    /// @notice Thrown when a function should not be called by the diamond proxy itself.
    error OnlyExternalDelegateCall(bytes4 functionSignature);

    /* ================================================= MODIFIERS ================================================= */

    /**
     * @notice Restricts access to functions that should only be invoked via "internal" delegate calls
     * from the diamond contract. This ensures that certain operations are executed in the correct
     * context and prevents unauthorized access or unexpected behavior.
     *
     * @dev This modifier verifies that the caller is the contract itself (i.e., the diamond proxy).
     * If the function is called from outside the diamond, the transaction will revert.
     */
    modifier onlyInternalDelegateCall() {
        if (msg.sender != address(this)) revert OnlyInternalDelegateCall(msg.sender, msg.sig);
        _;
    }

    /**
     * @notice Restricts access to functions that should only be invoked via "external" delegate calls
     * (calls originating from an admin or other external caller targeting the diamond proxy).
     * This modifier is mainly used to ensure that initialization operations cannot be executed directly
     * by the diamond contract itself.
     *
     * @dev This modifier checks that the caller is not the contract itself (i.e., the diamond proxy).
     * If the function is called by the diamond, the transaction will revert.
     */
    modifier onlyExternalDelegateCall() {
        if (msg.sender == address(this)) revert OnlyExternalDelegateCall(msg.sig);
        _;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

import "./ERC2771RecipientStorage.sol";

/**
 * @title ERC2771RecipientHelperLib
 * @author Evergonlabs
 * @notice Implements EIP-2771 standard, as defined in https://eips.ethereum.org/EIPS/eip-2771
 * @notice This library can be included in a Diamond Facet to provide it with `_msgSender()` and `_msgData()`
 */
library ERC2771RecipientHelperLib {
    using ERC2771RecipientStorage for ERC2771RecipientStorage.Layout;

    /**
     * @notice Returns the sender of this call.
     * If the call came through the trusted forwarder, return the original sender,
     * otherwise, return `msg.sender`.
     * @dev Should be used in the contract anywhere instead of `msg.sender`.
     * @return ret The address of the real sender of this call.
     */
    function _msgSender(ERC2771RecipientStorage.Layout storage layout) internal view returns (address ret) {
        if (msg.data.length >= 20 && _isTrustedForwarder(layout, msg.sender)) {
            // At this point we know that the sender is a trusted forwarder,
            // so we trust that the last bytes of msg.data are the verified sender address.
            // extract sender address from the end of msg.data
            assembly ("memory-safe") {
                ret := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        } else {
            ret = msg.sender;
        }
    }

    /**
     * @notice Returns the msg.data of this call.
     * If the call came through the trusted forwarder, then the real sender was appended as the last 20 bytes
     * of the msg.data - so this method will strip those 20 bytes off.
     * Otherwise (if the call was made directly and not through the forwarder), return `msg.data`.
     * @dev Should be used in the contract instead of msg.data, where this difference matters.
     * @return ret The msg.data of this call.
     */
    function _msgData(ERC2771RecipientStorage.Layout storage layout) internal view returns (bytes calldata ret) {
        if (msg.data.length >= 20 && _isTrustedForwarder(layout, msg.sender)) {
            unchecked {
                return msg.data[0:msg.data.length - 20];
            }
        } else {
            return msg.data;
        }
    }

    /**
     * @notice Queries whether a given address corresponds to the trusted forwarder that is being used.
     * @param forwarder the address to inquire.
     * @return bool true if the given address is the address of the trusted forwarder, false if not.
     */
    function _isTrustedForwarder(ERC2771RecipientStorage.Layout storage layout, address forwarder) internal view returns (bool) {
        return forwarder == layout.trustedForwarder;
    }
}

File 7 of 9 : ERC2771RecipientStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

/**
 * @title ERC2771RecipientStorage
 * @author Evergonlabs
 * @notice Provides storage for the trustedForwarder, required to impelement EIP-2771 in a Diamond architecture
 */
library ERC2771RecipientStorage {
    /**
     * @dev Unique identifier for the storage slot where the Layout struct is stored. Derived from the ERC7201 formula.
     * STORAGE_SLOT: 0xe392033769e11fdec1c6ff271abad0dad25c63e828b624968d649ada17197800
     */
    bytes32 internal constant STORAGE_SLOT =
        keccak256(abi.encode(uint256(keccak256("Evergonlabs.Tmi-Tokenizer.storage.ERC2771RecipientStorage")) - 1)) &
            ~bytes32(uint256(0xff));

    struct Layout {
        address trustedForwarder;
    }

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly ("memory-safe") {
            l.slot := slot
        }
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

/**
 * @notice INonFundedStateFacet
 */
interface INonFundedStateFacet {
    function initNonFundedStateFacet(bytes calldata initNonFundedStateData) external;
    function checkNonFundedState(uint256 campaignId) external view;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

import {StateFacetStorage} from "../../../genericFacets/stateFacet/StateFacetStorage.sol";

/**
 * @notice SingleStateNonFundedFacetStorage
 */
library SingleStateNonFundedFacetStorage {
    using StateFacetStorage for StateFacetStorage.Layout;

    /* =================================================== ERRORS ================================================== */
    /// @notice Thrown when attempting to re-initialize.
    error AlreadyInitialized();

    /// @notice Thrown when attempting to set non funded state as 0.
    error InvalidNonFundedStateZero();

    /// @notice Thrown when campaign is not in non funded state.
    error NotInNonFundedState(uint256 campaignId, uint256 nonFundedState, uint256 currentState);

    /** ================================================== STORAGE =================================================
     * @dev Unique identifier for the storage slot where the Layout struct is stored. Derived from the ERC7201 formula.
     * STORAGE_SLOT: 0x608ee60459c820f4eb4ed5cce5c3a1fd4e58eb931e06c7c8414d3aa01e15e800
     */
    bytes32 internal constant STORAGE_SLOT =
        keccak256(abi.encode(uint256(keccak256("Evergonlabs.Tmi-Tokenizer.storage.SingleStateNonFundedFacetStorage")) - 1)) &
            ~bytes32(uint256(0xff));

    struct Layout {
        // This is the state that campaignId should be in, at a non funded state.
        uint256 nonFundedState;
    }

    /**
     * @dev Retrieves a reference to the Layout struct stored at a specified storage slot
     */
    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly ("memory-safe") {
            l.slot := slot
        }
    }

    function initNonFundedStateFacet(Layout storage l, bytes calldata initNonFundedStateData) internal returns (uint256) {
        if (l.nonFundedState != 0) revert AlreadyInitialized();

        uint256 nonFundedState_ = abi.decode(initNonFundedStateData, (uint256));

        if (nonFundedState_ == 0) revert InvalidNonFundedStateZero();

        l.nonFundedState = nonFundedState_;

        return nonFundedState_;
    }

    function checkNonFundedState(Layout storage l, uint256 campaignId) internal view {
        if (l.nonFundedState != StateFacetStorage.layout().stateOfId[campaignId]) {
            revert NotInNonFundedState(campaignId, l.nonFundedState, StateFacetStorage.layout().stateOfId[campaignId]);
        }
    }
}

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

Contract ABI

API
[{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"InvalidNonFundedStateZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"},{"internalType":"uint256","name":"nonFundedState","type":"uint256"},{"internalType":"uint256","name":"currentState","type":"uint256"}],"name":"NotInNonFundedState","type":"error"},{"inputs":[{"internalType":"bytes4","name":"functionSignature","type":"bytes4"}],"name":"OnlyExternalDelegateCall","type":"error"},{"inputs":[{"internalType":"address","name":"invalidCaller","type":"address"},{"internalType":"bytes4","name":"functionSignature","type":"bytes4"}],"name":"OnlyInternalDelegateCall","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"UnauthorizedInitialization","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nonFundedState","type":"uint256"}],"name":"NonFundedStateInitialized","type":"event"},{"inputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"}],"name":"checkNonFundedState","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"initNonFundedStateData","type":"bytes"}],"name":"initNonFundedStateFacet","outputs":[],"stateMutability":"nonpayable","type":"function"}]

0x6080604052348015600e575f5ffd5b506105e08061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610034575f3560e01c8063abd60c4614610038578063cbdb258b1461004d575b5f5ffd5b61004b6100463660046104ed565b610060565b005b61004b61005b36600461055b565b6101ae565b3033036100c3576040517f87d02f0e0000000000000000000000000000000000000000000000000000000081527fffffffff000000000000000000000000000000000000000000000000000000005f351660048201526024015b60405180910390fd5b5f6100d46100cf610227565b610288565b905061010a7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775826101036102b9565b91906102e9565b610158576040517fa447f38b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016100ba565b5f61016d8484610166610353565b9190610383565b90507ffba4af1198ef35b6b3d1f4376f88926bae2bfd82fa378ea8b8ace3453b85d874816040516101a091815260200190565b60405180910390a150505050565b333014610212576040517f73db113d0000000000000000000000000000000000000000000000000000000081523360048201527fffffffff000000000000000000000000000000000000000000000000000000005f351660248201526044016100ba565b6102248161021e610353565b90610412565b50565b5f8060ff1961025760017fd01e7296b19e02e5aa08631cc06bf3618b23d16cd2190e524730d1a2c29fcac9610572565b60405160200161026991815260200190565b60408051601f1981840301815291905280516020909101201692915050565b5f6014361080159061029f575061029f8233610499565b156102b257505036601319013560601c90565b5033919050565b5f8060ff1961025760017f19521ffda0517558553ffbd4cede0bd8d007b30cfe0aee9dd94bb478f6120c8a610572565b5f7fefa06053e2ca99a43c97c4a4f3d8a394ee3323a8ff237e625fba09fe30ceb0a483148061034b575073ffffffffffffffffffffffffffffffffffffffff82165f908152600185810160209081526040808420878552909201905290205415155b949350505050565b5f8060ff1961025760017fce8d0518b9bd65856ce55cd746d3e1e8895022c39c31458af7c43031e4e0cdcb610572565b82545f90156103be576040517f0dc149f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6103cb8385018561055b565b9050805f03610406576040517f082ed38500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80855590509392505050565b61041a6104bd565b5f8281526002919091016020526040902054825414610495578154819061043f6104bd565b5f8481526002919091016020526040908190205490517f929064ce0000000000000000000000000000000000000000000000000000000081526004810193909352602483019190915260448201526064016100ba565b5050565b815473ffffffffffffffffffffffffffffffffffffffff8281169116145b92915050565b5f8060ff1961025760017fcfc20d755e8eda9b22987b418831de47e2d42d876a2feb1dd1eecd38673c1158610572565b5f5f602083850312156104fe575f5ffd5b823567ffffffffffffffff811115610514575f5ffd5b8301601f81018513610524575f5ffd5b803567ffffffffffffffff81111561053a575f5ffd5b85602082840101111561054b575f5ffd5b6020919091019590945092505050565b5f6020828403121561056b575f5ffd5b5035919050565b818103818111156104b7577f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffdfea2646970667358221220f1f3c8c7c613808a2c17503bbfe1a8b46651c4da61d68126c65fda0f68b2363f64736f6c634300081b0033

Deployed Bytecode

0x608060405234801561000f575f5ffd5b5060043610610034575f3560e01c8063abd60c4614610038578063cbdb258b1461004d575b5f5ffd5b61004b6100463660046104ed565b610060565b005b61004b61005b36600461055b565b6101ae565b3033036100c3576040517f87d02f0e0000000000000000000000000000000000000000000000000000000081527fffffffff000000000000000000000000000000000000000000000000000000005f351660048201526024015b60405180910390fd5b5f6100d46100cf610227565b610288565b905061010a7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775826101036102b9565b91906102e9565b610158576040517fa447f38b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016100ba565b5f61016d8484610166610353565b9190610383565b90507ffba4af1198ef35b6b3d1f4376f88926bae2bfd82fa378ea8b8ace3453b85d874816040516101a091815260200190565b60405180910390a150505050565b333014610212576040517f73db113d0000000000000000000000000000000000000000000000000000000081523360048201527fffffffff000000000000000000000000000000000000000000000000000000005f351660248201526044016100ba565b6102248161021e610353565b90610412565b50565b5f8060ff1961025760017fd01e7296b19e02e5aa08631cc06bf3618b23d16cd2190e524730d1a2c29fcac9610572565b60405160200161026991815260200190565b60408051601f1981840301815291905280516020909101201692915050565b5f6014361080159061029f575061029f8233610499565b156102b257505036601319013560601c90565b5033919050565b5f8060ff1961025760017f19521ffda0517558553ffbd4cede0bd8d007b30cfe0aee9dd94bb478f6120c8a610572565b5f7fefa06053e2ca99a43c97c4a4f3d8a394ee3323a8ff237e625fba09fe30ceb0a483148061034b575073ffffffffffffffffffffffffffffffffffffffff82165f908152600185810160209081526040808420878552909201905290205415155b949350505050565b5f8060ff1961025760017fce8d0518b9bd65856ce55cd746d3e1e8895022c39c31458af7c43031e4e0cdcb610572565b82545f90156103be576040517f0dc149f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6103cb8385018561055b565b9050805f03610406576040517f082ed38500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80855590509392505050565b61041a6104bd565b5f8281526002919091016020526040902054825414610495578154819061043f6104bd565b5f8481526002919091016020526040908190205490517f929064ce0000000000000000000000000000000000000000000000000000000081526004810193909352602483019190915260448201526064016100ba565b5050565b815473ffffffffffffffffffffffffffffffffffffffff8281169116145b92915050565b5f8060ff1961025760017fcfc20d755e8eda9b22987b418831de47e2d42d876a2feb1dd1eecd38673c1158610572565b5f5f602083850312156104fe575f5ffd5b823567ffffffffffffffff811115610514575f5ffd5b8301601f81018513610524575f5ffd5b803567ffffffffffffffff81111561053a575f5ffd5b85602082840101111561054b575f5ffd5b6020919091019590945092505050565b5f6020828403121561056b575f5ffd5b5035919050565b818103818111156104b7577f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffdfea2646970667358221220f1f3c8c7c613808a2c17503bbfe1a8b46651c4da61d68126c65fda0f68b2363f64736f6c634300081b0033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
0xFD3b97B44339CDF598dead91F07c4c2DF2514B4e
Loading...
Loading
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.