PurchaseToReceiveRoleApprovalFacetNID
Connector facet with Compilot gating for transitioning campaigns to the RECEIVE
state when applicable.
_This facet is used by TMI-Fraction Platforms that require validation for campaigns to transition to the RECEIVE
state.
It serves as a switch, transitioning a campaign's state from PURCHASE
to RECEIVE
, if conditions are met.
IMPORTANT:
- This implementation features role-based access control for campaign validator(s) (see
AccessControl.sol
), along with a signatured-based gating mechanism (seeTxAuthDataVerifierFacet
).
NOTE:
- Connectors intervene at predetermined intermediate state(s) and transition campaigns to predetermined destination state(s).
- This connector is designed to intervene at the
PURCHASE
state only, and transition to theRECEIVE
state._
UnauthorizedInitialization
Thrown when trying to initialize from non admin account.
PurchaseToReceiveConnectorInitialized
Emitted at initPurchaseToReceiveConnector()
.
PurchaseCompletionApproved
Emitted at approvePurchaseCompletion()
.
initPurchaseToReceiveConnector
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).
Emits a {PurchaseToReceiveConnectorInitialized} event.
This function can only be called by the Admin (see AccessControlFacet.sol
)._
Parameters
Name | Type | Description |
---|---|---|
initPurchaseToReceiveConnectorData | bytes | The 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
Transitions the specified campaign from its PURCHASE
state to its RECEIVE
state.
_This function can only be called by eligible validators (see initCreateToPurchaseConnector()
).
It can only be executed if the transaction calldata contains the required signature and expiration block
(see requireTxDataAuth
modifier), and if the current state of campaignId
is PURCHASE
and the purchase phase
time window has elapsed, with the campaign meeting its funding target.
Emits a {PurchaseCompletionApproved} event._
Parameters
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted campaign. |