Staking Protocoltransfersrewarderc1155transferrer

Erc1155RewardTransferExplicitFacet

This explicit facet handles the configuration of reward packets for staking campaigns and facilitates the transfer of the assets encapsulated within these reward packets.

_This implementation is designed for use in staking campaigns where the reward 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 reward packet.

IMPORTANT:

  • This implementation should awlays be used in conjuction with the TransferRewardMixer.sol.
  • The campaign's reward asset handler must have sufficient balances of the ERC1155 assets specified in the reward packets, else the campaign will fail to provide the appropriate rewards.
  • A reward 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._

CampaignERC1155RewardConfigured

event CampaignERC1155RewardConfigured(uint256 campaignId, address[] tokenAddresses, uint256[] tokenIds, uint256[] amountOfTokensPerPacket)

Emitted at setCampaignTransferErc1155Rewards().

CampaignERC1155RewardPacketAssetsTransferred

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

Emitted at transferErc1155Reward().

setCampaignTransferErc1155Rewards

function setCampaignTransferErc1155Rewards(uint256 campaignId, bytes campaignTransferErc1155RewardsData) external

Setter function for configuring the ERC1155 assets within the reward packet for the specified staking campaign. This function configures only the content of the reward packet associated with ERC1155 assets.

_selector: 0xb4c9fee2

Setter functions are executed during the creation process of campaigns (see CampaignCreationSkeleton.sol)

Requirements:

  • The tokenAddresses, tokenIds and amountOfTokensPerPacket arrays must have the same length.
  • tokenAddresses must contain valid, non-zero ERC1155 token addresses.
  • amountOfTokensPerPacket must contain non-zero values.

Emits a {CampaignERC1155RewardConfigured} event.


IMPORTANT:

  • The reward packet should not encapsulate only ERC1155 tokens; for configurations involving only ERC1155 tokens, use ERC1155RewardMinterFacet.sol or ERC1155RewardTransferFacet.sol instead.
  • The values in amountOfTokensPerPacket should be in whole units, since ERC1155 tokens do not have decimal places.
  • When using this facet, campaign's reward asset handler must have sufficient balances of the ERC1155 assets specified in tokenAddresses, else the campaign will fail to provide the appropriate rewards. ----------------------------------------------------------------------------------------------------------------_

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
campaignTransferErc1155RewardsDatabytesThe ABI-encoded data containing the following: - tokenAddresses: An address array containing the addresses of the ERC1155 tokens encapsulated by the reward 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.

transferErc1155Reward

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

Transfers the ERC1155 assets associated with the specified amount of a given campaign's reward packets from the from address to the to address.

_selector: 0x025db07b

This function iteratively executes transfer functions for all respective amounts of ERC1155 tokens defined in the campaign's reward packet (see setCampaignTransferErc1155Rewards()) in a single transaction.

The amounts to be transferred are calculated as amountOfTokensPerPacket[i] * amountOfPackets for each ERC1155 token in the reward 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 {CampaignERC1155RewardPacketAssetsTransferred} event._

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
fromaddressThe address from which the ERC1155 assets encapsulated by the specified number of rewards packets to be transferred.
toaddressThe address to receive the ERC1155 assets encapsulated by the specified number of reward packets.
amountOfPacketsuint256The number of reward packets to account for.

On this page