Skip to main content

RegenStakerBase

Git Source

Inherits: Staker, Pausable, ReentrancyGuard, EIP712, StakerPermitAndStake, StakerOnBehalf

Author: Golem Foundation

Base contract for RegenStaker variants, extending the Staker contract by ScopeLift.

Provides shared functionality including:

  • Variable reward duration (7-3000 days, configurable by admin)
  • Earning power management with external bumping incentivized by tips (up to maxBumpTip)
  • Adjustable minimum stake amount (existing deposits grandfathered with restrictions)
  • Access control for stakers and allocation mechanisms
  • Reward compounding (when REWARD_TOKEN == STAKE_TOKEN)
  • Reward contribution to approved allocation mechanisms
  • Admin controls (pause/unpause, config updates)

Token requirements: STAKE_TOKEN and REWARD_TOKEN must be standard ERC-20 tokens. Unsupported token behaviors include fee-on-transfer/deflationary mechanisms, rebasing, or non-standard return values. Accounting assumes transferred amount equals requested amount; non-standard tokens can break deposits, withdrawals, or reward accounting.

WITHDRAWAL PROTECTION: Users can always withdraw their staked tokens, even when the contract is paused. The pause functionality affects all other operations (stake, claim, contribute, compound) but explicitly excludes withdrawals to preserve user access to their principal funds. This design ensures emergency pause can halt new deposits and reward operations while maintaining user control over their staked assets at all times.

CLAIMER PERMISSION MODEL: Claimers are trusted entities designated by deposit owners with specific permissions: Permission Matrix: ┌─────────────────────────┬──────────┬─────────┐ │ Operation │ Owner │ Claimer │ ├─────────────────────────┼──────────┼─────────┤ │ Claim rewards │ ✓ │ ✓ │ │ Compound rewards† │ ✓ │ ✓ │ │ Contribute to public‡ │ ✓ │ ✓ │ │ Stake more │ ✓ │ ✗ │ │ Withdraw │ ✓ │ ✗ │ │ Alter delegatee │ ✓ │ ✗ │ │ Alter claimer │ ✓ │ ✗ │ └─────────────────────────┴──────────┴─────────┘

  • Compounding increases deposit stake (intended behavior) † Compounding requires deposit owner to pass stakerAccessMode checks (allowset/blockset enforcement) ‡ Mechanism must be on allocationMechanismAllowset; contributor checked via mechanism's contributionAllowset § VOTING POWER: The contributor (msg.sender) receives voting power in the allocation mechanism, NOT the deposit owner. When a claimer contributes, the claimer gets voting power. When designating a claimer, owners explicitly trust them with:
  1. Claiming accrued rewards on their behalf
  2. Compounding rewards to increase stake position (when REWARD_TOKEN == STAKE_TOKEN)
  3. Contributing unclaimed rewards to approved allocation mechanisms
  4. Receiving voting power in allocation mechanisms when they contribute (claimer gets voting power, not owner) Security boundaries are maintained:
  • Claimers cannot withdraw principal or rewards to arbitrary addresses
  • Claimers cannot modify deposit parameters
  • Owners can revoke claimer designation at any time via alterClaimer()*

Integer division causes ~1 wei precision loss, negligible due to SCALE_FACTOR (1e36).

This base is abstract, with variants implementing token-specific behaviors (e.g., delegation surrogates).

Earning power updates are required after balance changes; some are automatic, others via bumpEarningPower.

Notes:

State Variables

MIN_REWARD_DURATION

Minimum allowed reward duration in seconds (7 days).

uint256 public constant MIN_REWARD_DURATION = 7 days;

MAX_REWARD_DURATION

Maximum allowed reward duration to prevent excessively long reward periods.

uint256 public constant MAX_REWARD_DURATION = 3000 days;

sharedState

Shared configuration state instance

Internal storage for shared configuration accessible via getters.

SharedState internal sharedState;

totalRewards

Tracks the total amount of rewards that have been added via notifyRewardAmount

