CreateFractionsSkeleton
Implementation of the CreateFractions skeleton facet for the TMI-Fraction Protocol.
_This facet serves as a core component (skeleton) of a TMI-Fraction Platform, enabling the creation of highly configurable fractionalization campaigns.
The campaign creation process is triggered when createFractions()
is executed, following a sequential pipeline of three phases:
-
PreFraction phase: The Platform interacts with its Wrapper, which deploys a Vault where specified asset(s) are wrapped. The Platform receives an NFT from the Wrapper, representing the campaign's Vault and its holdings.
-
Fraction phase: The Platform interacts with a dedicated FractionFactory, which deploys a Fractionalizer responsible for issuing fractions. Ownership of the Wrapper’s NFT is transferred to the Fractionalizer, and its fractions represent shares of the campaign’s Vault. These fractions are either pre-allocated to the Platform or minted on demand (
isMinting == true
) when purchased (seePurchaseSkeleton.sol
). At any given time, the total supply of fractions collectively represents 100% ownership of the Vault and all its underlying assets. Whoever holds the total supply of the fractions effectively owns the entire Vault. -
PostFraction phase: The Platform interacts with its dedicated Setter facet (
postFraction
internal) which executes all requiredsetAndCheck
functions using the provided input (viapostFractionData
). These functions configure key campaign parameters, including fraction pricing, the funding packet, specific timestamps, and other use case related parameters._
NonZeroFractionsOnCreation
Thrown when fractionsCreated are greater than 0
, while isMinting
is true.
FractionsCreated
Emitted at createFractions()
.
createFractions
Creates a new fractionalization campaign by executing the Platform's preFraction
, fraction
and postFraction
pipeline phases using the provided input. The campaign ID is determined by incrementing the currentId
counter stored in the
general storage.
_Campaign configuration is constrained by the Platform’s setup, specifically the skeleton and internal facets it utilizes and their initialization.
Users must meet eligibility criteria to create campaigns (see createFractions
Eligibility internal facets).
Emits a {FractionsCreated} event.
IMPORTANT:
- The user does NOT need to approve the Platform (diamond proxy) for the token(s) they wish to wrap and fractionalize. Instead, they must approve the Platform as a spender of their assets in the Wrapper contract and additionally approve the Wrapper in the token(s) contract(s)._
Parameters
Name | Type | Description |
---|---|---|
preFractionData | bytes | ABI encoded data needed for the preFraction phase (see preFraction internals). |
fractionData | bytes | ABI encoded data needed for the fraction phase (see fraction internals). |
postFractionData | bytes | ABI encoded data needed for the postFraction phase (see postFraction internals). |
isMinting | bool | If true , fractions are minted on demand during purchase; if false , they are minted to the Platform immediately upon the Fractionalizer’s creation. |
getCurrentCampaignId
Retrieves the ID of the most recently created campaign.
getNftIdForCampaignId
Retrieves the ID of the NFT minted by the Wrapper for the specified campaign.
The NFT represents the campaign's Vault and its holdings (wrapped assets).
Parameters
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted campaign. |