Fraction ProtocolskeletonFacetsconnectorspurchaseToReceiveConnectorspurchaseToReceiveRoleApproval

PurchaseToReceiveRoleApprovalFacetStorage

This library handles the storage and logic for the PurchaseToReceiveRoleApprovalFacet connector facet.

_Connectors intervene at predetermined intermediate state(s) and progress campaigns to predetermined destination state(s). when applicable.

NOTE:

  • We do not use the custom:storage-location annotation because the Layout struct is defined in a library, which, as of now, does not support automated storage layout validation. However, the implementation adheres to the ERC-7201 structure in spirit by ensuring unique and collision-free storage slots using the ERC-7201 formula._

AlreadyInitialized

error AlreadyInitialized()

Thrown when attempting to re-initialize.

WrongInitializationData

error WrongInitializationData()

Thrown when passing invalid initialization data (e.g., setting states to zero).

UnauthorizedStateChange

error UnauthorizedStateChange(uint256 campaignId, address account)

Thrown when attempting to approve a campaign's transition to the receive state without authorization.

PurchasePhaseNotFinished

error PurchasePhaseNotFinished(uint256 campaignId)

Thrown when attempting to transition the campaign's state before the purchase phase has finished.

PurchaseAmountNotReached

error PurchaseAmountNotReached(uint256 campaignId)

Thrown when attempting to transition the campaign's state but its funding target has not been reached.

STORAGE_SLOT

bytes32 STORAGE_SLOT

Unique identifier for the storage slot where the Layout struct is stored. Derived from the ERC7201 formula. STORAGE_SLOT: 0x150972faaabc779b9c84a34484fdc1807c65066d87a76c9f9e0b1a365e815d00

Layout

Struct containing the configuration information of the connector.

struct Layout {
  uint256 interferenceState;
  uint256 destinationState;
  bytes32[] eligibleRoles;
}

layout

function layout() internal pure returns (struct PurchaseToReceiveRoleApprovalFacetStorage.Layout l)

Retrieves a reference to the Layout struct stored at the slot specified by STORAGE_SLOT unique identifier.

initPurchaseToReceiveConnector

function initPurchaseToReceiveConnector(struct PurchaseToReceiveRoleApprovalFacetStorage.Layout l, bytes initPurchaseToReceiveConnectorData) internal

Initializes the PurchaseToReceiveRoleApprovalFacetStorage by registering the intermediate state (PURCHASE) and the destination state (RECEIVE) for this connector.

Campaign states in a TMI-Fraction Platform are represented as uint256 values and are configured during the initialization of the generic StateFacet (see StateFacet.sol). Extra care should be taken to ensure consistency with the value schema used for the states, as defined in the StateFacet configuration (e.g., using enums).

Parameters

NameTypeDescription
lstruct PurchaseToReceiveRoleApprovalFacetStorage.LayoutA reference to the Layout struct in storage.
initPurchaseToReceiveConnectorDatabytesThe ABI-encoded data containing: - eligibleRoles: bytes32[] containing the role(s) eligible for validating (approving purchase completion). - intermediateState: uint256 representing the PURCHASE state for any campaign. - destinationState: uint256 representing the RECEIVE state for any campaign.

approvePurchaseCompletion

function approvePurchaseCompletion(struct PurchaseToReceiveRoleApprovalFacetStorage.Layout l, uint256 campaignId) internal

Transitions the specified campaign from its PURCHASE state to its RECEIVE state.

This function can only be called by eligible validators (see initCreateToPurchaseConnector()), and can only be executed if the current state of campaignId is PURCHASE and the purchase phase time window has elapsed, with the campaign meeting its funding target.

Parameters

NameTypeDescription
lstruct PurchaseToReceiveRoleApprovalFacetStorage.LayoutA reference to the Layout struct in storage.
campaignIduint256The unique identifier of the targeted campaign.

On this page