FractionsRoleApprovalFacetStorage
This library handles the storage and logic for the FractionsRoleApprovalFacet
connector facet.
_Connectors intervene at predetermined intermediate state(s) and progress campaigns to predetermined destination state(s). when applicable.
IMPORTANT:
- This implementation features role-based access control for the campaign validator(s) (see
AccessControl.sol
).
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
Thrown when attempting to re-initialize.
WrongInitializationData
Thrown when passing invalid initialization data (e.g., setting states to zero).
UnauthorizedApproval
Thrown when attempting to approve a campaign's transition to the purchase phase without authorization.
UnauthorizedRejection
Thrown when attempting to reject a campaign without authorization.
STORAGE_SLOT
Unique identifier for the storage slot where the Layout struct is stored. Derived from the ERC7201 formula. STORAGE_SLOT: 0x2957d1ea22bafe0f23595598fff9e39b2ee7dc53fe89c23575e6aa6196fa2100
Layout
Struct containing the configuration information of the connector.
layout
Retrieves a reference to the Layout struct stored at the slot specified by STORAGE_SLOT
unique identifier.
initCreateToPurchaseConnector
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).
Parameters
Name | Type | Description |
---|---|---|
l | struct FractionsRoleApprovalFacetStorage.Layout | A reference to the Layout struct in storage. |
initCreateToPurchaseConnectorData | bytes | The ABI-encoded data containing: - eligibleRoles : A bytes32 array containing the role(s) eligible for validating (approving or rejecting campaigns). - interferenceState : A uint256 representing the CREATED state for any campaign. - approveState : A uint256 representing the PURCHASE state for any campaign. - rejectState : A uint256 representing the REJECTED state for any campaign. |
approveFractions
Transitions the specified campaign from its CREATED
state to its PURCHASE
state.
This function can only be called by eligible validators (see initCreateToPurchaseConnector()
),
and can only be executed successfully if the current state of campaignId
is CREATED
.
Parameters
Name | Type | Description |
---|---|---|
l | struct FractionsRoleApprovalFacetStorage.Layout | A reference to the Layout struct in storage. |
campaignId | uint256 | The unique identifier of the targeted campaign. |
rejectFractions
Transitions the specified campaign from its CREATED
state to its REJECTED
state.
_This function can only be called by eligible validators (see initCreateToPurchaseConnector()
),
and can only be executed successfully if the current state of campaignId
is CREATED
.
IMPORTANT:
- All the wrapped assets of the
campaignId
are forcibly unlocked and transferred to the campaign's creator._
Parameters
Name | Type | Description |
---|---|---|
l | struct FractionsRoleApprovalFacetStorage.Layout | A reference to the Layout struct in storage. |
campaignId | uint256 | The unique identifier of the targeted campaign. |