This accumulates all reward amounts ever added to the contract

uint256 public totalRewards;

totalClaimedRewards

Tracks the total amount of rewards that have been consumed by users

This includes claims, compounding, contributions, and tips

uint256 public totalClaimedRewards;

latestRewardSchedule

Cached metadata for the most recent reward schedule.

RewardSchedule public latestRewardSchedule;

Functions

rewardDuration

Gets the current reward duration

function rewardDuration() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Duration for reward distribution in seconds

stakerAllowset

Gets the staker allowset

function stakerAllowset() external view returns (IAddressSet);

Returns

NameTypeDescription
<none>IAddressSetAllowset contract controlling staker access

stakerBlockset

Gets the staker blockset

function stakerBlockset() external view returns (IAddressSet);

Returns

NameTypeDescription
<none>IAddressSetBlockset contract defining blocked stakers

stakerAccessMode

Gets the staker access mode

function stakerAccessMode() external view returns (AccessMode);

Returns

NameTypeDescription
<none>AccessModeCurrent access control mode (NONE, ALLOWSET, or BLOCKSET)

allocationMechanismAllowset

Gets the allocation mechanism allowset

function allocationMechanismAllowset() external view returns (IAddressSet);

Returns

NameTypeDescription
<none>IAddressSetAllowset contract defining approved allocation mechanisms

minimumStakeAmount

Gets the minimum stake amount

function minimumStakeAmount() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Minimum stake required in stake token base units

constructor

Constructor for RegenStakerBase

Initializes Staker, extensions, and shared state

constructor(
IERC20 _rewardsToken,
IERC20 _stakeToken,
IEarningPowerCalculator _earningPowerCalculator,
uint256 _maxBumpTip,
address _admin,
uint128 _rewardDuration,
uint128 _minimumStakeAmount,
IAddressSet _stakerAllowset,
IAddressSet _stakerBlockset,
AccessMode _stakerAccessMode,
IAddressSet _allocationMechanismAllowset,
string memory _eip712Name
)
Staker(_rewardsToken, _stakeToken, _earningPowerCalculator, _maxBumpTip, _admin)
StakerPermitAndStake(IERC20Permit(address(_stakeToken)))
EIP712(_eip712Name, "1");

Parameters

NameTypeDescription
_rewardsTokenIERC20Token distributed as staking rewards
_stakeTokenIERC20Token users stake (must support IERC20Permit)
_earningPowerCalculatorIEarningPowerCalculatorContract calculating earning power from stakes
_maxBumpTipuint256Maximum tip for earning power bumps in reward token base units
_adminaddressAddress with admin permissions
_rewardDurationuint128Duration for reward distribution in seconds
_minimumStakeAmountuint128Minimum stake required in stake token base units
_stakerAllowsetIAddressSetAllowset contract for ALLOWSET mode (can be address(0))
_stakerBlocksetIAddressSetBlockset contract for BLOCKSET mode (can be address(0))
_stakerAccessModeAccessModeInitial access control mode (NONE, ALLOWSET, or BLOCKSET)
_allocationMechanismAllowsetIAddressSetAllowset of approved allocation mechanisms (cannot be address(0))
_eip712NamestringEIP712 domain name for signature verification

_initializeSharedState

Initialize shared state with validation

Called by child constructors to set up shared configuration

function _initializeSharedState(
uint128 _rewardDuration,
uint128 _minimumStakeAmount,
IAddressSet _stakerAllowset,
IAddressSet _stakerBlockset,
AccessMode _stakerAccessMode,
IAddressSet _allocationMechanismAllowset
) internal;

Parameters

NameTypeDescription
_rewardDurationuint128Duration for reward distribution in seconds
_minimumStakeAmountuint128Minimum stake required in stake token base units
_stakerAllowsetIAddressSetAllowset contract for ALLOWSET mode (can be address(0))
_stakerBlocksetIAddressSetBlockset contract for BLOCKSET mode (can be address(0))
_stakerAccessModeAccessModeInitial access control mode (NONE, ALLOWSET, or BLOCKSET)
_allocationMechanismAllowsetIAddressSetAllowset of approved allocation mechanisms

