# Stake

The [stake](/smart-contracts/documentation/distribution-protocol/v7-protocol/contracts/depositpool.md#stake) function allows users to deposit tokens (such as stETH or other `depositToken`) into the protocol in exchange for MOR token rewards. Staking is available only for public reward pools, such as the Capital pool.

When a user calls stake, the contract verifies that the reward pool exists and is public. It ensures the provided amount is greater than zero and satisfies the `minimalStake` requirement for the selected pool. If a `claimLockEnd` is provided, it must be either zero or a future timestamp. If provided, it increases the reward multiplier and updates the user’s lock duration.

The user’s `depositToken` is transferred to the `DepositPool` contract using `transferFrom`. For stETH, due to Lido rebasing, the actual amount received may be slightly less than requested. Immediately after receiving the tokens, the `DepositPool` forwards them to the `Distributor` contract using the [supply](/smart-contracts/documentation/distribution-protocol/v7-protocol/contracts/distributor.md#supply) method.

If the `depositToken` supports external yield (e.g., Aave yield), the `Distributor` deposits them into Aave. If the token is stETH, it is not deposited and is held directly by the `Distributor`.

Reward multipliers are calculated using two components: the lock period (`claimLockEnd`) and a referrer address if one is provided. These multipliers increase the user’s virtual stake, which determines the share of rewards the user is entitled to. If the user passes their own address as referrer, the bonus still applies.

Before updating state, the contract synchronizes the reward coefficient by calling [`distributeRewards`](/smart-contracts/documentation/distribution-protocol/v7-protocol/contracts/distributor.md#distributedrewards) on the `Distributor`. This ensures the latest emission state is considered when updating the user’s reward rate.

Staking resets the withdrawal and claim lock timers. Each new stake requires the user to wait again before being able to withdraw or claim rewards, based on pool-level lock parameters.

To execute this function successfully, the user must have approved the `DepositPool` contract to spend their tokens. The staked amount must satisfy the pool’s minimum, and the `rewardPoolIndex` must correspond to a valid public pool.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gitbook.mor.org/smart-contracts/documentation/distribution-protocol/v7-protocol/get-started/stake.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
