Fraction ProtocolskeletonFacetsconnectorscreateToPurchaseConnectorsfractionsRoleApproval

FractionsRoleApprovalFacetNID

Connector facet with Compilot gating for transitioning campaigns from the CREATED state to either the PURCHASE or REJECTED state.

_This facet is used by TMI-Fraction Platforms that require validation for campaigns to transition to the PURCHASE state. Validation can result in either approval (transition to PURCHASE state) or rejection (transition to REJECTED state). It serves as a switch, transitioning a campaign's state from CREATED to either PURCHASE or REJECTED, 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 (see TxAuthDataVerifierFacet).

NOTE:

  • Connectors intervene at predetermined intermediate state(s) and transition campaigns to predetermined destination state(s).
  • This connector is designed to intervene at the CREATED state only, with two potential destination states: the approvalState (i.e., PURCHASE) and the rejectionState (i.e., REJECTED)._

UnauthorizedInitialization

error UnauthorizedInitialization(address account)

Thrown when trying to initialize from non admin account.

CreateToPurchaseConnectorInitialized

event CreateToPurchaseConnectorInitialized()

Emitted at initCreateToPurchaseConnector().

FractionsApproved

event FractionsApproved(uint256 campaignId)

Emitted at approveFractions().

FractionsRejected

event FractionsRejected(uint256 campaignId)

Emitted at rejectFractions().

initCreateToPurchaseConnector

function initCreateToPurchaseConnector(bytes initCreateToPurchaseConnectorData) external

Initializes the FractionsRoleApprovalFacetStorage by registering the eligible validator role(s), as well as the intermediate state (CREATED), and the destination states (PURCHASE and REJECTED) 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 {CreateToPurchaseConnectorInitialized} event.

This function can only be called by the Admin (see AccessControlFacet.sol)._

Parameters

NameTypeDescription
initCreateToPurchaseConnectorDatabytesThe ABI-encoded data containing: - eligibleRoles: bytes32[] containing the role(s) eligible for validating (approving or rejecting campaigns). - interferenceState: uint256 representing the CREATED state for any campaign. - approveState: uint256 representing the PURCHASE state for any campaign. - rejectState: uint256 representing the REJECTED state for any campaign.

approveFractions

function approveFractions(uint256 campaignId) external

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

_This function can only be called by eligible validators (see initCreateToPurchaseConnector()). It can only be executed successfully if the transaction calldata contains the required signature and expiration block (see requireTxDataAuth modifier) and if the current state of campaignId is CREATED.

Emits a {FractionsApproved} event._

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted campaign.

rejectFractions

function rejectFractions(uint256 campaignId) external

Transitions the specified campaign from its CREATED state to its REJECTED state.

_This function can only be called by eligible validators (see initCreateToPurchaseConnector()). It can only be executed successfully if the transaction calldata contains the required signature and expiration block (see requireTxDataAuth modifier) and if the current state of campaignId is CREATED.

Emits a {FractionsRejected} event.

IMPORTANT:

  • All the wrapped assets of the campaignId are forcibly unlocked and transferred to the campaign's creator._

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted campaign.

On this page