Connectors
Connectors are special facets that specify which existing platform states serve as interference and destination states. Rather than introducing new states, connectors define, in their associated storage, the sets of platform states that control when and how user-driven state transitions can occur.
Depending on the selector, connectors can mediate transitions between states already initialized in the
StateFacetStorage. For example,
between FRACTIONS_CREATED
and PURCHASE
states, by enabling conditional approval or rejection transitions.
Note
To clarify, a connector can introduce an approval step before entering the purchase phase of a campaign. In this case, FRACTIONS_CREATED
serves as the interference state, while PURCHASE
and REJECTED
are the destination states. This setup allows eligible users, through the connector, to transition the campaign forward to purchase or back to rejection based on specified conditions.
This conditional mechanism allows the ADMIN
or another role with the corresponding permissions to manually decide whether or
not the state of the campaign can progress further:
There are different types of connectors that are available both for the Campaign and Campaign with buyback types.
CreateToPurchase Connector
This connector facet type is employed in scenarios where approval is necessary before users can purchase fractions after
their creation. Designated accounts have the authority to either approve or reject the purchase phase of campaigns/projects.
If the purchase phase is approved, then the campaign’s status progresses from FRACTIONS_CREATED
to PURCHASE
. Conversely,
if the purchase phase is rejected the campaign's status progresses from FRACTIONS_CREATED
to REJECTED
.
Designated accounts can call the following function exposed by the CreateToPurchase
connector to approve the purchase phase
of a specified campaign.
Designated accounts can call the following function exposed by the CreateToPurchase
connector to reject the purchase phase
of a specified campaign.
There are two types of CreateToPurchase
connectors available to choose from:
CreateToPurchaseRoleApprovalFacet
The respective Diamond’s storage is initialized with the following (ABI-encoded together):
bytes32[] eligibleRoles
: Array with the eligible role(s). Accounts granted these role(s) can approve or reject the purchase phase of campaigns. An administrator will need to grant such role(s) to the desired accounts through the genericAccessControlFacet
. This is not needed for theadminRole
.uint256 interferenceState
: The state that campaigns should be (i.e.,FRACTIONS_CREATED
) in order for the approval or rejection to take place.uint256 approveState
: The state that campaigns will progress to, at approval.uint256 rejectState
: The state that campaigns will progress to, at rejection.
CreateToPurchaseAddressAprovalFacet
The respective Diamond’s storage is initialized with the following (ABI-encoded together):
address[] eligibleAddresses
: Array with the address(es) eligible for approving or rejecting the purchase phase of campaigns.interferenceState
,approveState
,rejectState
as in the RoleApproval version.
PurchaseToReceive Connector
This connector facet type is employed in scenarios where approval is necessary before the designated recipient can
receive funds accumulated during the purchase phase. Designated accounts have the authority to approve the receive
phase of campaigns/projects, thus, progressing the status of campaigns (if requirements are met) to RECEIVE
.
Designated accounts can call the following function exposed by the PurchaseToReceive
connector to approve the receive
phase of a specified campaign.
There are two types of PurchaseToReceive
connectors available to choose from:
-
PurchaseToReceiveRoleApprovalFacet
The respective Diamond’s storage is initialized with the following (ABI-encoded together):
bytes32[] eligibleRoles
: Array with the eligible role(s). Accounts granted these role(s) can approve the receive phase of campaigns. An administrator will need to grant such role(s) to the desired account(s) through the genericAccessControlFacet
. This is not needed for theadminRole
.uint256 interferenceState
: The state that campaigns should be (i.e.,PURCHASE
) in order for the approval to take place.uint256 destinationState
: The state that campaigns will progress to (i.e.,RECEIVE
) at approval.
-
PurchaseToReceiveAddressAprovalFacet
The respective Diamond’s storage is initialized with the following (ABI-encoded together):
address[] eligibleAddresses
: Array with the address(es) eligible for approving the receive phase of campaigns.interferenceState
,destinationState
as in theRoleApproval
version.
PurchaseToNonFunded Connector
This sub-connector facet type is employed when NON_FUNDED
state is featured in campaigns/projects.
Thus, it is added only if NonFunded Sub-Skeleton
Facet is integrated.
Accounts can call the following function exposed by the PurchaseToNonFunded
sub-connector to set the
status of a specified campaign to NON_FUNDED
provided that all the necessary requirements are met (e.g., endingTimestamp
of purchasePhase
has been reached, softCap has not been reached).
There is only one type of PurchaseToNonFunded
sub-connector available:
CheckAndJumpToNonFunded
The respective Diamond’s storage is initialized with the following (ABI-encoded together):
uint256 interferenceState
: The state that campaigns should be (e.g.,PURCHASE
) in order for the action to take place.uint256 destinationState
: The state that campaigns will progress to (e.g.,NOT_FUNDED
)