Fraction ProtocolskeletonFacetsNID

CreateFractionsSkeletonNID

Implementation of the CreateFractions skeleton facet with Compilot gating 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 signatured-based gated (see TxAuthDataVerifierFacet) and is triggered when createFractions() is called, 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 (see PurchaseSkeleton.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 required setAndCheck functions using the provided input (via postFractionData). These functions configure key campaign parameters, including fraction pricing, the funding packet, specific timestamps, and other use-case related parameters._

UnauthorizedInitialization

error UnauthorizedInitialization(address account)

Thrown when trying to initialize from non admin account.

NonZeroFractionsOnCreation

error NonZeroFractionsOnCreation()

Thrown when fractionsCreated are greater than 0, while isMinting is true.

FractionsCreated

event FractionsCreated(uint256 campaignId, uint256 nftId, address creator, uint256 fractionsCreated, address fractionsAddress)

Emitted at createFractions().

initializeCreateFractionsSkeleton

function initializeCreateFractionsSkeleton(address signer_) external

Initializes the TxAuthDataVerifierFacetStorage by registering the attestor address.

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

IMPORTANT:

  • If the platform uses multiple NID skeletons or subskeletons, only one of them can be initialized._

Parameters

NameTypeDescription
signer_addressThe address of the designated off-chain service that generates the required signatures.

createFractions

function createFractions(bytes preFractionData, bytes fractionData, bytes postFractionData, bool isMinting) external payable

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.

This function can only be executed if the transaction calldata contains the required signature and expiration block (see requireTxDataAuth modifier).

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

NameTypeDescription
preFractionDatabytesABI encoded data needed for the preFraction phase (see preFraction internals).
fractionDatabytesABI encoded data needed for the fraction phase (see fraction internals).
postFractionDatabytesABI encoded data needed for the postFraction phase (see postFraction internals).
isMintingboolIf true, fractions are minted on demand during purchase; if false, they are minted to the Platform immediately upon the Fractionalizer’s creation.

getCurrentCampaignId

function getCurrentCampaignId() external view returns (uint256)

Retrieves the ID of the most recently created campaign.

getNftIdForCampaignId

function getNftIdForCampaignId(uint256 campaignId) external view returns (uint256)

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

NameTypeDescription
campaignIduint256The unique identifier of the targeted campaign.

On this page