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
Emitted at setAndCheckFundingErc20Packet()
.
CampaignFundingErc20PacketsTransferred
Emitted at transferFundingErc20Packets()
.
initFundingErc20PacketFacet
Initializes the FundingErc20PacketsFacetStorage
by setting the approved ERC20 tokens. These tokens serve as valid
ERC20 funding currencies within the platform.
selector: 0x12791131
Parameters
Name | Type | Description |
---|---|---|
initFundingPacketData | bytes | The ABI-encoded data containing the following: approvedTokens : An array of ERC20 token addresses approved for inclusion in input packets. |
setAndCheckFundingErc20Packet
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
andamountOfTokensPerPacket
arrays must have the same length. tokenAddresses
must contain approved ERC20 token addresses (seeinitFundingErc20PacketFacet()
).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 inamountOfTokensPerPacket
with each token's decimal precision (using wei values), thus, funding packet amounts should be specified in whole units at the API level. ----------------------------------------------------------------------------------------------------------------------------_
Parameters
Name | Type | Description |
---|---|---|
postFractionFundingPacketData | bytes | The 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
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
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted tokenizer campaign. |
from | address | The address from which the ERC20 assets encapsulated by the specified number of input packets to be transferred. |
to | address | The address to receive the ERC20 assets encapsulated by the specified number of input packets. |
amountOfPackets | uint256 | The number of input packets to account for. |