Fraction ProtocolinterfacesskeletonInterfacespurchasePhaseInterfaces

IDoPurchaseFacet

IDoPurchaseFacet

DoPurchaseExecuted

event DoPurchaseExecuted(uint256 campaignId, address account, uint256 amountOfFractions, uint256 pricePerFraction)

initDoPurchaseFacet

function initDoPurchaseFacet(bytes initDoPurchaseData) external

setAndCheckDoPurchase

function setAndCheckDoPurchase(bytes postFractionDoPurchaseData) external

doPurchase

function doPurchase(uint256 campaignId, address account, uint256 amountOfFractions, uint256 pricePerFraction) external

Updates a campaign's totalPacketsGathered in general storage and interacts with the employed FundingPacket facet to transfer the required funding packets from account to the platform.

The general storage update and invocation of IFundingPacketFacet.transferFundingPackets() occurs only if pricePerFraction is nonzero. This is crucial because pricePerFraction can be set to zero by the platform's campaigns (e.g., for a 100% discount mechanism). Some implementations of tokens used as funding currency may require nonzero amounts, potentially causing a revert in their transfer functions. This safeguard ensures the purchase process remains stable.

Parameters

NameTypeDescription
campaignIduint256The ID of the targeted campaign.
accountaddressThe account purchasing fractions.
amountOfFractionsuint256The number of fractions being purchased.
pricePerFractionuint256The cost of a single fraction (in terms of input/funding packets).

On this page