setRewardDuration

Sets the reward duration for future reward notifications

GAS IMPLICATIONS: Shorter reward durations may result in higher gas costs for certain operations due to more frequent reward rate calculations. Consider gas costs when selecting reward durations.

Can only be called by admin and not during active reward period

function setRewardDuration(uint128 _rewardDuration) external;

Parameters

NameTypeDescription
_rewardDurationuint128New reward duration in seconds (7 days minimum, 3000 days maximum)

_notifyRewardAmountWithCustomDuration

Internal implementation of notifyRewardAmount using custom reward duration

Overrides the base Staker logic to use variable duration

Enforces monotonic reward property: totalRewards can only increase, never decrease. Once rewards are notified and time has elapsed, those elapsed portions cannot be clawed back. Admins can adjust future reward rates by notifying new amounts, but the current schedule represents a commitment for its duration and typically won't be changed mid-cycle.

function _notifyRewardAmountWithCustomDuration(uint256 _amount, uint256 _requiredBalance) internal;

Parameters

NameTypeDescription
_amountuint256Reward amount to notify in reward token base units
_requiredBalanceuint256Required contract balance calculated by variant-specific validation

setStakerAllowset

Sets the allowset for stakers (who can stake tokens)

OPERATIONAL IMPACT: Affects all stake and stakeMore operations immediately.

GRANDFATHERING: Existing stakers can continue operations regardless of new allowset.

Can only be called by admin

NOTE: Use setAccessMode(AccessMode.NONE) to disable access control, not address(0)

function setStakerAllowset(IAddressSet _stakerAllowset) external;

Parameters

NameTypeDescription
_stakerAllowsetIAddressSetNew staker allowset contract

setStakerBlockset

Sets the staker blockset

OPERATIONAL IMPACT: Affects all stake operations immediately.

Can only be called by admin

NOTE: Use setAccessMode(AccessMode.NONE) to disable access control, not address(0)

function setStakerBlockset(IAddressSet _stakerBlockset) external;

Parameters

NameTypeDescription
_stakerBlocksetIAddressSetNew staker blockset contract

setAccessMode

Sets the staker access mode

OPERATIONAL IMPACT: Changes which address set (allowset/blockset) is active

Can only be called by admin

function setAccessMode(AccessMode _mode) external;

Parameters

NameTypeDescription
_modeAccessModeNew access mode (NONE, ALLOWSET, or BLOCKSET)

setAllocationMechanismAllowset

Sets the allowset for allocation mechanisms

SECURITY: Only add thoroughly audited allocation mechanisms to this allowset. Users will contribute rewards to approved mechanisms and funds cannot be recovered if sent to malicious or buggy implementations.

EVALUATION PROCESS: New mechanisms should undergo comprehensive security audit, integration testing, and governance review before approval.

OPERATIONAL IMPACT: Changes affect all future contributions. Existing contributions to previously approved mechanisms are not affected.

Can only be called by admin. Cannot set to address(0).

AUDIT NOTE: Changes require governance approval.

function setAllocationMechanismAllowset(IAddressSet _allocationMechanismAllowset) external;

Parameters

NameTypeDescription
_allocationMechanismAllowsetIAddressSetNew allowset contract (cannot be address(0))

setMinimumStakeAmount

Sets the minimum stake amount

GRANDFATHERING: Existing deposits below new minimum remain valid but will be restricted from partial withdrawals and stakeMore operations until brought above threshold.

TIMING RESTRICTION: Cannot raise minimum during active reward period for user protection.

OPERATIONAL IMPACT: Affects all new stakes immediately. Consider user communication before changes.

Can only be called by admin

function setMinimumStakeAmount(uint128 _minimumStakeAmount) external;

Parameters

NameTypeDescription
_minimumStakeAmountuint128New minimum stake amount in wei (0 = no minimum)

setMaxBumpTip

