Erc1155InputExplicitFacet
This explicit facet handles the configuration of input packets for staking campaigns and facilitates the transfer of these input packets.
_This implementation is designed for use in staking campaigns where the input packet is not solely constructed from ERC1155 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 ERC1155 tokens within the input packet.
IMPORTANT:
- This implementation should awlays be used in conjuction with the
TransferInputMixer.sol. - An input packet can encapsulate one (e.g., tokenA of ID X) or more (e.g., tokenA of ID X, tokenA of ID Y, ..., tokenX of ID Z) ERC1155 tokens._
CampaignERC1155InputConfigured
Emitted at setCampaignTransferErc1155Input().
CampaignERC1155InputPacketAssetsTransferred
Emitted at transferErc1155Input().
setCampaignTransferErc1155Input
Setter function for configuring the ERC1155 assets within the input packet for the specified staking campaign. This function configures only the content of the input packet associated with ERC1155 assets.
_selector: 0xfcf99fea
Setter functions are executed during the creation process of campaigns (see CampaignCreationSkeleton.sol)
Requirements:
- The
tokenAddresses,tokenIdsandamountOfTokensPerPacketarrays must have the same length. tokenAddressesmust contain valid, non-zero ERC1155 token addresses.amountOfTokensPerPacketmust contain non-zero values.
Emits a {CampaignERC1155InputConfigured} event.
IMPORTANT:
-
The input packet should not encapsulate only ERC1155 tokens; for configurations involving only ERC1155 tokens, use
ERC1155InputFacet.solinstead. -
The values in
amountOfTokensPerPacketshould be in whole units, since ERC1155 tokens do not have decimal places. ----------------------------------------------------------------------------------------------------------------_
Parameters
| Name | Type | Description |
|---|---|---|
| campaignId | uint256 | The unique identifier of the targeted staking campaign. |
| campaignTransferErc1155InputData | bytes | The ABI-encoded data containing the following: - tokenAddresses: An address array containing the addresses of the ERC1155 tokens encapsulated by the input packet. - tokenIds: A uint256 array specifying the ID for each corresponding token in tokenAddresses. - amountOfTokensPerPacket: A uint256 array specifying the amount for each corresponding token in tokenAddresses. |
transferErc1155Input
Transfers the ERC1155 assets associated with the specified amount of a given campaign's input packets
from the from address to the to address.
_selector: 0x38065473
This function iteratively executes transfers for all respective amounts of the ERC1155 tokens defined
in the campaign's input packet (see setCampaignTransferErc1155Input()) in a single transaction.
The amounts to be transferred are calculated as
amountOfTokensPerPacket[i] * amountOfPackets for each ERC1155 token in the input packet, where i
is the index of the token in the tokenAddresses array. The transfer is performed using
the safeTransferFrom method of the ERC1155 token interface.
Emits a {CampaignERC1155InputPacketAssetsTransferred} event._
Parameters
| Name | Type | Description |
|---|---|---|
| campaignId | uint256 | The unique identifier of the targeted staking campaign. |
| from | address | The address from which the ERC1155 assets encapsulated by the specified number of input packets to be transferred. |
| to | address | The address to receive the ERC1155 assets encapsulated by the specified number of input packets. |
| amountOfPackets | uint256 | The number of input packets to account for. |

