Fraction ProtocolprivateFacetspreFractionsFacets

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 (see CreateFractionsSkeleton.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

error UnauthorizedInitialization(address account)

Thrown when trying to initialize from non admin account.

PreFractionFeeSchemaInitialized

event PreFractionFeeSchemaInitialized(address feeCollector, uint256 feeProportion)

Emitted at initWrappedAssetsFeeCollectorFacet().

PreFractionFeeAcquired

event PreFractionFeeAcquired(address[] tokens, uint256[] ids, uint256[] valuesProvidedAsFee)

Emitted at acquireWrappedAssetsFees().

initWrappedAssetsFeeCollectorFacet

function initWrappedAssetsFeeCollectorFacet(bytes initWrappedAssetsFeeCollectorData) external

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

NameTypeDescription
initWrappedAssetsFeeCollectorDatabytesABI-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

function setAndCheckWrappedAssetsFeeCollectorFacet(bytes setAndCheckWrappedAssetsFeeCollectorData) external

acquireWrappedAssetsFees

function acquireWrappedAssetsFees(uint256 wrapperNftId, enum IWrapper.WrappedObjectType[] wtypes, address[] tokens, uint256[] ids, uint256[] values) external returns (uint256[])

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

NameTypeDescription
wrapperNftIduint256The ID of the NFT representing the Wrapper's Vault that holds the wrapped assets.
wtypesenum IWrapper.WrappedObjectType[]An array of codes representing the types (ERCs) of the assets (e.g., 0 = ERC20, 1 = ERC721, 2 = ERC1155).
tokensaddress[]An array of asset (token) contract addresses.
idsuint256[]An array of token IDs (relevant only for semi-fungible and non-fungible assets).
valuesuint256[]An array of asset amounts (relevant only for fungible and semi-fungible assets).

Return Values

NameTypeDescription
[0]uint256[]An array of uint256 values representing the remaining amounts of tokens after the fee deduction.

On this page