Fraction ProtocolprivateFacetsdoReceiveFacets

PropPacketsGatheredFeeCollectorFacet

Private facet of the DoReceive internal facets for the Receive skeleton.

_This facet enables fee acquisition and schema configuration on TMI-Fraction Platforms for fees extracted from campaigns' gathered funds (raised through fraction purchases) according to a configured fee rate.

IMPORTANT:

  • The fee from any campaign is deducted when the campaign creator claims the funds (see ReceiveSkelton.receive()), and the corresponding amount is transferred to the designated fee receiver at that time._

UnauthorizedInitialization

error UnauthorizedInitialization(address account)

Thrown when trying to initialize from non admin account.

UnauthorizedLimitSet

error UnauthorizedLimitSet(address account)

Thrown when trying to set limit from non limit setter account.

DoReceiveFeeSchemaInitialized

event DoReceiveFeeSchemaInitialized(address feeCollector, address limitSetter, uint256 feeProportion)

Emitted at initDoReceiveFeeCollectorFacet().

DoReceiveFeeAcquired

event DoReceiveFeeAcquired(uint256 campaignId, uint256 feePacketsAmount)

Emitted at acquireDoReceiveFees().

DoReceiveFeeLimitSet

event DoReceiveFeeLimitSet(uint256 campaignId, uint256 packetsLimit)

Emitted at setFeeLimitOnCampaign().

initDoReceiveFeeCollectorFacet

function initDoReceiveFeeCollectorFacet(bytes initDoReceiveFeeCollectorData) external

Initializes the PropPacketsGatheredFeeCollectorFacetStorage by registering the eligible fee collector and limit setter addresses, as well as the fee rate to be applied to campaigns' gathered funds.

_For example, if the feeRate is set to 10%, then a campaign raising 100 funding packets will result in 10 funding packets being transferred to the feeCollector when the campaign creator (or the designated account) claims the funds.

IMPORTANT:

  • Rates and percentages are represented with a base of 10^6 (e.g., 0.1 -> 10% is 100000).
  • feeCollector and limitSetter cannot be set to the zero address.

Emits a {DoReceiveFeeSchemaInitialized} event.

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

Parameters

NameTypeDescription
initDoReceiveFeeCollectorDatabytesABI-encoded data containing: - feeCollector: The eligible address that will be receiving the fees (if any). - limitSetter: The address allowed to set a cap on the maximum amount (funding packets) to which the fee rate applies. - feeRate: The rate defining what portion of a campaign’s gathered funds (in terms of packets) is charged as a fee.

setAndCheckDoReceiveFeeCollector

function setAndCheckDoReceiveFeeCollector(bytes) external

acquireDoReceiveFees

function acquireDoReceiveFees(uint256 campaignId, uint256 totalPacketsGathered) external returns (uint256)

Called by IDoReceiveFacet.doReceive() (see Receive Skeleton) to calculate the fee from totalPacketsGathered based on the configured feeRate, and transfer the corresponding amount to the designated feeCollector (see initDoReceiveFeeCollectorFacet()).

Emits a {DoReceiveFeeAcquired} event on condition.

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted campaign.
totalPacketsGathereduint256The total number of funding packets gathered in campaignId.

Return Values

NameTypeDescription
[0]uint256The number of funding packets remaining after the fee provision occured.

setFeeLimitOnCampaign

function setFeeLimitOnCampaign(uint256 campaignId, uint256 packetsLimit) external

Sets a cap on the maximum amount (funding packets) to which the fee rate applies for a specified campaign's gathered funds.

_This function can only be called by the designated limitSetter (see initDoReceiveFeeCollectorFacet()).

Emits a {DoReceiveFeeLimitSet} event._

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted campaign.
packetsLimituint256The cap to set (in terms of funding packets)

On this page