DepositPool

Introduction

The DepositPool contract serves as the primary staking and reward tracking layer in the protocol. It manages user deposits of a specific ERC20 token, tracks staking positions and lock periods, handles reward rate logic, and provides mechanisms for secure and modular reward claiming — including support for referrers and delegated claims. This contract operates as a satellite to the central Distributor and RewardPool contracts, and can be deployed per reward pool on Ethereum.

Key Responsibilities

  1. Staking and Withdrawal Logic

    • Accepts ERC20 deposits from users into specific reward pools.

    • Supports both public and private reward pools (public allow permissionless staking; private are managed by the owner).

    • Enables staking with custom lock periods and optional referrer assignment.

    • Allows secure withdrawal with respect to lock rules and minimum stake constraints.

  2. Reward Calculation Integration

    • Interfaces with the RewardPool contract to validate pool configurations (e.g., public/private).

    • Works with the Distributor to request reward updates before any user action.

    • Computes a “virtual deposit” value factoring in lock duration and referral tiers.

    • Uses internal logic to calculate each user’s current pending rewards and referrer yield.

  3. Claim and Delegation System

    • Supports direct reward claiming by stakers.

    • Enables delegated reward claiming via claimSender and claimReceiver mappings.

    • Supports separate claiming of referrer rewards.

    • Ensures secure access control on all delegated operations.

  4. Cross-Contract Coordination

    • Verifies pool status from the RewardPool contract.

    • Uses the Distributor to distribute rewards and transfer yield tokens as needed.

    • Relies on shared PRECISION constants and math utilities from LockMultiplierMath and ReferrerLib.

Storage

isNotUpgradeable

Returns true if the contract no longer supports upgrades to a new version.

depositToken

The stETH token address, see the LIDO doc.

rewardPoolsData

Contain additional internal information about MOR reward pools for buckets. poolsData[<poolId>].

Name
Description

lastUpdate

The unix epoch timestamp in seconds when the rate was updated.

rate

The current pool coefficient, used to calculate awards.

totalVirtualDeposited

The total amount of stETH deposited in the pool with multiplier, wei.

usersData

Stores all staking-related data for users. usersData[<stakerAddress>][<poolId>].

Name
Description

lastStake

The unix epoch timestamp in seconds when the user stake was last.

deposited

The amount of staked stETH, wei.

rate

The last user reward rate, used to calculate awards.

pendingRewards

The last saved MOR rewards for the user. This value is updated when stake, withdraw or claim from the user account occurs. It is not the final award. Wei.

claimLockStart

MOR rewards lock period starts at this timestamp. Seconds.

claimLockEnd

MOR rewards lock period end at this timestamp. Seconds.

virtualDeposited

The amount of staked stETH, with multipliers. Wei.

lastClaim

The last claim timestamp in seconds.

referrer

The referrer address.

totalDepositedInPublicPools

Tracks the total amount of stETH deposited in the public pools (specifically the capital bucket). Wei.

referrerTiers

Stores referral reward tiers per pool. referrerTiers[<poolId>][<tierIndex>].

Name
Description

amount

The minimal token amount for the tier, wei.

multiplier

The multiplier for the tier, where 1% = 0.01 * 1025.

referrersData

Tracks referral activity per user and pool. referrersData[<stakerAddress>][<poolId>].

Name
Description

amountStaked

The amount of referred stETH, wei.

virtualAmountStaked

The amount of referred stETH, with multipliers, wei.

rate

The last referrer reward rate, used to calculate awards.

pendingRewards

The last saved MOR rewards for the referrer. It is not the final award, wei.

lastClaim

The last claim timestamp, secodns.

claimSender

Defines which addresses are allowed to claim rewards on behalf of another user in a given reward claimSender[<rewardPoolIndex>][<caller>][<allowedSender>]

claimReceiver

Defines the receiver address for a user’s rewards, enabling redirection of claims. claimReceiver[<rewardPoolIndex>][<caller>][<l2Receiver>]

isMigrationOver

Indicates whether the migrate function called.

distributor

The address of the Distributor contract.

rewardPoolsProtocolDetails

Setup limits configuration parameters used during reward calculations and user interactions.

Name
Description

withdrawLockPeriodAfterStake_

Lock period for withdrawals after staking, seconds.

claimLockPeriodAfterStake_

Lock period for claims after staking, seconds.

claimLockPeriodAfterClaim_

Lock period after a claim before next claim, seconds.

minimalStake_

Minimum staking amount required, wei.

distributedRewards

Distributed reward pool rewards, wei.

Write functions for the contract owner

DepositPool_init

Initializes the DepositPool contract with the deposit token and distributor address.

Name
Description

depositToken_

Address of the stETH token.

distributor_

Address of the Distributor contract.

setDistributor

Updates the Distributor contract address.

Name
Description

value_

Address of the Distributor contract.

setRewardPoolProtocolDetails

Sets configuration details for a specific reward pool.

Name
Description

rewardPoolIndex_

The reward pool ID.

withdrawLockPeriodAfterStake_