Sets the maximum bump tip with governance protection

TIMING RESTRICTION: During active reward period only decreases are allowed; increases must wait until after rewardEndTime.

SECURITY: Prevents malicious admin from extracting unclaimed rewards via tip manipulation.

GOVERNANCE PROTECTION: Aligns with setMinimumStakeAmount protection for consistency.

Can only be called by admin and not during active reward period

function setMaxBumpTip(uint256 _newMaxBumpTip) external virtual override;

Parameters

NameTypeDescription
_newMaxBumpTipuint256New maximum bump tip value in wei

pause

Pauses the contract, disabling user operations except withdrawals and view functions

EMERGENCY USE: Intended for security incidents or critical maintenance.

SCOPE: Affects stake, claim, contribute, and compound operations.

USER PROTECTION: Withdrawals remain enabled to preserve user access to their funds.

ADMIN ONLY: Only admin can pause. Use emergency procedures for urgent situations.

function pause() external whenNotPaused;

unpause

Unpauses the contract, re-enabling all user operations

RECOVERY: Use after resolving issues that required pause.

ADMIN ONLY: Only admin can unpause. Ensure all issues resolved before unpause.

function unpause() external whenPaused;

contribute

Contributes unclaimed rewards to a user-specified allocation mechanism

CONTRIBUTION RISK: Contributed funds are transferred to external allocation mechanisms for public good causes. Malicious mechanisms may misappropriate funds for unintended purposes rather than the stated public good cause.

TRUST MODEL: Allocation mechanisms must be approved by protocol governance. Only contribute to mechanisms you trust, as the protocol cannot recover funds sent to malicious or buggy allocation mechanisms.

VOTING POWER ASSIGNMENT: The contributor (msg.sender) receives voting power in the allocation mechanism, NOT necessarily the deposit owner. When a claimer contributes owner's rewards, the CLAIMER receives the voting power. This is intended behavior as part of the claimer trust model.

SECURITY: This function first withdraws rewards to the contributor, then the contributor must have pre-approved the allocation mechanism to pull the tokens.

SECURITY AUDIT: Ensure allocation mechanisms are immutable after approval.

AUTHZ: Authorized caller is the deposit owner or the designated claimer; the claimer acts as the owner's agent for rewards. Contribution access control enforced by mechanism.

Requires contract not paused and uses reentrancy guard

function contribute(
DepositIdentifier _depositId,
address _allocationMechanismAddress,
uint256 _amount,
uint256 _deadline,
uint8 _v,
bytes32 _r,
bytes32 _s
) public virtual whenNotPaused nonReentrant returns (uint256 amountContributedToAllocationMechanism);

Parameters

NameTypeDescription
_depositIdDepositIdentifierDeposit identifier to contribute from
_allocationMechanismAddressaddressApproved allocation mechanism to receive contribution
_amountuint256Amount of unclaimed rewards to contribute (must be <= available rewards)
_deadlineuint256Signature expiration timestamp
_vuint8Signature component v
_rbytes32Signature component r
_sbytes32Signature component s

Returns

NameTypeDescription
amountContributedToAllocationMechanismuint256Actual amount contributed

compoundRewards

Compounds rewards by claiming them and immediately restaking them into the same deposit

REQUIREMENT: Only works when REWARD_TOKEN == STAKE_TOKEN, otherwise reverts.

EARNING POWER: Compounding updates earning power based on new total balance.

GAS OPTIMIZATION: More efficient than separate claim + stake operations.

CLAIMER PERMISSIONS: This function grants claimers the ability to increase deposit stakes through compounding. This is INTENDED BEHAVIOR - when an owner designates a claimer, they explicitly trust them with both reward claiming AND limited staking operations (compounding). Claimers cannot withdraw funds or alter deposit parameters, maintaining security boundaries.

STAKER ACCESS: The deposit OWNER (not the caller/claimer) must pass stakerAccessMode checks. If ALLOWSET mode active, owner must be in allowset. If BLOCKSET mode active, owner must not be in blockset. Claimer's access status is not checked.

