Staking ProtocoleligibilityFacetsstakersEligibilitywhitelistedStakers

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

event StakersEligibilityConfigured(uint256 campaignId, bool isCampaignScoped, bytes32[] eligibleRoles)

Emitted at setCampaignStakersEligibility().

setCampaignStakersEligibility

function setCampaignStakersEligibility(uint256 campaignId, bytes campaignStakersEligibilityData) external

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-encoded eligibleRoles array via grantRole() or grantRoleMultiple(). 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-encoded eligibleRoles array via grantRoleForId() or grantRoleMultipleForId() for the specified campaignId. Thus checks for eligible roles will be performed campaign-wide.

  • See AccessControlStakingFacet.sol for information about role-based access control. ----------------------------------------------------------------------------------------------------------------_

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
campaignStakersEligibilityDatabytesThe 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

function checkStakersEligibility(uint256 campaignId, address account) external view

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

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
accountaddressThe address of the account to check.

On this page