Lock period for withdrawals after staking, seconds.

claimLockPeriodAfterStake_

Lock period for claims after staking, seconds.

claimLockPeriodAfterClaim_

Lock period after a claim before next claim, seconds.

minimalStake_

Minimum staking amount required, wei.

migrate

Transfers pending stETH yield to the Distributor and run supply logic. Used once for old DistributionV5.

Name
Description

rewardPoolIndex_

The capital reward pool ID.

editReferrerTiers

The function to setup tiers for the refferal system.

Name
Description

rewardPoolIndex_

The reward pool ID.

referrerTiers_

The referrer tiers structs.

manageUsersInPrivatePool

The function to manage users in the private pool (non capital bucket). This function specifically controls the user shares in the other buckets. Each user has its own index in the array of users_, additional data for that user (amounts_, claimLockEnds_, referrers_) should have the same index.

Name
Description

rewardPoolIndex_

The reward pool ID.

users_

The users addresses.

amounts_

The virtual staked amount values for users_. Wei.

claimLockEnds_

The claim lock end values for users_. Default values - [0, 0, 0...]. Seconds.

referrers_

The referrer values for users_ .Default values - [0х000..., 0х000..., 0х000...]

removeUpgradeability

Permanently disables contract upgradeability. Only callable by owner.

Write functions for stakers

setClaimSender

Enables specified addresses to claim on behalf of the sender.

Name
Description

rewardPoolIndex_

The reward pool ID.

senders_

List of addresses allowed/disallowed.

isAllowed_

Boolean flags per address for allow/disallow.

setClaimReceiver

Sets a dedicated address to receive claims on behalf of the caller.

Name
Description

rewardPoolIndex_

The reward pool ID.

receiver_

Address to receive rewards.

stake

The stake function allows users to deposit stETH into the protocol from the Ethereum network, then the staker will get a share of the rewards.

Name
Description

rewardPoolIndex_

The reward pool ID.

amount_

The stETH amount to stake, where 1 stETH = 1018.

claimLockEnd_

The unix epoch timestamp in seconds. Use the default zero value. Secodns.

referrer_

The referrer address. Use the default zero address - 0x0000000000000000000000000000000000000000

withdraw

The withdraw function allows users to retrieve their staked stETH after a withdraw lock period.

Name
Description

rewardPoolIndex_

The reward pool ID.

amount_

The stETH amount to withdraw, where 1 stETH = 1018.

claim

The claim function enables stakers to receive the MOR tokens they’ve accrued.

Name
Description

eth_value

Payable amount, value, in the ETH.

rewardPoolIndex_

The reward pool ID.

receiver_

The address who will receive MOR on L2.

claimFor

Claims rewards for a staker_ on caller behalf. The caller should be whitelisted by staker_ on setClaimSender call. Or claimReceiver should exists on setClaimReceiver call.

Name
Description

eth_value

Payable amount, value, in the ETH.

rewardPoolIndex_

The reward pool ID.

staker_

Address of the user being claimed for.

receiver_

Address receiving the rewards.

claimReferrerTier

The function enables referrer to receive the MOR tokens they’ve accrued.

Name
Description

rewardPoolIndex_

The reward pool ID.

receiver_

The address who will receive MOR on L2.

claimReferrerTierFor

Claims referrer-tier rewards for another referrer. The caller should be whitelisted by referrer_ on setClaimSender call.

Name
Description

rewardPoolIndex_

The reward pool ID.

referrer_

Referrer whose reward is claimed.

receiver_

Address to receive reward.

lockClaim

The function to lock rewards and receive claim lock multiplier (power factor). Used when a user has an active stake and wants to receive a multiplier without triggering a new staking transaction.

Name
Description

rewardPoolIndex_

The reward pool ID.

claimLockEnd_

The unix epoch timestamp in seconds.

Read functions

getLatestUserReward

This function calculates the total claimable MOR token rewards for a given staker within a specific bucket, based on their current stake and multipliers. Where 1 MOR = 1018.

Name
Description

rewardPoolIndex_

The reward pool ID.

user_

The staker address.

getLatestReferrerReward

This function calculates the total claimable MOR token rewards for a given referrer within a specific bucket, based on referrals and tier multipliers. Where 1 MOR = 1018.

Name
Description

rewardPoolIndex_

The reward pool ID.

user_

The referrer address.

getCurrentUserMultiplier

The function to calculate the power factor and referrer multiplier for the specified staker. Returns the multiplier, where x1 = 1025.

Name
Description

rewardPoolIndex_

The reward pool ID.

user_

The staker address.

getReferrerMultiplier

The function to calculate the tier multiplier for the specified referrer. Returns the multiplier, where x1 = 1025.

Name
Description

rewardPoolIndex_

The reward pool ID.

referrer_

The referrer address.

supportsInterface

Used for interface detection (ERC165). Returns true if the contract supports a specific interfaceId_. Supports IChainLinkDataConsumer, IERC165.

version

Returns the current version of the contract.

Last updated

Was this helpful?