RegenStakerWithoutDelegateSurrogateVotes
Inherits: RegenStakerBase
Title: RegenStakerWithoutDelegateSurrogateVotes
Author: Golem Foundation
Variant of RegenStakerBase for regular ERC20 tokens without delegation support.
Eliminates surrogate pattern; tokens are held directly by this contract.
DELEGATION LIMITATION: Delegatee is tracked for compatibility but has no effect on token delegation.
VARIANT COMPARISON: (See RegenStaker.sol for the delegation variant)
| Feature | RegenStaker | RegenStakerWithoutDelegateSurrogateVotes |
|---|---|---|
| Delegation Support | Full Support | No Support |
| Surrogate Deployment | Per Delegatee | Contract as Surrogate |
| Token Holder | Surrogates | Contract Directly |
| Voting Capability | via Surrogate | Not Available |
| Gas Cost (First Delegatee) | Higher | Lower |
| Integration Complexity | Higher | Lower |
VARIANT COMPARISON: See RegenStaker.sol for detailed comparison table.
KEY DIFFERENCES FROM RegenStaker:
- No delegation support: delegatee parameter is informational only
- Lower gas costs: no surrogate contract deployment
- Simpler integration: contract holds tokens directly
- No voting capabilities through delegation
- Same security model: both variants use owner-centric allowset authorization
USE CASE: Choose this variant for simple ERC20 staking without governance requirements.
Notes:
-
security-contact: [email protected]
-
origin: https://github.com/ScopeLift/flexible-voting/blob/master/src/Staker.sol
Functions
constructor
Constructor for the RegenStakerWithoutDelegateSurrogateVotes contract.
constructor(
IERC20 _rewardsToken,
IERC20 _stakeToken,
IEarningPowerCalculator _earningPowerCalculator,
uint256 _maxBumpTip,
address _admin,
uint128 _rewardDuration,
uint128 _minimumStakeAmount,
IAddressSet _stakerAllowset,
IAddressSet _stakerBlockset,
AccessMode _stakerAccessMode,
IAddressSet _allocationMechanismAllowset
)
RegenStakerBase(
_rewardsToken,
_stakeToken,
_earningPowerCalculator,
_maxBumpTip,
_admin,
_rewardDuration,
_minimumStakeAmount,
_stakerAllowset,
_stakerBlockset,
_stakerAccessMode,
_allocationMechanismAllowset,
"RegenStakerWithoutDelegateSurrogateVotes"
);
Parameters
| Name | Type | Description |
|---|---|---|
_rewardsToken | IERC20 | Token distributed as staking rewards |
_stakeToken | IERC20 | ERC20 token users stake (must implement 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 (TRUSTED) |
_rewardDuration | uint128 | Duration for reward distribution in seconds |
_minimumStakeAmount | uint128 | Minimum stake required in stake token base units |
_stakerAllowset | IAddressSet | Allowset for ALLOWSET mode (can be address(0)) |
_stakerBlockset | IAddressSet | Blockset for BLOCKSET mode (can be address(0)) |
_stakerAccessMode | AccessMode | Staker access mode (NONE, ALLOWSET, or BLOCKSET) |
_allocationMechanismAllowset | IAddressSet | Allowset of approved allocation mechanisms (SECURITY CRITICAL) Only audited and trusted allocation mechanisms should be in the allowset. Users contribute funds to these mechanisms and may lose funds if mechanisms are malicious. |
_validateAndGetRequiredBalance
Validates sufficient reward token balance and returns the required balance for this variant
Overrides base to include totalStaked for same-token scenarios since stakes are held in main contract
function _validateAndGetRequiredBalance(uint256 _amount) internal view override returns (uint256 required);
Parameters
| Name | Type | Description |
|---|---|---|
_amount | uint256 | Reward amount being added in reward token base units |
Returns
| Name | Type | Description |
|---|---|---|
required | uint256 | Required balance including appropriate obligations |
surrogates
Returns this contract as the "surrogate" since we hold tokens directly
ARCHITECTURE: This variant uses address(this) as surrogate to eliminate delegation complexity while maintaining compatibility with base Staker contract logic. This allows reuse of all base functionality without deploying separate surrogate contracts.
WARNING: Deviates from standard surrogate pattern. Always returns address(this). Integrators expecting separate surrogate contracts will fail. Do not assume external surrogate contracts exist when integrating with this variant.
function surrogates(
address /* _delegatee */
)
public
view
override
returns (DelegationSurrogate);
_fetchOrDeploySurrogate
Returns this contract as the "surrogate" - no separate contracts needed
SIMPLIFICATION: Eliminates need for complex token transfer overrides
function _fetchOrDeploySurrogate(
address /* _delegatee */
)
internal
view
override
returns (DelegationSurrogate);
_stakeTokenSafeTransferFrom
Override to support withdrawals when this contract acts as its own surrogate
Since this contract uses address(this) as surrogate, use safeTransfer for contract-to-user paths.
function _stakeTokenSafeTransferFrom(address _from, address _to, uint256 _value) internal override;
_alterDelegatee
Delegation changes are not supported in this variant
Always reverts since this contract doesn't use delegation surrogates - always uses address(this)
Both alterDelegatee() and alterDelegateeOnBehalf() call this internal function
function _alterDelegatee(Deposit storage, DepositIdentifier, address) internal pure override;
Errors
DelegationNotSupported
error DelegationNotSupported();