Fraction ProtocolskeletonFacetspurchaseSkeletons

PurchaseSkeletonNoDiscount

Implementation of the Purchase skeleton facet for the TMI-Fraction Protocol.

_This facet serves as a core component (skeleton) of a TMI-Fraction Platform, enabling investors to purchase fractions from campaigns.


IMPORTANT:

  • This implementation supports both fungible (ERC20) and semi-fungible (ERC1155) fractions but does not support campaigns with discount or vesting mechanisms.

  • This implementation can ONLY be utilized by Platforms with the following traits:

    • Does NOT support campaigns that feature discount mechanisms.
    • Does NOT support campaigns that feature vesting schedules.
    • Requires a stable fraction price (i.e., works only in conjunction with Generic StablePriceFacet.sol).

The purchase process of fungible or semi-fungible fractions (depending on the campaigns' setup) is triggered when purchase() is executed, following a sequential pipeline of six phases:

  • State Check: The Platform interacts with its PurchaseState Internal facet to verify that the current state of the targeted campaign is the correct state for the purchase to occur.

  • Time Check: The Platform interacts with its PurchaseTime Internal facet to verify that the current timestamp is within the campaign's configured time-window during which purchases are expected to happen.

  • Eligibility Check: The Platform interacts with its PurchaseEligibility internal facet to verify that the user (caller) meets the campaign's eligibility criteria to purchase fractions.

  • Amount Check: The Platform interacts with its PurchaseAmount Internal facet to verify that the requested amount of fractions meets the campaign's constraints (e.g., softcap, hardcap etc.).

  • Purchase Action: The Platform interacts with its DoPurchase Internal facet to transfer the required funds from the user (caller) to the Platform. The required funds are always based on the originaly set stable price.

  • Post-Purchase Action: The Platform interacts with its PostPurchase Internal facet based on the provided postPurchaseData to handle the purchased fractions accordingly (e.g., transferring them to the user's account or utilizing them in another supported manner, such as staking), thereby finalizing the purchase._

FractionsPurchased

event FractionsPurchased(uint256 campaignId, uint32 chainId, address purchaser, uint256 amountOfFractions)

Emitted at purchase().

purchase

function purchase(uint256 campaignId, uint256 amountOfFractions, bytes, bytes postPurchaseData, uint32 chainId) external payable

Executes the purchase of fractions from a specified campaign.

_Users must meet eligibility criteria (see purchase Eligibility internal facets) and comply with the campaign's constraints (e.g., amount-related constraints).

Emits a {FractionsPurchased} event._

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted campaign.
amountOfFractionsuint256The number of fractions to purchase.
bytes
postPurchaseDatabytesABI-encoded data required for the post-purchase phase.
chainIduint32The ID of the blockchain network where the purchased fractions will be received or utilized.

On this page