WhitelistedStakersFacetStorage
This library manages the storage and logic for applying role-based participation eligibility configurations for staking campaigns. It also handles eligibility checks during user interactions with these campaigns.
This implementation is designed to configure multiple eligible roles for any staking campaign.
CampaignNotOnCreationStateForSetting
Thrown when a targeted campaign is not "On Creation" state, which is required at configurations.
StakerEligibleRolesAbsent
Thrown when trying to set eligibility without specifying eligible roles for campaign's stakers.
NotEligibleForCampaignParticipation
Thrown when an account without the required role attempts to participate on a staking campaign.
STORAGE_SLOT
Unique identifier for the storage slot where the Layout struct is stored.
Layout
Struct for managing participation eligibility configuration details for staking campaigns.
layout
Retrieves a reference to the Layout struct stored at the slot specified by STORAGE_SLOT
unique identifier.
setCampaignStakersEligibility
Setter function for configuring role-based eligibility criteria for participation in the specified staking campaign.
_Setter functions are executed during the creation process of campaigns (see CampaignCreationSkeleton.sol
).
NOTE:
-
If
isCampaignScoped == false
, any user will be able to participate in the specified campaign, provided they are granted a role contained within the ABI-encodedeligibleRoles
array viagrantRole()
orgrantRoleMultiple()
. Thus checks for eligible roles will be performed platform-wide. -
If
isCampaignScoped == true
, any user will be able to participate in the specified campaign, provided they are granted a role contained within the ABI-encodedeligibleRoles
array viagrantRoleForId()
orgrantRoleMultipleForId()
for the specifiedcampaignId
. Thus checks for eligible roles will be performed campaign-wide. -
See
AccessControlStakingFacet.sol
for information about role-based access control. ----------------------------------------------------------------------------------------------------------------_
Parameters
Name | Type | Description |
---|---|---|
l | struct WhitelistedStakersFacetStorage.Layout | A reference to the Layout struct in storage. |
campaignId | uint256 | The unique identifier of the targeted staking campaign. |
campaignStakersEligibilityData | bytes | The ABI-encoded data containing the following: - eligibleRoles : A bytes32 array with the roles eligible for participating in the campaign. - isCampaignScoped : A boolean flag indicating whether eligibleRoles should be campaign-wide specific (true) or platform-wide specific (false). |
checkStakersEligibility
Checks whether the specified account is eligible to participate in the given campaign.
_Reverts if account
is not eligible to participate in the campaign.
IMPORTANT:
Depending on the configuration for campaignId
, eligibility checks will be performed either platform-wide
or campaign-wide (see setCampaignStakersEligibility()
)._
Parameters
Name | Type | Description |
---|---|---|
l | struct WhitelistedStakersFacetStorage.Layout | A reference to the Layout struct in storage. |
campaignId | uint256 | The unique identifier of the targeted staking campaign. |
account | address | The address of the account to check. |