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
Thrown when trying to initialize from non admin account.
UnauthorizedLimitSet
Thrown when trying to set limit from non limit setter account.
DoReceiveFeeSchemaInitialized
Emitted at initDoReceiveFeeCollectorFacet()
.
DoReceiveFeeAcquired
Emitted at acquireDoReceiveFees()
.
DoReceiveFeeLimitSet
Emitted at setFeeLimitOnCampaign()
.
initDoReceiveFeeCollectorFacet
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
andlimitSetter
cannot be set to the zero address.
Emits a {DoReceiveFeeSchemaInitialized} event.
This function can only be called by the Admin (see AccessControlFacet.sol
)._
Parameters
Name | Type | Description |
---|---|---|
initDoReceiveFeeCollectorData | bytes | ABI-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
acquireDoReceiveFees
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
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted campaign. |
totalPacketsGathered | uint256 | The total number of funding packets gathered in campaignId . |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The number of funding packets remaining after the fee provision occured. |
setFeeLimitOnCampaign
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
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted campaign. |
packetsLimit | uint256 | The cap to set (in terms of funding packets) |