Requires contract not paused and uses reentrancy guard

function compoundRewards(DepositIdentifier _depositId)
external
virtual
whenNotPaused
nonReentrant
returns (uint256 compoundedAmount);

Parameters

NameTypeDescription
_depositIdDepositIdentifierDeposit to compound rewards for

Returns

NameTypeDescription
compoundedAmountuint256Amount of rewards compounded (returns 0 if no unclaimed rewards available)

_revertIfMinimumStakeAmountNotMet

Internal helper to check minimum stake amount

Reverts if balance is below minimum and not zero Exception: Zero balance is allowed (permits full withdrawal to 0)

function _revertIfMinimumStakeAmountNotMet(DepositIdentifier _depositId) internal view;

Parameters

NameTypeDescription
_depositIdDepositIdentifierDeposit to check eligibility for

_checkStakerAccess

function _checkStakerAccess(address user) internal view;

_consumeRewards

Atomically updates deposit checkpoint and totalClaimedRewards

Ensures consistent state updates when rewards are consumed

function _consumeRewards(Deposit storage _deposit, uint256 _amount) internal;

Parameters

NameTypeDescription
_depositDepositDeposit storage reference to update
_amountuint256Amount of rewards being claimed

_checkpointGlobalReward

Pauses reward streaming during idle windows (when totalEarningPower == 0) by extending rewardEndTime by the idle duration; no rewards accrue while idle.

When earning power is non-zero, accrues rewardPerTokenAccumulatedCheckpoint as usual.

function _checkpointGlobalReward() internal virtual override;

_stake

Prevents staking 0, staking below the minimum, staking when paused, and unauthorized staking.

Uses reentrancy guard

function _stake(address _depositor, uint256 _amount, address _delegatee, address _claimer)
internal
virtual
override
whenNotPaused
nonReentrant
returns (DepositIdentifier _depositId);

Parameters

NameTypeDescription
_depositoraddressAddress making the deposit
_amountuint256Amount to stake
_delegateeaddressAddress to receive voting power delegation
_claimeraddressAddress authorized to claim rewards

Returns

NameTypeDescription
_depositIdDepositIdentifierDeposit identifier for the created deposit

_withdraw

Prevents withdrawing 0; prevents withdrawals that drop balance below minimum.

USER PROTECTION: Withdrawals remain enabled even when contract is paused to ensure users can always access their principal funds.

Uses reentrancy guard

function _withdraw(Deposit storage deposit, DepositIdentifier _depositId, uint256 _amount)
internal
virtual
override
nonReentrant;

Parameters

NameTypeDescription
depositDepositDeposit storage reference
_depositIdDepositIdentifierDeposit identifier
_amountuint256Amount to withdraw

_alterDelegatee

Overrides to add reentrancy protection.

Uses reentrancy guard

function _alterDelegatee(Deposit storage deposit, DepositIdentifier _depositId, address _newDelegatee)
internal
virtual
override
whenNotPaused
nonReentrant;

Parameters

NameTypeDescription
depositDepositDeposit storage reference
_depositIdDepositIdentifierDeposit identifier
_newDelegateeaddressAddress to receive voting power delegation

_alterClaimer

Overrides to add reentrancy protection.

Uses reentrancy guard

function _alterClaimer(Deposit storage deposit, DepositIdentifier _depositId, address _newClaimer)
internal
virtual
override
whenNotPaused
nonReentrant;

Parameters

NameTypeDescription
depositDepositDeposit storage reference
_depositIdDepositIdentifierDeposit identifier
_newClaimeraddressAddress authorized to claim rewards

_claimReward

Overrides to add pause protection and track totalClaimedRewards for balance validation

Reuses base Staker logic (with fee=0) and adds totalClaimedRewards tracking

nonReentrant protects against reentrancy despite updating totalClaimedRewards after transfer

function _claimReward(DepositIdentifier _depositId, Deposit storage deposit, address _claimer)
internal
virtual
override
whenNotPaused
nonReentrant
returns (uint256);

