PropWrappedAssetsFeeCollectorFacet
Private facet of the PreFraction
internal facets for the CreateFractions
skeleton.
_This facet enables fee acquisition and schema configuration on TMI-Fraction Platforms for fees extracted from campaigns' wrapped assets, according to a configured fee rate.
IMPORTANT:
- The fee from any campaign is deducted when the campaign is created during the
prefraction
phase (seeCreateFractionsSkeleton.createFractions()
), and the corresponding amount(s) are transferred to the designated fee receiver at that time. - Fees can only be acquired from fungible and semi-fungible wrapped assets._
UnauthorizedInitialization
Thrown when trying to initialize from non admin account.
PreFractionFeeSchemaInitialized
Emitted at initWrappedAssetsFeeCollectorFacet()
.
PreFractionFeeAcquired
Emitted at acquireWrappedAssetsFees()
.
initWrappedAssetsFeeCollectorFacet
Initializes the PropWrappedAssetsFeeCollectorFacetStorage
by registering the eligible fee collector and the fee rate
to be applied to campaigns' wrapped assets.
_For example, if the feeRate
is set to 10%, then a campaign wrapping 100 ERC20 $token will result in 10 $token
being transferred to the feeCollector
when the campaign is created.
IMPORTANT:
- Rates and percentages are represented with a base of 10^6 (e.g., 0.1 -> 10% is
100000
). feeCollector
cannot be set to the zero address.
Emits a {PreFractionFeeSchemaInitialized} event.
This function can only be called by the Admin (see AccessControlFacet.sol
)._
Parameters
Name | Type | Description |
---|---|---|
initWrappedAssetsFeeCollectorData | bytes | ABI-encoded data containing: - feeCollector : The eligible address that will be receiving the fees (if any). - feeRate : The rate defining what portion of a campaign’s wrapped assets is charged as a fee. |
setAndCheckWrappedAssetsFeeCollectorFacet
acquireWrappedAssetsFees
Called by IPreFractionFacet.handlePreFractionPhase()
(see CreateFractions
Skeleton) to calculate the fee from
the given asset(s) based on the configured feeRate
, and transfer the corresponding amount(s) to the designated feeCollector
(see initWrappedAssetsFeeCollectorFacet()
).
_Reverts if any entry in the wtypes
array corresponds to non-fungible assets (i.e., code 1
for ERC721).
Emits a {PreFractionFeeAcquired} event._
Parameters
Name | Type | Description |
---|---|---|
wrapperNftId | uint256 | The ID of the NFT representing the Wrapper's Vault that holds the wrapped assets. |
wtypes | enum IWrapper.WrappedObjectType[] | An array of codes representing the types (ERCs) of the assets (e.g., 0 = ERC20, 1 = ERC721, 2 = ERC1155). |
tokens | address[] | An array of asset (token) contract addresses. |
ids | uint256[] | An array of token IDs (relevant only for semi-fungible and non-fungible assets). |
values | uint256[] | An array of asset amounts (relevant only for fungible and semi-fungible assets). |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256[] | An array of uint256 values representing the remaining amounts of tokens after the fee deduction. |