Fraction ProtocolgenericFacetsfundingPacketFacetfundingErc20Packets

FundingErc20PacketsExplicitFacet

This explicit facet handles the configuration of funding packets for campaigns and facilitates the transfer of these funding packets.

_This implementation is designed for use in campaigns where the funding packet is not solely constructed from ERC20 tokens (any other ERC can be accounted for if the respective explicit facet is available). However, this implementation only handles the configuration and transfer of ERC20 tokens within the funding packet.

IMPORTANT:

  • This implementation should awlays be used in conjuction with the FundingPacketMixer.sol.
  • Mixed funding packets cannot be used in campaigns featuring Discount or Interest mechanisms.
  • Extra care should be taken when specifying token amounts (see setAndCheckFundingErc20Packet() for more details).
  • An input packet can encapsulate one (e.g., tokenA) or more (e.g., tokenA, tokenB, ..., tokenX) ERC20 tokens._

CampaignFundingErc20PacketConfigured

event CampaignFundingErc20PacketConfigured(uint256 campaignId, address[] tokenAddresses, uint256[] amountOfTokensPerPacket)

Emitted at setAndCheckFundingErc20Packet().

CampaignFundingErc20PacketsTransferred

event CampaignFundingErc20PacketsTransferred(uint256 campaignId, address from, address to, uint256 amountOfPackets)

Emitted at transferFundingErc20Packets().

initFundingErc20PacketFacet

function initFundingErc20PacketFacet(bytes initFundingPacketData) external

Initializes the FundingErc20PacketsFacetStorage by setting the approved ERC20 tokens. These tokens serve as valid ERC20 funding currencies within the platform.

selector: 0x12791131

Parameters

NameTypeDescription
initFundingPacketDatabytesThe ABI-encoded data containing the following: approvedTokens: An array of ERC20 token addresses approved for inclusion in input packets.

setAndCheckFundingErc20Packet

function setAndCheckFundingErc20Packet(bytes postFractionFundingPacketData) external

Configures and validates the ERC20 assets within the funding packet of a campaign. This function configures only the content of the funding packet associated with ERC20 assets.

_selector: 0xf8c5aeb0

Set and Check functions are executed during the creation process of campaigns (see CreateFractionsSkeleton.sol).

Emits a {CampaignFundingErc20PacketConfigured} event.

Requirements:

  • The tokenAddresses and amountOfTokensPerPacket arrays must have the same length.
  • tokenAddresses must contain approved ERC20 token addresses (see initFundingErc20PacketFacet()).
  • amountOfTokensPerPacket must contain non-zero values.

IMPORTANT:

  • The funding packet should not encapsulate only ERC20 tokens; for configurations involving only ERC20 tokens, use FundingErc20PacketsFacet.sol instead. Since other ERCs may or may not have decimal places, only one configuration option is valid: Parse the values in amountOfTokensPerPacket with each token's decimal precision (using wei values), thus, funding packet amounts should be specified in whole units at the API level. ----------------------------------------------------------------------------------------------------------------------------_

Parameters

NameTypeDescription
postFractionFundingPacketDatabytesThe ABI-encoded data containing the following: - tokenAddresses: An address array containing the addresses of the ERC20 tokens encapsulated by the input packet. - amountOfTokensPerPacket: A uint256 array specifying the amount for each corresponding token in tokenAddresses.

transferFundingErc20Packets

function transferFundingErc20Packets(uint256 campaignId, address from, address to, uint256 amountOfPackets) external

Transfers the specified amount of a given campaign's input packets from the from address to the to address.

_selector: 0x7133302c

Emits a {CampaignFundingErc20PacketsTransferred} event._

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted tokenizer campaign.
fromaddressThe address from which the ERC20 assets encapsulated by the specified number of input packets to be transferred.
toaddressThe address to receive the ERC20 assets encapsulated by the specified number of input packets.
amountOfPacketsuint256The number of input packets to account for.

On this page