WhitelistedStakersFacet
Enables the application of role-based participation eligibility configurations for staking campaigns and handles eligibility checks that should be performed during users' interactions with these campaigns.
This implementation is designed to configure multiple eligible roles for any staking campaign.
StakersEligibilityConfigured
Emitted at setCampaignStakersEligibility()
.
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
).
Emits a {StakersEligibilityConfigured}
event.
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 |
---|---|---|
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.
NOTE: This function should be invoked to check users' eligibility in the following functions:
- stake(),
- stakeBeneficiary(),
- restake(),
- restakeBeneficiary(),
- partialUnstake(),
- fullyUnstake()
- getReward().
See
StakingSkeleton.sol
for detailed information about these functions.
IMPORTANT:
Depending on the configuration for campaignId
, eligibility checks will be performed either platform-wide
or campaign-wide (see setCampaignStakersEligibility()
)._
Parameters
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted staking campaign. |
account | address | The address of the account to check. |