RegenStakerBase
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:
- Claiming accrued rewards on their behalf
- Compounding rewards to increase stake position (when REWARD_TOKEN == STAKE_TOKEN)
- Contributing unclaimed rewards to approved allocation mechanisms
- 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:
-
security-contact: [email protected]
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
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Duration for reward distribution in seconds |
stakerAllowset
Gets the staker allowset
function stakerAllowset() external view returns (IAddressSet);
Returns
| Name | Type | Description |
|---|---|---|
<none> | IAddressSet | Allowset contract controlling staker access |
stakerBlockset
Gets the staker blockset
function stakerBlockset() external view returns (IAddressSet);
Returns
| Name | Type | Description |
|---|---|---|
<none> | IAddressSet | Blockset contract defining blocked stakers |
stakerAccessMode
Gets the staker access mode
function stakerAccessMode() external view returns (AccessMode);
Returns
| Name | Type | Description |
|---|---|---|
<none> | AccessMode | Current access control mode (NONE, ALLOWSET, or BLOCKSET) |
allocationMechanismAllowset
Gets the allocation mechanism allowset
function allocationMechanismAllowset() external view returns (IAddressSet);
Returns
| Name | Type | Description |
|---|---|---|
<none> | IAddressSet | Allowset contract defining approved allocation mechanisms |
minimumStakeAmount
Gets the minimum stake amount
function minimumStakeAmount() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Minimum 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
| Name | Type | Description |
|---|---|---|
_rewardsToken | IERC20 | Token distributed as staking rewards |
_stakeToken | IERC20 | Token users stake (must support IERC20Permit) |
_earningPowerCalculator | IEarningPowerCalculator | Contract calculating earning power from stakes |
_maxBumpTip | uint256 | Maximum tip for earning power bumps in reward token base units |
_admin | address | Address with admin permissions |
_rewardDuration | uint128 | Duration for reward distribution in seconds |
_minimumStakeAmount | uint128 | Minimum stake required in stake token base units |
_stakerAllowset | IAddressSet | Allowset contract for ALLOWSET mode (can be address(0)) |
_stakerBlockset | IAddressSet | Blockset contract for BLOCKSET mode (can be address(0)) |
_stakerAccessMode | AccessMode | Initial access control mode (NONE, ALLOWSET, or BLOCKSET) |
_allocationMechanismAllowset | IAddressSet | Allowset of approved allocation mechanisms (cannot be address(0)) |
_eip712Name | string | EIP712 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
| Name | Type | Description |
|---|---|---|
_rewardDuration | uint128 | Duration for reward distribution in seconds |
_minimumStakeAmount | uint128 | Minimum stake required in stake token base units |
_stakerAllowset | IAddressSet | Allowset contract for ALLOWSET mode (can be address(0)) |
_stakerBlockset | IAddressSet | Blockset contract for BLOCKSET mode (can be address(0)) |
_stakerAccessMode | AccessMode | Initial access control mode (NONE, ALLOWSET, or BLOCKSET) |
_allocationMechanismAllowset | IAddressSet | Allowset 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
| Name | Type | Description |
|---|---|---|
_rewardDuration | uint128 | New 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
| Name | Type | Description |
|---|---|---|
_amount | uint256 | Reward amount to notify in reward token base units |
_requiredBalance | uint256 | Required 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
| Name | Type | Description |
|---|---|---|
_stakerAllowset | IAddressSet | New 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
| Name | Type | Description |
|---|---|---|
_stakerBlockset | IAddressSet | New 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
| Name | Type | Description |
|---|---|---|
_mode | AccessMode | New 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
| Name | Type | Description |
|---|---|---|
_allocationMechanismAllowset | IAddressSet | New 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
| Name | Type | Description |
|---|---|---|
_minimumStakeAmount | uint128 | New 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
| Name | Type | Description |
|---|---|---|
_newMaxBumpTip | uint256 | New 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
| Name | Type | Description |
|---|---|---|
_depositId | DepositIdentifier | Deposit identifier to contribute from |
_allocationMechanismAddress | address | Approved allocation mechanism to receive contribution |
_amount | uint256 | Amount of unclaimed rewards to contribute (must be <= available rewards) |
_deadline | uint256 | Signature expiration timestamp |
_v | uint8 | Signature component v |
_r | bytes32 | Signature component r |
_s | bytes32 | Signature component s |
Returns
| Name | Type | Description |
|---|---|---|
amountContributedToAllocationMechanism | uint256 | Actual 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
| Name | Type | Description |
|---|---|---|
_depositId | DepositIdentifier | Deposit to compound rewards for |
Returns
| Name | Type | Description |
|---|---|---|
compoundedAmount | uint256 | Amount 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
| Name | Type | Description |
|---|---|---|
_depositId | DepositIdentifier | Deposit 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
| Name | Type | Description |
|---|---|---|
_deposit | Deposit | Deposit storage reference to update |
_amount | uint256 | Amount 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
| Name | Type | Description |
|---|---|---|
_depositor | address | Address making the deposit |
_amount | uint256 | Amount to stake |
_delegatee | address | Address to receive voting power delegation |
_claimer | address | Address authorized to claim rewards |
Returns
| Name | Type | Description |
|---|---|---|
_depositId | DepositIdentifier | Deposit 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
| Name | Type | Description |
|---|---|---|
deposit | Deposit | Deposit storage reference |
_depositId | DepositIdentifier | Deposit identifier |
_amount | uint256 | Amount 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
| Name | Type | Description |
|---|---|---|
deposit | Deposit | Deposit storage reference |
_depositId | DepositIdentifier | Deposit identifier |
_newDelegatee | address | Address 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
| Name | Type | Description |
|---|---|---|
deposit | Deposit | Deposit storage reference |
_depositId | DepositIdentifier | Deposit identifier |
_newClaimer | address | Address 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
| Name | Type | Description |
|---|---|---|
_depositId | DepositIdentifier | Deposit identifier |
deposit | Deposit | Deposit storage reference |
_claimer | address | Address authorized to claim rewards |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Claimed 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
| Name | Type | Description |
|---|---|---|
_amount | uint256 | Reward 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
| Name | Type | Description |
|---|---|---|
_amount | uint256 | Reward amount in reward token base units being added |
Returns
| Name | Type | Description |
|---|---|---|
required | uint256 | Required 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
| Name | Type | Description |
|---|---|---|
deposit | Deposit | Deposit storage reference |
_depositId | DepositIdentifier | Deposit identifier |
_amount | uint256 | Additional 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
| Name | Type | Description |
|---|---|---|
_depositId | DepositIdentifier | Deposit identifier to bump earning power for |
_tipReceiver | address | Address receiving tip for updating earning power |
_requestedTip | uint256 | Tip amount requested in reward token base units |
Events
StakerAllowsetAssigned
Emitted when the staker allowset is updated
event StakerAllowsetAssigned(IAddressSet indexed allowset);
Parameters
| Name | Type | Description |
|---|---|---|
allowset | IAddressSet | Address of new allowset contract controlling staker access |
StakerBlocksetAssigned
Emitted when the staker blockset is updated
event StakerBlocksetAssigned(IAddressSet indexed blockset);
Parameters
| Name | Type | Description |
|---|---|---|
blockset | IAddressSet | Address of new blockset contract defining blocked stakers |
AccessModeSet
Emitted when staker access mode is changed
event AccessModeSet(AccessMode indexed mode);
Parameters
| Name | Type | Description |
|---|---|---|
mode | AccessMode | New access control mode (NONE, ALLOWSET, or BLOCKSET) |
AllocationMechanismAllowsetAssigned
Emitted when the allocation mechanism allowset is updated
event AllocationMechanismAllowsetAssigned(IAddressSet indexed allowset);
Parameters
| Name | Type | Description |
|---|---|---|
allowset | IAddressSet | Address of new allowset contract defining approved mechanisms |
RewardDurationSet
Emitted when the reward duration is updated
event RewardDurationSet(uint256 newDuration);
Parameters
| Name | Type | Description |
|---|---|---|
newDuration | uint256 | New 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
| Name | Type | Description |
|---|---|---|
addedAmount | uint256 | Newly supplied reward amount for this cycle |
carryOverAmount | uint256 | Unclaimed rewards carried over into the new cycle |
totalScheduledAmount | uint256 | Total rewards scheduled for distribution this cycle |
requiredBalance | uint256 | Total balance the contract must hold after notification |
duration | uint256 | Duration over which the rewards will stream |
endTime | uint256 | Timestamp 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
| Name | Type | Description |
|---|---|---|
depositId | DepositIdentifier | Deposit being used for contribution |
contributor | address | Address making the contribution (receives voting power) |
fundingRound | address | Allocation mechanism receiving the contribution |
amount | uint256 | Contribution amount in reward token base units |
MinimumStakeAmountSet
Emitted when the minimum stake amount is updated
event MinimumStakeAmountSet(uint256 newMinimumStakeAmount);
Parameters
| Name | Type | Description |
|---|---|---|
newMinimumStakeAmount | uint256 | New minimum stake required in stake token base units |
Errors
StakerNotAllowed
error StakerNotAllowed(address user);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Address that failed allowset check |
StakerBlocked
error StakerBlocked(address user);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Address found in blockset |
DepositOwnerNotEligibleForMechanism
error DepositOwnerNotEligibleForMechanism(address mechanism, address owner);
Parameters
| Name | Type | Description |
|---|---|---|
mechanism | address | Allocation mechanism that rejected contributor |
owner | address | Deposit owner attempting contribution |
InsufficientRewardBalance
error InsufficientRewardBalance(uint256 currentBalance, uint256 required);
Parameters
| Name | Type | Description |
|---|---|---|
currentBalance | uint256 | Actual token balance in contract (in token base units) |
required | uint256 | Minimum balance needed for totalStaked plus reward amount (in token base units) |
CantAfford
error CantAfford(uint256 requested, uint256 available);
Parameters
| Name | Type | Description |
|---|---|---|
requested | uint256 | Requested amount in token base units |
available | uint256 | Available amount in token base units |
MinimumStakeAmountNotMet
error MinimumStakeAmountNotMet(uint256 expected, uint256 actual);
Parameters
| Name | Type | Description |
|---|---|---|
expected | uint256 | Minimum stake amount required in token base units |
actual | uint256 | Actual stake amount provided in token base units |
InvalidRewardDuration
error InvalidRewardDuration(uint256 rewardDuration);
Parameters
| Name | Type | Description |
|---|---|---|
rewardDuration | uint256 | Invalid 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
| Name | Type | Description |
|---|---|---|
expected | address | Address of REWARD_TOKEN |
actual | address | Address of token expected by allocation mechanism |
SurrogateNotFound
error SurrogateNotFound(address delegatee);
Parameters
| Name | Type | Description |
|---|---|---|
delegatee | address | Address 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;
}