Parameters

NameTypeDescription
_depositIdDepositIdentifierDeposit identifier
depositDepositDeposit storage reference
_claimeraddressAddress authorized to claim rewards

Returns

NameTypeDescription
&lt;none&gt;uint256Claimed amount in reward token base units

notifyRewardAmount

Override notifyRewardAmount to use custom reward duration

nonReentrant as a belts-and-braces guard against exotic ERC20 callback reentry

function notifyRewardAmount(uint256 _amount) external virtual override nonReentrant;

Parameters

NameTypeDescription
_amountuint256Reward amount in reward token base units

_validateAndGetRequiredBalance

Validates sufficient reward token balance and returns the required balance

Virtual function allowing variants to implement appropriate balance checks

function _validateAndGetRequiredBalance(uint256 _amount) internal view virtual returns (uint256 required);

Parameters

NameTypeDescription
_amountuint256Reward amount in reward token base units being added

Returns

NameTypeDescription
requireduint256Required balance for this variant in reward token base units

_stakeMore

Prevents staking more when paused or by unauthorized owners; ensures non-zero amount and final balance meets minimum.

Uses reentrancy guard; validates deposit.owner against staker access control before proceeding

function _stakeMore(Deposit storage deposit, DepositIdentifier _depositId, uint256 _amount)
internal
virtual
override
whenNotPaused
nonReentrant;

Parameters

NameTypeDescription
depositDepositDeposit storage reference
_depositIdDepositIdentifierDeposit identifier
_amountuint256Additional stake amount in stake token base units

bumpEarningPower

Override to add nonReentrant modifier and fix checks-effects-interactions pattern

Adds reentrancy protection and corrects state update ordering

Updates state BEFORE external transfer to prevent reentrancy vulnerabilities

function bumpEarningPower(DepositIdentifier _depositId, address _tipReceiver, uint256 _requestedTip)
public
virtual
override
whenNotPaused
nonReentrant;

Parameters

NameTypeDescription
_depositIdDepositIdentifierDeposit identifier to bump earning power for
_tipReceiveraddressAddress receiving tip for updating earning power
_requestedTipuint256Tip amount requested in reward token base units

Events

StakerAllowsetAssigned

Emitted when the staker allowset is updated

event StakerAllowsetAssigned(IAddressSet indexed allowset);

Parameters

NameTypeDescription
allowsetIAddressSetAddress of new allowset contract controlling staker access

StakerBlocksetAssigned

Emitted when the staker blockset is updated

event StakerBlocksetAssigned(IAddressSet indexed blockset);

Parameters

NameTypeDescription
blocksetIAddressSetAddress of new blockset contract defining blocked stakers

AccessModeSet

Emitted when staker access mode is changed

event AccessModeSet(AccessMode indexed mode);

Parameters

NameTypeDescription
modeAccessModeNew access control mode (NONE, ALLOWSET, or BLOCKSET)

AllocationMechanismAllowsetAssigned

Emitted when the allocation mechanism allowset is updated

event AllocationMechanismAllowsetAssigned(IAddressSet indexed allowset);

Parameters

NameTypeDescription
allowsetIAddressSetAddress of new allowset contract defining approved mechanisms

RewardDurationSet

Emitted when the reward duration is updated

event RewardDurationSet(uint256 newDuration);

Parameters

NameTypeDescription
newDurationuint256New duration for reward distribution in seconds

RewardScheduleUpdated

Emitted when a new reward schedule is created or updated.

event RewardScheduleUpdated(
uint256 addedAmount,
uint256 carryOverAmount,
uint256 totalScheduledAmount,
uint256 requiredBalance,
uint256 duration,
uint256 endTime
);

Parameters

NameTypeDescription
addedAmountuint256Newly supplied reward amount for this cycle
carryOverAmountuint256Unclaimed rewards carried over into the new cycle
totalScheduledAmountuint256Total rewards scheduled for distribution this cycle
requiredBalanceuint256Total balance the contract must hold after notification
durationuint256Duration over which the rewards will stream
endTimeuint256Timestamp when the reward cycle is scheduled to end

RewardContributed

Emitted when rewards are contributed to an allocation mechanism

event RewardContributed(
DepositIdentifier indexed depositId, address indexed contributor, address indexed fundingRound, uint256 amount
);

Parameters

NameTypeDescription
depositIdDepositIdentifierDeposit being used for contribution
contributoraddressAddress making the contribution (receives voting power)
fundingRoundaddressAllocation mechanism receiving the contribution
amountuint256Contribution amount in reward token base units

MinimumStakeAmountSet

Emitted when the minimum stake amount is updated

event MinimumStakeAmountSet(uint256 newMinimumStakeAmount);

Parameters

NameTypeDescription
newMinimumStakeAmountuint256New minimum stake required in stake token base units

Errors

StakerNotAllowed

error StakerNotAllowed(address user);

Parameters

NameTypeDescription
useraddressAddress that failed allowset check

StakerBlocked

error StakerBlocked(address user);

Parameters

NameTypeDescription
useraddressAddress found in blockset

DepositOwnerNotEligibleForMechanism

error DepositOwnerNotEligibleForMechanism(address mechanism, address owner);

Parameters

NameTypeDescription
mechanismaddressAllocation mechanism that rejected contributor
owneraddressDeposit owner attempting contribution

InsufficientRewardBalance

error InsufficientRewardBalance(uint256 currentBalance, uint256 required);

Parameters

NameTypeDescription
currentBalanceuint256Actual token balance in contract (in token base units)
requireduint256Minimum balance needed for totalStaked plus reward amount (in token base units)

CantAfford

error CantAfford(uint256 requested, uint256 available);

Parameters

NameTypeDescription
requesteduint256Requested amount in token base units
availableuint256Available amount in token base units

MinimumStakeAmountNotMet

error MinimumStakeAmountNotMet(uint256 expected, uint256 actual);

Parameters

NameTypeDescription
expecteduint256Minimum stake amount required in token base units
actualuint256Actual stake amount provided in token base units

InvalidRewardDuration

error InvalidRewardDuration(uint256 rewardDuration);

Parameters

NameTypeDescription
rewardDurationuint256Invalid duration value in seconds

CannotChangeRewardDurationDuringActiveReward

error CannotChangeRewardDurationDuringActiveReward();

CompoundingNotSupported

error CompoundingNotSupported();

CannotRaiseMinimumStakeAmountDuringActiveReward

error CannotRaiseMinimumStakeAmountDuringActiveReward();

CannotRaiseMaxBumpTipDuringActiveReward

error CannotRaiseMaxBumpTipDuringActiveReward();

ZeroOperation

error ZeroOperation();

NoOperation

error NoOperation();

DisablingAllocationMechanismAllowsetNotAllowed

error DisablingAllocationMechanismAllowsetNotAllowed();

AssetMismatch

error AssetMismatch(address expected, address actual);

Parameters

NameTypeDescription
expectedaddressAddress of REWARD_TOKEN
actualaddressAddress of token expected by allocation mechanism

SurrogateNotFound

error SurrogateNotFound(address delegatee);

Parameters

NameTypeDescription
delegateeaddressAddress for which surrogate should exist but doesn't

Structs

SharedState

Struct to hold shared configuration state

Groups related configuration variables for better storage efficiency and easier inheritance.

struct SharedState {
uint128 rewardDuration;
uint128 minimumStakeAmount;
IAddressSet stakerAllowset;
IAddressSet allocationMechanismAllowset;
IAddressSet stakerBlockset;
AccessMode stakerAccessMode;
}

RewardSchedule

Summary of the most recently scheduled reward cycle.

Tracks both the new amount and any carried-over rewards for analytics and UX.

struct RewardSchedule {
uint256 addedAmount;
uint256 carryOverAmount;
uint256 totalScheduledAmount;
uint256 requiredBalance;
uint256 duration;
uint256 endTime;
}