# Introduction

stake.link is a premier liquid staking platform building a decentralized, multi-chain future with Chainlink at its core. While founded by a consortium of 15 top-tier Chainlink node operators, our vision has expanded to become the first-of-its-kind on-chain Liquid Staking Token (LST) Index.

Our platform allows users to stake assets from leading Digital Assets ecosystems—starting with `stLINK` for Chainlink and recently `stPOL` for Polygon. Receive liquid tokens that auto-compound rewards and can be used across DeFi.

Through our native token, `SDL`, users can capture value from our entire, growing basket of LSTs, participating in the success of a diverse range of blockchain networks.

## Resources & Socials

* [stake.link app](https://stake.link/)
* [X](https://x.com/stakedotlink)
* [Telegram](https://t.me/stakedotlink)
* [Discourse](https://talk.stake.link/)
* [Discord](https://discord.com/invite/stakedotlink)
* [Snapshot](https://snapshot.box/#/s:council.stakedotlink.eth/proposals)
* [Mirror Blog](https://mirror.xyz/stakedotlink.eth)


# Litepaper

#### Abstract

The advent of explicit staking, as introduced by Chainlink 2.0, establishes a new paradigm of cryptoeconomic security, where the integrity of oracle networks is explicitly backed by staked `LINK`. However, this security model introduces inherent challenges of capital inefficiency and illiquidity, creating a significant barrier to widespread participation. This litepaper introduces stake.link, a decentralized protocol designed to resolve these challenges through a Liquid Staking Model. stake.link provides a foundational second-layer protocol that enhances the capital efficiency of staked assets via Liquid Staking Tokens (LSTs), introduces a meritocratic access-control layer for staking participation, and implements a novel Reward Escrow (`reSDL`) governance model to ensure long-term cryptoeconomic alignment. We further outline the long-term vision for stake.link to evolve into a first-of-its-kind on-chain LST Index, a meta-governance and value accrual layer for a diverse basket of high-quality LSTs, beginning with `stLINK` and extending across multi-chain ecosystems.

***

#### Introduction

Decentralized Oracle Networks (DONs) form the bedrock of a verifiable, interconnected Web3. The Chainlink 2.0 framework defines explicit staking as the primary mechanism for securing these networks, whereby node operators and community members commit `LINK` to provide explicit security guarantees. While this model provides robust, skin-in-the-game security, it natively renders the staked capital illiquid. This illiquidity presents a fundamental economic dilemma: participants are forced to choose between securing the network and deploying their capital within the burgeoning DeFi ecosystem. This opportunity cost suppresses staking participation, limits the total cryptoeconomic security of the network, and centralizes participation among a smaller set of highly capitalized actors.

To resolve this dilemma, we propose a Hybrid Staking Model, which combines the on-chain security guarantees of native staking with a highly efficient off-chain liquidity and governance layer. This model leverages Liquid Staking Tokens (LSTs) to transform illiquid, staked assets into composable, yield-bearing derivatives that can be utilized across the DeFi landscape. This second-layer protocol does not replace native staking but rather augments it, creating a positive-sum flywheel where increased capital efficiency drives greater staking participation, which in turn enhances the underlying security of the oracle network.

stake.link is a canonical implementation of the Hybrid Staking Model, designed specifically for the Chainlink ecosystem and its expansive, multi-chain future. It is a decentralized protocol engineered to maximize the utility of staked `LINK` and other high-quality digital assets through a suite of robust smart contracts and cryptoeconomic incentives, while relying on the Chainlink tech stack.

The stake.link protocol is architected as a multi-layered system designed for security, fairness, and composability. At its core, stake.link interfaces directly with Chainlink’s native staking contracts. All assets deposited into stake.link are programmatically staked within the official on-chain pools, ensuring that all yield is generated from the underlying protocol and that all staked capital directly contributes to Chainlink’s cryptoeconomic security.

Upon staking `LINK`, the protocol mints `stLINK`, a rebasing LST that maintains a 1:1 relationship with the underlying `LINK`. The rebasing model provides a clear and consistent unit of account while rewards are distributed through an increase in the holder's token balance. For maximum DeFi compatibility, the protocol also facilitates the wrapping of `stLINK` into `wstLINK`, a non-rebasing, value-accruing token ideal for use as collateral in lending markets and to secure other hybrid smart contracts.

Given the capped nature of Chainlink’s staking pools, stake.link implements the Priority Pool, a deterministic and meritocratic access-control mechanism. It functions as an intelligent on-chain queue that allocates newly available staking capacity. Access is not determined on a first-come, first-served basis, which is susceptible to front-running, but is instead prioritized based on a user's stake-weighted governance power within the protocol, represented by their `reSDL` holdings. This ensures that long-term, committed participants are rewarded with preferential access.

#### Cryptoeconomic Security and Incentives

stake.link was founded and is operated by a consortium of 15 top-tier Chainlink Node Operators. This collective functions as a specialized Decentralized Oracle Network (DON) focused on the hyper-reliable management of staking infrastructure. Their deep technical expertise and established on-chain reputation provide an unparalleled layer of operational security and alignment with the core Chainlink network.

The native protocol token, `SDL`, serves as the instrument for governance and value accrual. To ensure long-term alignment and deter mercenary capital, stake.link utilizes a Reward Escrow (`reSDL`) model, inspired by the vote-escrow systems of DeFi primitives.

* Staking and Locking: Users stake `SDL` to receive `reSDL` in the form of an NFT. They can optionally lock their position for up to four years.
* Boost Mechanism: Locking provides a non-linear boost to their `reSDL` balance, increasing their share of protocol rewards and their weight in governance votes. This mechanism ensures that the participants with the most significant long-term commitment exert the greatest influence over the protocol.
* Incentive Alignment: The `reSDL` model aligns incentives across three vectors: protocol rewards, staking access priority, and governance power.

#### Decentralized Governance

The protocol is governed by the stake.link DAO. Proposals (SLURPs) can be submitted by any community member and are ratified by an elected Governance Council. This council is a representative body composed of core contributors, elected node operators, and elected community members, ensuring a balanced distribution of power.

To bridge the gap between decentralized, on-chain governance and the requirements of the off-chain world, the stake.link DAO operates through the `stakedotlink` legal entity. This BVI-based legal wrapper provides limited liability for DAO participants and enables the protocol to engage in off-chain activities such as signing contracts and managing operational expenses. This creates a Hybrid Governance Model that combines the trust-minimization of a DAO with the operational efficacy of a recognized legal structure.

#### The Long-Term Vision: The On-Chain LST Index

The ultimate vision for stake.link extends beyond being the premier liquid staking solution for Chainlink. It is to become the first-of-its-kind on-chain Liquid Staking Token (LST) Index.

The protocol architecture is designed to be modular and chain-agnostic. The introduction of `stPOL` for the Polygon network marks the first step in this expansion. The DAO will continue to onboard high-quality LSTs for other networks, with a focus on those deeply integrated with the Chainlink ecosystem.

In this mature state, the `SDL` token transcends its role in a single protocol to become a meta-governance and value accrual token for a diversified basket of LSTs. All fees generated from the expanding ecosystem of LSTs (`stLINK`, `stPOL`, and all future additions) are distributed to `SDL` stakers. This transforms `SDL` into a singular asset that allows holders to gain exposure to the growth and success of the entire liquid staking market across multiple networks, governed by a single, decentralized protocol.

stake.link presents a comprehensive, second-layer solution to the capital efficiency challenges of native staking. By introducing an LST framework for composable assets, a meritocratic access layer, and a robust, long-term-aligned governance framework, stake.link significantly enhances the cryptoeconomic security and utility of the Chainlink ecosystem. The long-term evolution into an on-chain LST Index positions stake.link as a foundational piece of DeFi infrastructure, designed to scale with the **multi-chain future being built and secured by Chainlink.**


# FAQ

This FAQ is for informational purposes only and does not constitute financial, legal, or investment advice. The stake.link protocol is provided 'as is,' and users are solely responsible for their own actions and due diligence. The crypto space involves risks; **PLEASE DYOR**.

## Table of Contents

<details>

<summary><strong>I. Protocol Fundamentals</strong></summary>

1.[What is Chainlink Staking?](#id-1.what-is-chainlink-staking)

2[.What are the advantages of staking with stake.link versus native Chainlink Staking?](#id-2.what-are-the-advantages-of-staking-with-stake.link-versus-native-chainlink-staking)

3.[How does stake.link offer a higher reward rate?](#id-3.how-does-stake.link-offer-a-higher-reward-rate)

4.[What fees does stake.link take?](#id-4.what-fees-does-stake.link-take)

5.[What is a Liquid Staking Token (LST) like stLINK?](#id-5.what-is-a-liquid-staking-token-lst-like-stlink)

6.[How does stLINK accrue yield?](#id-6.how-does-stlink-accrue-yield)

7.[How can I acquire stLINK to get my LINK tokens staked?](#id-7.how-can-i-acquire-stlink-to-get-my-link-tokens-staked)

8.[Who are the node operators behind stake.link?](#id-8.who-are-the-node-operators-behind-stake.link)

9.[How does stake.link's delegated staking model benefit both node operators and community members?](#id-9.how-does-stake.links-delegated-staking-model-benefit-both-node-operators-and-community-members)

10.[Is staking on stake.link non-custodial?](#id-10.is-staking-on-stake.link-non-custodial)

11.[How do I withdraw my staked LINK(stLINK)?](#id-11.how-do-i-withdraw-my-staked-link-stlink)

12.[What is the Priority Pool?](#id-12.what-is-the-priority-pool)

13.[What is the relationship between stake.link and Chainlink?](#id-13.what-is-the-relationship-between-stake.link-and-chainlink)

14.[What is the long-term vision for stake.link?](#id-14.what-is-the-long-term-vision-for-stake.link)

15.[How is `stLINK` distributed to users from the Priority Pool?](#id-15.how-is-stlink-distributed-to-users-from-the-priority-pool)

16.[Where can I use wstLINK in DeFi?](#id-16.where-can-i-use-wstlink-in-defi)

</details>

<details>

<summary><strong>II. Community Pool Migration to stLINK</strong></summary>

1.[What is the Community Pool migration feature?](#id-1.what-is-the-community-pool-migration-feature)

2.[How does the migration work?](#id-2.how-does-the-migration-work)

3.[Do I have to wait in the Priority Pool?](#id-3.do-i-have-to-wait-in-the-priority-pool)

4.[Can I migrate using a hardware wallet?](#id-4.can-i-migrate-using-a-hardware-wallet)

5.[Is the migration secure?](#id-5.is-the-migration-secure)

</details>

<details>

<summary><strong>III. Tokenomics &#x26; Economics</strong></summary>

1.[What is the SDL token and what is its utility?](#id-1.what-is-the-sdl-token-and-what-is-its-utility)

2.[What is the total supply and distribution of SDL?](#id-2.what-is-the-total-supply-and-distribution-of-sdl)

3.[What is reSDL?](#id-3.what-is-resdl)

4.[How do I get reSDL NFTs?](#id-4.how-do-i-get-resdl-nfts)

5.[Does staking SDL give me more SDL tokens?](#id-5.does-staking-sdl-give-me-more-sdl-tokens)

6[.What is the reSDL locking mechanism?](#id-6.what-is-the-resdl-locking-mechanism)

7.[How does the reSDL lock boost work?](#id-7.how-does-the-resdl-lock-boost-work)

8.[What are the lock and withdrawal periods for reSDL?](#id-8.what-are-the-lock-and-withdrawal-periods-for-resdl)

9.[How do I withdraw my staked SDL?](#id-9.how-do-i-withdraw-my-staked-sdl)

10.[Does reSDL guarantee access to LINK staking?](#id-10.does-resdl-guarantee-access-to-link-staking)

11.[Can I transfer my reSDL NFTs to a different wallet?](#id-11.can-i-transfer-my-resdl-nfts-to-a-different-wallet)

12.[Can I sell my reSDL NFTs?](#id-12.can-i-sell-my-resdl-nfts)

13.[Can I merge or split my reSDL NFT positions?](#id-13.can-i-merge-or-split-my-resdl-nft-positions)

14.[How are ecosystem airdrops (e.g., Chainlink's BUILD program) distributed?](#id-14.how-are-ecosystem-airdrops-e.g.-chainlinks-build-program-distributed)

</details>

<details>

<summary><strong>IV. Technology &#x26; Security</strong></summary>

1.[Have the stake.link smart contracts been audited?](#id-1.have-the-stake.link-smart-contracts-been-audited)

2.[What proactive security measures does stake.link use beyond smart contract audits?](#id-2.what-proactive-security-measures-does-stake.link-use-beyond-smart-contract-audits)

3.[How are the protocol's treasury and critical functions secured?](#id-3.how-are-the-protocols-treasury-and-critical-functions-secured)

4.[Who are the signers on the multi-sig wallet?](#id-4.who-are-the-signers-on-the-multi-sig-wallet)

5.[What are the general risks of using stake.link and other DeFi protocols?](#id-5.what-are-the-general-risks-of-using-stake.link-and-other-defi-protocols)

6.[What happens if stLINK de-pegs on secondary markets?](#id-6.what-happens-if-stlink-de-pegs-on-secondary-markets)

7.[What is wstLINK and how is it different from stLINK?](#id-7.what-is-wstlink-and-how-is-it-different-from-stlink)

</details>

<details>

<summary><strong>V. Ecosystem &#x26; Governance</strong></summary>

1.[What is the governance model of stake.link?](#id-1.what-is-the-governance-model-of-stake.link)

2.[How can the community propose changes to the protocol?](#id-2.how-can-the-community-propose-changes-to-the-protocol)

3.[What is the Governance Council and what is its role?](#id-3.what-is-the-governance-council-and-what-is-its-role)

4.[How are community members elected to the Council?](#id-4.how-are-community-members-elected-to-the-council)

5.[What is the NAIL (Network Aligned Individual Liaison) role?](#id-5.what-is-the-nail-network-aligned-individual-liaison-role)

6.[What is "stakedotlink" and why does the DAO need a legal entity?](#id-6.what-is-stakedotlink-and-why-does-the-dao-need-a-legal-entity)

7.[How does the community exercise its rights over the "stakedotlink" legal entity?](#id-7.how-does-the-community-exercise-its-rights-over-the-stakedotlink-legal-entity)

8.[What is the role of the founding team (LinkPool) now that stake.link is a DAO?](#id-8.what-is-the-role-of-the-founding-team-linkpool-now-that-stake.link-is-a-dao)

9.[What is the purpose of the DAO Treasury?](#id-9.what-is-the-purpose-of-the-dao-treasury)

</details>

<details>

<summary><strong>VI. Polygon Liquid Staking - stPOL</strong></summary>

1.[What is stPOL?](#id-1.what-is-stpol)

2[.What are the benefits of using stPOL over native Polygon staking?](#id-2.what-are-the-benefits-of-using-stpol-over-native-polygon-staking)

3.[How does stPOL accrue yield?](#id-3.how-does-stpol-accrue-yield)

4.[How do I stake POL and use it in DeFi?](#id-4.how-do-i-stake-pol-and-use-it-in-defi)

5.[How is the DeFi liquidity for stPOL incentivized?](#id-5.how-is-the-defi-liquidity-for-stpol-incentivized)

6.[How do I withdraw my stPOL back to POL?](#id-6.how-do-i-withdraw-my-stpol-back-to-pol)

</details>

<details>

<summary><strong>VII. Espresso Liquid Staking - stESP</strong></summary>

1.[What is stESP?](#id-1.what-is-stesp)

2.[What are the benefits of stESP over native Espresso staking?](#id-2.what-are-the-benefits-of-stesp-over-native-espresso-staking)

3.[How does stESP accrue yield?](#id-3.how-does-stesp-accrue-yield)

4.[How do I stake ESP and use it in DeFi?](#id-4.how-do-i-stake-esp-and-use-it-in-defi)

5.[How is DeFi liquidity for stESP incentivized?](#id-5.how-is-the-defi-liquidity-for-stpol-incentivized)

6.[How do I withdraw stESP back to ESP?](#id-6.how-do-i-withdraw-stesp-back-to-esp)

7.[What are the security practices for stESP?](#id-7.what-are-the-security-practices-for-stesp)

</details>

## I. Protocol Fundamentals

### 1.What is Chainlink Staking?

Chainlink Staking is a key component of [Chainlink Economics](https://chain.link/economics) designed to enhance the cryptoeconomic security of the Chainlink Network. It allows ecosystem participants, such as community members and node operators, to commit their LINK tokens to back the performance of oracle services. In return for helping to secure the network, stakers earn rewards. The current version is [v0.2](https://blog.chain.link/chainlink-staking-v0-2-overview/). stake.link ([SDL](https://stake.link/)) serves as a key platform within this ecosystem, offering a liquid and enhanced way for users to participate in securing the Chainlink Network.

### 2.What are the advantages of staking with stake.link versus native Chainlink Staking?

Staking through stake.link offers several key advantages over staking natively on the Chainlink platform:

* Access to Higher Yield: stake.link stakes assets in both the Chainlink Community Pool and the higher-yielding Node Operator Pool, offering users a blended reward rate that is typically higher than the Community Pool alone.
* Liquid Staking Token ([stLINK](https://etherscan.io/token/0xb8b295df2cd735b15be5eb419517aa626fc43cd5)): When you stake LINK, you receive stLINK, a liquid token representing your staked position. This token can be transferred, traded, or used as collateral in other DeFi applications,[ whereas natively staked LINK is locked](https://blog.chain.link/chainlink-for-lsts-and-lrts/).
* Auto-Compounding Yield: The rewards earned are automatically compounded. This is reflected through a rebasing mechanism where your stLINK balance increases over time. Native staking rewards do not auto-compound and must be manually claimed and restaked, which is often impossible as the pools are full.
* Flexible Withdrawals: stake.link offers an accelerated withdrawal process. Users can often unstake their LINK in 1-7 days, and sometimes instantly if there is liquidity in the [Priority Pool](https://etherscan.io/address/0xddc796a66e8b83d0bccd97df33a6ccfba8fd60ea), bypassing the native 28-day cooldown period.

### 3.How does stake.link offer a higher reward rate?

The higher reward rate is achieved by pooling user deposits and staking them across both the Chainlink Community Pool and the exclusive [Node Operators Pool](https://etherscan.io/address/0xa1d76a7ca72128541e9fcacafbda3a92ef94fdc5). The Node Operator Pool receives delegation rewards from the Community Pool, resulting in a higher overall yield. stake.link is currently the only platform that provides the general public with access to the returns from this higher-yielding pool. The reward rate displayed on the website is the final rate after all protocol fees have been deducted.

### 4.What fees does stake.link take?

The stake.link protocol's fee structure is designed to sustainably reward key participants who secure and operate the network. The fees are sourced directly from the gross staking yield and can be categorized as follows:

1. Protocol & Delegation Fees: As key participants of the ecosystem, SDL stakers receive a share of the rewards generated from the protocol. Furthermore, a portion of the overall yield is allocated to the 15 participating node operators as a "delegation fee" for providing their valuable staking capacity. A share also goes to the core contributors for the ongoing development and maintenance of the protocol.
2. DeFi-PoL (Protocol Owned Liquidity) Fee: There is a 3% delegation fee applied to the yield generated by the protocol's LSTs (like stLINK & stPOL). This fee is specifically used to bootstrap and incentivize liquidity providers in DeFi, such as the stLINK/LINK pool on Curve. This ensures the LSTs have deep liquidity, which is vital for their utility and stability.

| Fee Allocation                 | Node Operator Pool Strategy | Community Pool Strategy |
| ------------------------------ | --------------------------: | ----------------------: |
| Node Operators                 |                          5% |                      0% |
| SDL Stakers                    |                         15% |                     10% |
| DeFi: Protocol Owned Liquidity |                          3% |                      3% |
| Core Contributors              |                          3% |                      3% |
| **Total**                      |                     **26%** |                 **16%** |

For **BUILD Rewards**, the following distribution model will apply:

| Delegation Fee BUILD Rewards | Node Operator Pool Strategy | Community Pool Strategy |
| ---------------------------- | --------------------------- | ----------------------- |
| Node Operators               | 5%                          | 0%                      |
| SDL Stakers                  | 20%                         | 20%                     |
| **Total Delegation Fee**     | **25%**                     | **20%**                 |

| Total Fee BUILD Rewards | Node Operator Pool Strategy | Community Pool Strategy |
| ----------------------- | --------------------------- | ----------------------- |
| Delegation Fee          | 25%                         | 20%                     |
| Core Contributors       | 3%                          | 3%                      |
| **Total**               | **28%**                     | **23%**                 |

-Curve stLINK/LINK LPs will be eligible as if their position is a 50/50 deposit.

-BUILD Rewards are available to be claimed for 180 days from the day of the first distribution

The reward rate (APY) displayed on the stake.link website is the **net yield** for the user, meaning these fees have already been **deducted**.

### 5.What is a Liquid Staking Token (LST) like stLINK?

[Liquid Staking Token ](https://chain.link/education-hub/liquid-staking)(LST) is a type of receipt token that represents ownership of a staked asset in a protocol. stLINK is similiar to other popular LSTs like [Lido's stETH](https://help.lido.fi/en/articles/5230610-what-is-steth). For stake.link, when the protocol stakes 1 LINK in the native Chainlink pools, the protocol mints 1 stLINK. This stLINK token accrues staking rewards [while remaining liquid](https://blog.chain.link/chainlink-for-lsts-and-lrts/), meaning it can be freely traded or used in other [DeFi protocols](https://chain.link/education/defi) without needing to unstake the underlying LINK.

### 6.How does stLINK accrue yield?

stLINK accrues yield through a process called "**rebasing**." Approximately every two days, the total staking rewards earned by the protocol are calculated, and the supply of stLINK is increased proportionally. This means the stLINK balance in your wallet will automatically increase to reflect the rewards you've earned, effectively auto-compounding your stake.

Note: There will be no incoming transaction visible.

### 7.How can I acquire stLINK to get my LINK tokens staked?

There are two primary ways to acquire stLINK:

1. Stake on [stake.link](https://stake.link/stake): You can deposit LINK into the Priority Pool on the stake.link platform. When staking capacity becomes available, your LINK is automatically staked and converted to stLINK.
2. Swap on a DEX: You can trade LINK for stLINK directly on a decentralized exchange that has a [stLINK/LINK liquidity pool](https://www.curve.finance/dex/ethereum/pools/factory-stable-ng-403/swap/)

### 8.Who are the node operators behind stake.link?

stake.link is comprised of 15 of the most reputable and long-standing node operators in the Chainlink ecosystem:

01NODE, Framework Ventures, LinkPool, Chainlayer, Galaxy Digital, Inotel, LinkedRiver, LinkForest, OrionStaking, Matrixed.Link, Simply Stakin', Pier Two, Stakin, Tiingo and stakefish.

[LinkPool ](http://linkpool.com/)also serves as a core technical contributor to the protocol.

### 9.How does stake.link's delegated staking model benefit both node operators and community members?

Delegated staking is a model where community members can pool their capital to support high-performance node operators, solving a key challenge in the Chainlink ecosystem. At scale, individual node operators may not have the immense capital required to collateralize all the [oracle services](https://chain.link/education/blockchain-oracles) they can perform. stake.link's model bridges this gap by creating a symbiotic, win-win relationship:

* Community Members provide the LINK capital that secures the network. In return, they gain access to the higher, exclusive reward rates of the node operator pools, earning a better yield than they could through native community staking alone.
* Node Operators provide their limited staking capacity and perform the work that earns rewards. In return, they receive a "delegation fee" from the rewards generated by the community's capital. This allows them to scale their operations, secure more work, and increase the overall capacity of the Chainlink Network beyond the limits of their own funds.

This alignment of incentives ensures both parties are essential and fairly compensated, allowing the entire ecosystem to scale more effectively.

### 10.Is staking on stake.link non-custodial?

Yes. Staking on stake.link is entirely [non-custodial](https://chain.link/education/web3). The protocol's smart contracts manage the staking and delegation process, but at no point do the node operators or core contributors take direct control or custody of a user's LINK tokens. You retain ownership of your assets through the stLINK token.

### 11.How do I withdraw my staked LINK(stLINK)?

You can redeem your stLINK for LINK through the [stake.link platform](https://stake.link/withdraw). The protocol is designed for faster withdrawals than native staking. Thanks to a continuous cycle of unbonding and the Priority Pool acting as a liquidity buffer, withdrawals can often be processed within a 1 to 7-day window, and instantly if there is LINK in the Priority Pool, bypassing the mandatory 28-day cooldown period required for native Chainlink staking.

### 12.What is the Priority Pool?

The Priority Pool is a core feature of the stake.link protocol that functions as an intelligent queuing system for users wishing to stake LINK. The Priority Pool is a holding zone, and depositing there doesn't immediately translates to getting your LINK staked. Since the native Chainlink staking pools have a limited capacity and are often full, the Priority Pool provides a fair and automated way for users to stake their LINK as soon as space becomes available.

Its key functions and characteristics are:

* Solves Limited Capacity: It allows users to deposit LINK and have it automatically staked for them when other users withdraw from native staking, creating a 'set-and-forget' experience.
* Prioritization, Not "First-Come, First-Served": The queue is not based on who deposits first. Instead, it prioritizes deposits from users who have staked SDL and hold reSDL NFTs. The more reSDL a user has, the higher their priority. This was designed to be fairer than a "fastest finger" system that favors users in certain timezones.
* Liquidity Buffer for Fast Withdrawals: The Priority Pool also serves as a liquidity source for users who want to unstake and exit stLINK back to LINK. When a user redeems their stLINK for LINK, the protocol can swap it with LINK from the Priority Pool.
* Full User Control: Users can withdraw their LINK from the Priority Pool at any time before it has been converted to stLINK. However, it's important to note that LINK held in the Priority Pool does not earn staking rewards until it is officially staked and converted to stLINK.

### 13.What is the relationship between stake.link and Chainlink?

stake.link is an independent protocol that operates within the Chainlink ecosystem. While not an official product from Chainlink Labs, the protocol is deeply integrated with Chainlink's mission and technology in several key ways:

* Built by Core Ecosystem Participants: stake.link was founded and is operated by a consortium of 15 top-tier Chainlink node operators. This means it's built by established participants who are deeply invested in the long-term success and security of the Chainlink Network.
* Strategic Alignment with Chainlink Labs: Demonstrating a deep collaboration and shared vision, Chainlink Labs holds[ 7.7% of the total SDL](https://etherscan.io/address/0xdeda4c43136d4f40f75073b0d815c648330fd072) supply as a key ecosystem partner. This aligns the core team behind Chainlink with the long-term success of the stake.link protocol.
* Utilizes Chainlink's Staking Infrastructure: The protocol functions as a value-add layer on top of Chainlink's native staking system. It pools user funds and stakes them directly into Chainlink's official staking contracts, with all yield originating directly from the native Chainlink protocol.
* Leverages the Full Chainlink Tech Stack: The integration goes beyond just staking. The stake.link protocol is built using Chainlink's own suite of services, including [Price Feeds](https://docs.chain.link/data-feeds/price-feeds), [Automation](https://chain.link/automation), and the [Cross-Chain Interoperability Protocol ](https://chain.link/education/cross-chain)(CCIP), to ensure its operations are secure, reliable, and decentralized.
* Shares the Goal of Enhancing Network Security: By making staking more accessible and liquid (via stLINK), stake.link helps increase overall participation in Chainlink Staking. This directly supports the core mission of enhancing the cryptoeconomic security of the entire Chainlink Network.

### 14.What is the long-term vision for stake.link?

The long-term vision for stake.link is to build a robust, multi-chain ecosystem with Chainlink and `stLINK` serving as its permanent cornerstone. While our foundation is built on this security and strength using the Chainlink stack, our ambition is to evolve from the premier liquid staking solution for Chainlink into the first-of-its-kind on-chain Liquid Staking Token (LST) Index.

The strategy unfolds in key phases:

1. Establish the Foundation: We began by creating `stLINK`, the leading LST for the Chainlink Network, ensuring it is secure, distributed, and highly liquid.
2. Expand to a Multi-Chain Model: We are now accelerating our growth by adding new, high-quality LSTs for other promising networks, starting with `stPOL` for Polygon. This proves our multi-network model and creates diverse reward streams.
3. Become the Premier LST Index: The ultimate goal is for our native token, `SDL`, to capture value from a growing basket of LSTs. All fees generated from `stLINK`, `stPOL`, and all future LSTs will be distributed to `SDL` stakers. This allows users to gain exposure to a diverse index of staking rewards, all consolidated within the single `SDL` token.

Our roadmap to achieve this includes launching more LSTs, securing deep integrations with major DeFi platforms like Aave, and making `SDL` and our LSTs ubiquitous across the on-chain economy, all while building upon our core strength in the Chainlink ecosystem.

[Read more about it here.](https://mirror.xyz/stakedotlink.eth/1QoCF4aCJEjAhkzrKlGZB0wA5gBl3WRV8LTIEwQ70-s)

### 15.How is `stLINK` distributed to users from the Priority Pool?

When new staking capacity becomes available, the protocol processes deposits from the Priority Pool in batches to mint and distribute `stLINK`. Here’s how it works:

* Batched Distribution: The protocol distributes `stLINK` in batches of 15,000 LINK. Once at least 15,000 LINK worth of staking capacity is available, the distribution process can be initiated.
* Claiming Your `stLINK`: After a batch is processed, your corresponding `stLINK` will become available to claim on the stake.link platform. You'll need to visit the "Priority Staking" section of the site to claim your newly minted `stLINK`.
* High-Volume Periods: If a large amount of staking capacity opens up (e.g., more than 15,000 LINK at once), the Priority Pool will process all the available LINK and distribute the `stLINK` for claiming approximately every 24 hours until the queue is cleared.

### 16.Where can I use wstLINK in DeFi?

wstLINK is designed for maximum compatibility across DeFi protocols. As a non-rebasing LST, it can be seamlessly integrated into lending markets, liquidity pools, and other sophisticated smart contracts. Current integrations include:

**Lending & Borrowing:**

* [**Morpho Markets**](https://app.morpho.org/) - Use wstLINK as collateral to borrow LINK in the wstLINK-LINK lending market. This allows you to access liquidity while maintaining exposure to your staking rewards. The market features competitive rates and is incentivized with SDL rewards for early adopters. You can also [deposit "vanilla" LINK](https://app.morpho.org/ethereum/vault/0x610f5B68bD1EED68Af649A3fD3DC2CAa1ee4Ae7E/alpha-link-enhanced-v2) to earn yield from borrowers.
* [**Folks Finance**](https://folks.finance/) - Use wstLINK as collateral to borrow LINK or stablecoins. This allows you to access liquidity cross-chain and deposit wstLINK from Base, Arbitrum, Polygon and Avalanche and borrow on any of these chains.

**Liquidity Provision:**

* [**Curve Finance**](https://curve.fi/) - Provide liquidity to the [stLINK/LINK ](https://www.curve.finance/dex/polygon/pools/factory-stable-ng-237/deposit)pool on Ethereum mainnet to earn trading fees and additional incentives. LPs are eligible for SDL rewards and stLINK-LINK LP tokens distributed as part of the DeFi-PoL program.
* [**Curve Finance (Polygon)**](https://polygon.curve.fi/) - For stPOL holders, provide liquidity to the [wstPOL/WPOL](https://www.curve.finance/dex/polygon/pools/factory-stable-ng-237/deposit) pool on Polygon PoS. Pool is incentivized with wstPOL-wPOL LP tokens.
* [**Uniswap V3**](https://app.uniswap.org/explore/pools/ethereum/0x51d1026e35d0f9aa0ff243ebc84bb923852c1fc3) - Provide liquidity to the [SDL/LINK](https://app.uniswap.org/explore/pools/ethereum/0x51d1026e35d0f9aa0ff243ebc84bb923852c1fc3) pool on Ethereum mainnet with concentrated liquidity to maximize capital efficiency or "hands off" full range. Earn trading fees from swaps between SDL and LINK tokens and [stake the LP tokens](https://stake.link/defi/link-sdl-uniswap-incentive) to recieve SDL incentives.

**Future Integrations:** The stake.link ecosystem is continuously expanding. More DeFi protocols are integrating wstLINK and stLINK to unlock new use cases for liquid staking. Check stake.link's [DeFi section](https://stake.link/defi) and follow [@stakedotlink](https://x.com/stakedotlink) on X for the latest supported protocols and partnership announcements.

## II. Community Pool Migration to stLINK

### 1.What is the Community Pool migration feature?

The [migration feature](https://stake.link/migrate) is a streamlined path designed for users staking LINK in the Chainlink Community Staking Pool. It lets you convert your staked LINK directly into stLINK, stake.link's liquid staking token, through a dedicated flow in the stake.link app. Migrating unlocks what a native staked position cannot offer:

* Higher Reward Rate: Benefit from stake.link's optimized staking strategies, with rewards auto-compounding directly into your stLINK balance.
* Liquidity & DeFi Composability: stLINK can be transferred, traded, or used across the DeFi ecosystem (and wrapped into wstLINK for even broader compatibility), all while you continue earning Chainlink staking rewards.
* Instant Conversion, Guaranteed Spot: The migration path bypasses the Priority Pool entirely, so your conversion executes the moment your LINK is unbonded.

### 2.How does the migration work?

The process involves two steps, both done at [stake.link/migrate](https://stake.link/migrate):

1. Initiate Unbond: Connect the wallet holding your Community Pool stake and click "Unbond". This starts the unbonding period on the Chainlink Staking contract. The UI clearly displays the exact date and time your LINK will be fully unbonded.
2. Migrate: Once the unbonding period is complete, return to the app and click "Migrate". A single transaction converts your unbonded LINK, including any claimed native rewards, into an equivalent amount of stLINK, instantly.

Note: if you unbond but do not migrate some or all of your LINK, that LINK is restaked into the Community Pool after 7 days, per the Chainlink Staking contract's claim window.

### 3.Do I have to wait in the Priority Pool?

No. This is the defining benefit of the migration path: it bypasses the Priority Pool entirely. Your spot is guaranteed, the conversion executes the moment your LINK is unbonded, and you receive an equivalent amount of stLINK for your LINK in that single transaction.

### 4.Can I migrate using a hardware wallet?

Not yet. The migration flow currently relies on batched transactions, which hardware wallets do not support at this time. If your Community Pool stake is held on a hardware wallet, the migration UI will not work for it for now. Hardware wallet support is planned, and this FAQ and stake.link's official channels will be updated as soon as it is available.

### 5.Is the migration secure?

Yes. The stLINK token contract and the entire migration mechanism have been comprehensively audited by [Cyfrin](https://www.cyfrin.io/). As always: only interact with the official stake.link website and contracts, and be cautious of phishing sites. Standard gas fees apply; there is no protocol fee for migrating.

## III. Tokenomics & Economics

### 1.What is the SDL token and what is its utility?

SDL is the native governance and utility token of the stake.link protocol. Its tokenomics are designed to reward long-term, committed participants. Staking SDL provides users with reSDL NFTs (Reward Escrowed SDL), which grants three primary benefits:

1. Protocol Rewards: Earn a share of the protocol's revenue from a growing basket of LSTs. As stake.link adds more liquid staking tokens like `stPOL`, the fee streams distributed to `SDL` stakers diversify and grow.
2. Priority Staking Access: Receive priority in the Priority Pool, allowing your LINK to be staked ahead of non-reSDL holders.
3. Governance: Participate in DAO governance, such as voting on proposals (SLURPs) and electing council members.

### 2.What is the total supply and distribution of SDL?

The total supply of [SDL ](https://etherscan.io/token/0xa95c5ebb86e0de73b4fb8c47a45b792cfea28c23)is fixed at 100,000,000 tokens, and no more can be minted. The **initial** distribution is as follows:

* Community: 30%
* Treasury: 40.91%
* Core Contributors: 20%
* Ecosystem Partners: 7.69%
* Node Operators: 1.4%

### 3.What is reSDL?

[reSDL (Reward Escrowed SDL) ](https://etherscan.io/address/0x0b2ef910ad0b34bf575eb09d37fd7da6c148ca4d)is the token you receive when you stake your SDL in the stake.link protocol. It represents your staked position and is the key to unlocking the primary benefits of the platform, including protocol rewards, priority staking access, and governance rights.

When you stake SDL to get reSDL, your position is minted as an [NFT](https://chain.link/education/nfts). This NFT acts as a container or "position" for your reSDL balance. You can have multiple reSDL NFTs in your wallet, each representing a different amount of staked SDL with potentially different lock settings.

### 4.How do I get reSDL NFTs?

You get reSDL NFTs by staking your SDL tokens on the stake.link platform. When you stake, a reSDL NFT representing your position is minted to your wallet which represents the underlying SDL you've staked.

### 5.Does staking SDL give me more SDL tokens?

**No. Staking SDL does not generate more SDL tokens as inflationary rewards.** Instead, it allows you to earn a portion of the protocol's revenue, which is paid out in its LSTs (like stLINK). The "boost" from locking SDL increases your `reSDL` balance, not your underlying `SDL` balance.

### 6.What is the reSDL locking mechanism?

You can optionally lock your staked SDL for a set period to receive a greater amount of reSDL, which boosts your share of protocol rewards and governance weight. This reward escrow model, inspired by Curve's and Velodrome ("ve") model, is designed to reward long-term commitment to the protocol. The longer you lock, the larger the boost you receive on your reSDL balance.

### 7.How does the reSDL lock boost work?

Locking your reSDL provides a multiplier on the amount of reSDL you receive relative to the SDL you staked.

* No Lock: 1x multiplier
* 12-month lock: 3x multiplier
* 24-month lock: 5x multiplier
* 36-month lock: 7x multiplier
* 48-month lock: 9x multiplier

### 8.What are the lock and withdrawal periods for reSDL?

The reSDL locking system is designed to be straightforward and to reward long-term holders who remain staked. Here is the simple breakdown:

1. Maximum Boost Period: Your reSDL boost is set to the maximum level the moment you lock, based on the duration you chose. It remains at this maximum level indefinitely for as long as you do not take any action, even for years beyond your original lock commitment.
2. Initiating Withdrawal: You can choose to "Initiate Withdraw" once half of the duration of the initial lock has passed.
3. Unlock Period: The moment you click "Initiate Withdraw," two things happen: your boost is removed, and a final, fixed unlock timer begins. This timer is always equal to half of your original lock duration. Your yield that is decreased since the boost is removed will be forfeited to other SDL stakers.

### 9.How do I withdraw my staked SDL?

The process depends on whether your position is locked:

* If your SDL is not locked: You can [withdraw ](https://stake.link/withdraw)it at any time.
* If your SDL is time locked: You must first initiate the withdrawal process, after half of the duration of the initial lock has passed. Once you "Initiate Withdraw," **a final unlock period begins which lasts for half of your original lock duration**. After this period is complete, you can burn your reSDL NFT to reclaim your underlying SDL tokens.

### 10.Does reSDL guarantee access to LINK staking?

Depositing LINK in the Priority Pool from a wallet that holds reSDL NFTs will guarantee a portion of your LINK to be converted to stLINK at every stake captured. LINK deposits backed by reSDL are staked before deposits that are not. The more reSDL you hold, the greater your share of the available staking capacity will be relative to other reSDL holders.

Essentially, reSDL ensures you are first in line and that you get a fair share of every new stake, but the exact amount of LINK converted to stLINK depends on the total available capacity and the total amount of reSDL held by all depositors in the pool.

### 11.Can I transfer my reSDL NFTs to a different wallet?

Yes. The reSDL NFTs are standard ERC-721 tokens and can be transferred between wallets at any time, even when locked. When you transfer an reSDL NFT, you also transfer ownership of the underlying staked SDL and any unclaimed rewards (like stLINK) associated with that position.

If you have transferred the reSDL NFT from a wallet that currently have LINK in the Priority Pool, you will lose said priority.

### 12.Can I sell my reSDL NFTs?

Yes. Because they are standard NFTs, you can sell your reSDL positions on any compatible NFT marketplace like [OpenSea](https://opensea.io/). This allows for the transfer of staked and even locked positions between users.

### 13.Can I merge or split my reSDL NFT positions?

No, you can't merge separate `reSDL` NFT positions into one or split a single position into multiple NFTs.

Each `reSDL` NFT represents a unique, individual staking position.

While you can't merge or split them, you can modify a position in the following ways:

* Add More SDL: You can add more SDL to any of your existing NFT positions at any time. **However, be aware that doing this will reset the lock timer if that position is locked.**
* Create New Positions: You can always create a new, distinct NFT position by staking more SDL.

This means you can have multiple NFT positions, each with its own amount of SDL and its own unique lock period.

### 14.How are ecosystem airdrops (e.g., Chainlink's BUILD program) distributed?

All [BUILD airdrops](https://blog.chain.link/chainlink-build-program/) received by the protocol are distributed amongst its key stakeholders to reward their contribution to the ecosystem. The recipients are:

* stLINK holders (the liquid stakers)
* reSDL holders (the protocol's governors and long-term supporters)
* stLINK-LINK liquidity providers on Curve.

The distribution is calculated using a Time-Weighted Average (TWA) of a user's stake over a "season" to fairly reward sustained participation.

## IV. Technology & Security

### 1.Have the stake.link smart contracts been audited?

Security is a top priority for the stake.link protocol. All smart contracts undergo rigorous security audits from reputable third-party firms (CodeHawks, Cyfrin, Sigma Prime, Trust Security, Zellic) before deployment and after any significant upgrades. For the latest audit reports see our[ Github audits section](https://github.com/stakedotlink/contracts/tree/main/audits).

### 2.What proactive security measures does stake.link use beyond smart contract audits?

To ensure the highest level of security, stake.link employs a multi-layered defense strategy that goes beyond traditional audits. The protocol actively collaborates with two industry-leading security partners such as Hypernative for continuous, real-time protection.

* **Real-Time Threat Monitoring with Hypernative**: stake.link uses [Hypernative's](https://www.hypernative.io/) advanced CryptoSecOps platform for 24/7 monitoring of on-chain and off-chain activity. This service proactively detects and prevents a wide range of threats before they can impact the protocol, including economic exploits, governance attacks, oracle deviations, and phishing campaigns targeting the community. The system is integrated directly into our workflows to provide immediate alerts and automated responses.

### 3.How are the protocol's treasury and critical functions secured?

Critical protocol operations and the management of treasury funds are secured by a 6-of-8 multi-signature ([multi-sig](https://www.coinbase.com/en-it/learn/wallet/what-is-a-multi-signature-multi-sig-wallet)) wallet. This means that for any transaction to be executed, it must be approved by at least six of the eight designated signers. All on-chain actions executed by the multi-sig are also subject to a 24-hour timelock, providing an extra layer of security and allowing the community to review pending changes.

### 4.Who are the signers on the multi-sig wallet?

The multi-sig is managed by a diverse group of eight reputable and independent entities to ensure decentralization and robust security. The composition of the signers is designed to prevent collusion and includes:

* Core protocol contributors
* Long-standing top-tier Chainlink node operators
* A representative elected from the SDL DAO
* An independent, professional corporate services firm

This structure ensures that no single entity or group has unilateral control, and all critical actions require a broad consensus from key stakeholders across the ecosystem.

### 5.What are the general risks of using stake.link and other DeFi protocols?

While stake.link is built to high security standards, it operates in the [decentralized finance](https://chain.link/use-cases/defi) (DeFi) space, which carries inherent risks. These can include smart contract vulnerabilities (bugs), market volatility affecting asset prices, and liquidation risks when using assets as collateral. Users should always do their own research (DYOR) and understand the mechanics of the protocol and other protocols built on top of us.

### 6.What happens if stLINK de-pegs on secondary markets?

A "[de-peg](https://chain.link/education-hub/stablecoins)" means the market price on a decentralized exchange such as Curve has temporarily deviated from its underlying redemption value. This is typically a self-correcting issue driven by arbitrage. If the price drops, arbitrageurs buy the discounted token on the market and redeem it through the protocol for its full value, with their buying pressure pushing the price back up. While this market activity is normal, a *sustained* de-peg could signal a more serious issue, and users who use `wstLINK` as collateral should be aware of liquidation risks from sharp price drops.

### 7.What is wstLINK and how is it different from stLINK?

[wstLINK (Wrapped stLINK) ](https://etherscan.io/token/0x911d86c72155c33993d594b0ec7e6206b4c803da)is a non-rebasing version of stLINK designed for maximum compatibility with DeFi protocols. While your `stLINK` balance increases over time, the value of `wstLINK` itself increases. This makes it easier to use as collateral in lending markets or in other complex smart contracts that can't handle rebasing tokens. You can wrap your `stLINK` into `wstLINK` and unwrap it at any time.

## V. Ecosystem & Governance

### 1.What is the governance model of stake.link?

Since its founding, stake.link has transitioned to a decentralized governance model controlled by a DAO (Decentralized Autonomous Organization). This means that **stakers** of the native token, SDL, can participate in shaping the protocol's future through a representative governance structure. his includes voting on key decisions such as the integration of new LSTs into the index, treasury management, and the overall strategic direction of the protocol.

### 2.How can the community propose changes to the protocol?

Anyone can propose changes and upgrades through a SLURP (stake.link Upgrade Request Proposal). The process is as follows:

1. A proposal is written and submitted on the [official forums](https://talk.stake.link/).
2. A minimum timeframe of one week is typically given for community discussion or more if no consensus is initially reached and discussions are ongoing.
3. If there is no apparent consensus, a SLURP could be put up to a Snapshot vote where reSDL holders vote to decide. If approved, it goes to the final council vote.
4. Once general consensus is reached, the SLURP is posted for an on-chain vote via Snapshot for the Governance Council to ratify.

### 3.What is the Governance Council and what is its role?

The Governance Council is the elected representative body that oversees the protocol and is responsible for ratifying proposals on behalf of the DAO. It is comprised of seven members:

* 2 Core Contributors
* 1 NAIL (Network Aligned Individual Liaison)
* 2 Community Members
* 2 SDL Node Operators

### 4.How are community members elected to the Council?

The two community seats on the council are elected directly by the community. Any reSDL holder can vote for the candidates of their choice. Elections are held on a 6-month cycle, which is defined as an "epoch."

### 5.What is the NAIL (Network Aligned Individual Liaison) role?

The NAIL is an initiative to hire individuals as full or part-time contributors to the stake.link DAO. These individuals are compensated from the DAO treasury to dedicate their time to operational, strategic, and community-focused tasks that drive the protocol's growth and sustainability. Anyone can propose themselves as a NAIL representative via SLURPs.

### 6.What is "stakedotlink" and why does the DAO need a legal entity?

`stakedotlink` is the [official legal entity](https://talk.stake.link/t/slurp-30-stakedotlink-limited-stakedotlink-a-proposal-to-represent-the-stake-link-dao-the-dao-by-a-british-virgin-islands-company-limited-by-guarantee/203/) that represents the stake.link DAO, allowing it to operate in the traditional world. After careful consideration with legal counsel, a company limited by guarantee in the British Virgin Islands (BVI) was chosen as the most suitable structure.

This specific legal framework is essential for three key reasons:

1. Liability Protection: The BVI corporate structure provides a robust "corporate veil," which aims to protect individual token holders and DAO participants from being held personally liable for the DAO's collective actions.
2. Real-World Capabilities: It enables the DAO to perform necessary off-chain actions that require a legal person, such as signing contracts, paying for services, and interacting with other companies.
3. Flexibility and Neutrality: The BVI was specifically selected for its flexible corporate laws, tax-neutral environment, and familiarity within the digital asset industry, providing a stable and efficient foundation for the DAO's off-chain operations.

### 7.How does the community exercise its rights over the "stakedotlink" legal entity?

The legal framework was designed with community rights hardwired into its constitution. The Governance Council, which includes two community-elected members, has the power to direct the company's actions, including nominating or removing its director. Furthermore, in a novel design feature, any tokenholder has the right to be admitted as a "guarantee member" of the company, giving them direct legal standing to enforce its governance documents.

### 8.What is the role of the founding team (LinkPool) now that stake.link is a DAO?

LinkPool was instrumental in bootstrapping the protocol, handling the initial technical development and funding. While stake.link has now transitioned to a DAO-controlled structure, LinkPool remains a core technical contributor, helping with ongoing development. They hold seats on the governance council, but operate within the decentralized framework where the community, through Council, reSDL votes and SLURPs, **holds the ultimate power to guide the protocol's direction.**

### 9.What is the purpose of the DAO Treasury?

The [DAO Treasury](https://etherscan.io/address/0xB351EC0FEaF4B99FdFD36b484d9EC90D0422493D) funds strategic initiatives to grow the protocol. This can include funding development, security audits, ecosystem grants, liquidity incentives, or other programs approved by the Governance Council to ensure the long-term health and success of stake.link.

## VI. Polygon Liquid Staking - stPOL

### 1.What is stPOL?

[`stPOL` ](https://etherscan.io/token/0x2ff4390dB61F282Ef4E6D4612c776b809a541753)is stake.link's liquid staking token for Polygon's POL token. It allows users to stake their POL to help secure the Polygon network while receiving a liquid token (`stPOL`) that continues to accrue rewards and can be used in DeFi.

### 2.What are the benefits of using stPOL over native Polygon staking?

Staking through `stPOL` offers several advantages:

* Liquidity: Unlike natively staked POL which is locked, `stPOL` is a liquid asset that can be transferred or used in DeFi protocols.
* Competitive Rewards: `stPOL` provides a competitive yield by distributing MEV (Maximal Extractable Value) rewards back to stakers, in addition to standard staking rewards.
* DeFi Composability: Users receive a wrapped, DeFi-compatible version (`wstPOL`) for use on the Polygon PoS chain.

### 3.How does stPOL accrue yield?

Similar to `stLINK`, `stPOL` accrues yield through a rebasing mechanism. The staking rewards, including MEV, are calculated and distributed regularly by increasing the amount of `stPOL` in your wallet, effectively auto-compounding your position.

### 4.How do I stake POL and use it in DeFi?

The process is designed to give you a liquid token on Ethereum (`stPOL`) and a DeFi-compatible version for the Polygon network (`wstPOL`). Here are the steps:

1. Stake: Deposit your POL tokens on the Ethereum mainnet via the stake.link platform.
2. Receive stPOL: You will receive `stPOL`, the rebasing liquid staking token, in your Ethereum wallet.
3. Wrap to [wstPOL](https://etherscan.io/token/0x2091d83592D79B4De5fD2ce3D98679c32A9555e6): On the stake.link website, wrap your `stPOL` to get `wstPOL`, the non-rebasing, DeFi-friendly version.
4. Bridge: Bridge your `wstPOL` from the Ethereum mainnet to the Polygon PoS chain.
5. Participate in DeFi: Use your `wstPOL` in DeFi protocols, such as providing liquidity to the `wstPOL`/`WPOL` pool on Curve.

### 5.How is the DeFi liquidity for stPOL incentivized?

To ensure deep liquidity, the protocol applies a 3% DeFi-PoL (Protocol Owned Liquidity) fee from the `stPOL` rewards. This fee is used to incentivize liquidity providers (LPs) for pools like the `wstPOL`/`WPOL` pool on [Curve](https://www.curve.finance/dex/polygon/pools/factory-stable-ng-237/deposit), making it easier for users to trade the token at a fair market price and enable potential liquidations in lending and borrowing markets.

### 6.How do I withdraw my stPOL back to POL?

You can [withdraw ](https://stake.link/withdraw)your `stPOL` back to POL on the Ethereum mainnet by initiating a withdrawal request on the stake.link website. The unbonding period is typically **3-4 days**, which allows for the sync state between the Polygon and Ethereum chains to be confirmed securely. You can also swap wstPOL to WPOL on Curve if you are on the Polygon PoS chain.

### 7.What are the security practices and audits for stPOL?

To ensure the highest level of security, stake.link employs a multi-layered defense strategy that goes beyond traditional audits. The protocol actively collaborates with two industry-leading security partners such as Hypernative for continuous, real-time protection. The Polygon contracts are also audited and can be [viewed here](https://github.com/stakedotlink/contracts/blob/main/audits/\[2025-07-02]%20Zellic%20-%20Polygon%20Staking.pdf).

## VII. Espresso Liquid Staking - stESP

### 1.What is Espresso and stESP?

Espresso is a high-performance blockchain built for custom chains, apps, and financial systems that want the security of a decentralized network without sacrificing speed, connectivity, or architectural control. It provides fast, deterministic finality (subsecond soon) and real-time settlement, secured by a Byzantine Fault Tolerant, proof-of-stake consensus protocol with throughput designed to scale to millions of transactions per second.&#x20;

Unlike legacy blockchains competing to become the sole execution environment for the onchain economy, Espresso is designed to enable a more realistic outcome: an onchain economy that spans thousands of independent systems and applications that will need to safely interoperate in real time.

stESP is stake.link's liquid staking token for Espresso's ESP token. Stake ESP through stake.link to support decentralized sequencing while receiving stESP that accrues rewards and can be used in DeFi.

### 2.What are the benefits of stESP over native Espresso staking?

Staking through `stESP` offers several advantages:

* Liquidity: stESP is liquid and can be used across DeFi flows, unlike natively staked ESP.
* Continuous Reward Accrual: Rewards are reflected through the liquid token model while you hold stESP.
* DeFi Composability: Wrapped version (wstESP) is available for integrations that prefer non-rebasing assets.

### 3.How does stESP accrue yield?

Through rebasing, similar to other stake.link liquid staking tokens. Rewards are distributed by increasing stESP balance in your wallet, without a separate claim flow.

### 4.How do I stake ESP and use it in DeFi?

Stake: Deposit ESP via stake.link.\
Receive stESP in your wallet.\
Wrap to wstESP on stake.link when a DeFi integration requires non-rebasing tokens.\
Use wstESP in supported integrations as they roll out.

### 5.How is DeFi liquidity for stESP incentivized?

stESP/wstESP liquidity is supported through governance-approved incentive programs and protocol liquidity initiatives. Parameters can evolve over time and are published through official docs and governance updates.

### 6.How do I withdraw stESP back to ESP?

Initiate withdrawal on stake.link to redeem stESP back to ESP. Exit timing depends on current protocol queue and liquidity conditions. Market-liquidity routes may also be available depending on live integrations.

### 7.What are the security practices for stESP?

Same multi-layered defense as the broader protocol: Hypernative monitoring and dedicated contract audits. Espresso-specific validator uptime and slashing-related conditions are also monitored as part of protocol risk operations.

<br>


# SDL Pool

The `SDLPool` allows users to stake and/or lock SDL tokens and receive reSDL (Reward Escrowed SDL) in return. SDL stakers will receive a portion of protocol rewards proportional to the amount of reSDL they hold. They will also receieve priority staking access in the `PriorityPool` over non reSDL holders. A user's reSDL balance is represented by one or multiple NFTs which are minted when SDL is staked/locked in the pool.

If a user stakes but does not lock their SDL, they will receive an NFT representing reSDL at a 1:1 ratio to the SDL they staked. If a user locks their SDL, they will receive an additional boosted amount of reSDL depending on the duration they have chosen to lock for, resulting in a ratio greater than 1:1. The calculation for the amount of boost received for a specific amount of SDL and locking duration is handled by the `LinearBoostController`.

If an reSDL position is not locked, the underlying SDL can be withdrawn at any time. If a position is locked, the withdrawal period must be initiated before SDL can be withdrawn. The withdrawal period can only be initiated after at least half of the total locking duration has elapsed and the withdrawal period itself will have a duration of exactly half the total locking duration. For the duration of the withdrawal period, the boost amount for the position will be set to 0 and only after this period has elapsed, the underlying SDL can be withdrawn.

A user can hold any number of reSDL NFTs and NFTs are transferrable in all states but by transferring an NFT, the ownership of the underlying SDL is also transferred.

## ERC721 Functions

All standard IERC721 and IERC721Metadata functions are implemented for `SDLPool`

## View Functions

### name

Returns the name of the staking derivative token.

```solidity
function name() public view returns (string)
```

#### Return Values

| Name | Type   | Description       |
| ---- | ------ | ----------------- |
| name | string | Name of the token |

### symbol

Returns the symbol of the staking derivative token.

```solidity
function symbol() public view returns (string)
```

#### Return Values

| Name   | Type   | Description         |
| ------ | ------ | ------------------- |
| symbol | string | Symbol of the token |

### sdlToken

Returns the SDL token contract address.

```solidity
function sdlToken() public view returns (address)
```

#### Return Values

| Name     | Type    | Description       |
| -------- | ------- | ----------------- |
| sdlToken | address | SDL token address |

### boostController

Returns the boost controller contract address.

```solidity
function boostController() public view returns (address)
```

#### Return Values

| Name            | Type    | Description              |
| --------------- | ------- | ------------------------ |
| boostController | address | Boost controller address |

### lastLockId

Returns the last lock ID created.

```solidity
function lastLockId() public view returns (uint256)
```

#### Return Values

| Name       | Type    | Description  |
| ---------- | ------- | ------------ |
| lastLockId | uint256 | Last lock ID |

### totalEffectiveBalance

Returns the total effective balance (including boosts) staked in the pool.

```solidity
function totalEffectiveBalance() public view returns (uint256)
```

#### Return Values

| Name                  | Type    | Description             |
| --------------------- | ------- | ----------------------- |
| totalEffectiveBalance | uint256 | Total effective balance |

### delegatorPool

Returns the address of the delegator pool contract.

```solidity
function delegatorPool() public view returns (address)
```

#### Return Values

| Name          | Type    | Description            |
| ------------- | ------- | ---------------------- |
| delegatorPool | address | Delegator pool address |

### baseURI

Returns the base URI for all tokens.

```solidity
function baseURI() public view returns (string)
```

#### Return Values

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| baseURI | string | Base URI    |

### effectiveBalanceOf

Returns the effective stake balance of an account, including boosts.

```solidity
function effectiveBalanceOf(address _account) external view returns (uint256)
```

| Name      | Type    | Description     |
| --------- | ------- | --------------- |
| \_account | address | Account address |

#### Return Values

| Name             | Type    | Description             |
| ---------------- | ------- | ----------------------- |
| effectiveBalance | uint256 | Effective stake balance |

### balanceOf

Returns the number of locks owned by an account.

```solidity
function balanceOf(address _account) public view returns (uint256)
```

| Name      | Type    | Description     |
| --------- | ------- | --------------- |
| \_account | address | Account address |

#### Return Values

| Name    | Type    | Description     |
| ------- | ------- | --------------- |
| balance | uint256 | Number of locks |

### ownerOf

Returns the owner of a lock.

```solidity
function ownerOf(uint256 _lockId) public view returns (address)
```

| Name     | Type    | Description |
| -------- | ------- | ----------- |
| \_lockId | uint256 | Lock ID     |

#### Return Values

| Name  | Type    | Description |
| ----- | ------- | ----------- |
| owner | address | Lock owner  |

### getLocks

Returns the list of locks for the given lock IDs.

```solidity
function getLocks(uint256[] calldata _lockIds) external view returns (Lock[] memory)
```

| Name      | Type       | Description      |
| --------- | ---------- | ---------------- |
| \_lockIds | uint256\[] | List of lock IDs |

#### Return Values

| Name  | Type    | Description   |
| ----- | ------- | ------------- |
| locks | Lock\[] | List of locks |

### getLockIdsByOwner

Returns a list of lock IDs owned by an account.

```solidity
function getLockIdsByOwner(address _owner) external view returns (uint256[] memory)
```

| Name    | Type    | Description |
| ------- | ------- | ----------- |
| \_owner | address | Account     |

#### Return Values

| Name    | Type       | Description      |
| ------- | ---------- | ---------------- |
| lockIds | uint256\[] | List of lock IDs |

### staked

Returns an account's staked amount for use by reward pools.

```solidity
function staked(address _account) external view returns (uint256)
```

| Name      | Type    | Description     |
| --------- | ------- | --------------- |
| \_account | address | Account address |

#### Return Values

| Name   | Type    | Description   |
| ------ | ------- | ------------- |
| staked | uint256 | Staked amount |

### totalStaked

Returns the total staked amount for use by reward pools.

```solidity
function totalStaked() external view returns (uint256)
```

#### Return Values

| Name        | Type    | Description         |
| ----------- | ------- | ------------------- |
| totalStaked | uint256 | Total staked amount |

### supportedTokens

Returns a list of supported tokens.

```solidity
function supportedTokens() external view returns (address[] memory)
```

#### Return Values

| Name   | Type       | Description              |
| ------ | ---------- | ------------------------ |
| tokens | address\[] | List of supported tokens |

### isTokenSupported

Returns true/false for whether a given token is supported.

```solidity
function isTokenSupported(address _token) public view returns (bool)
```

| Name    | Type    | Description   |
| ------- | ------- | ------------- |
| \_token | address | Token address |

#### Return Values

| Name      | Type | Description        |
| --------- | ---- | ------------------ |
| supported | bool | Is token supported |

### tokenBalances

Returns balances of supported tokens within the controller.

```solidity
function tokenBalances() external view returns (address[] memory, uint256[] memory)
```

#### Return Values

| Name     | Type       | Description              |
| -------- | ---------- | ------------------------ |
| tokens   | address\[] | List of supported tokens |
| balances | uint256\[] | List of token balances   |

### withdrawableRewards

Returns a list of withdrawable rewards for an account.

```solidity
function withdrawableRewards(address _account) external view returns (uint256[] memory)
```

| Name      | Type    | Description     |
| --------- | ------- | --------------- |
| \_account | address | Account address |

#### Return Values

| Name    | Type       | Description                  |
| ------- | ---------- | ---------------------------- |
| rewards | uint256\[] | List of withdrawable rewards |

## Write Functions

### onTokenTransfer

ERC677 implementation to stake/lock SDL tokens or distribute rewards.

```solidity
function onTokenTransfer(address _sender, uint256 _value, bytes calldata _calldata) external
```

| Name       | Type    | Description                        |
| ---------- | ------- | ---------------------------------- |
| \_sender   | address | Sender address                     |
| \_value    | uint256 | Value transferred                  |
| \_calldata | bytes   | Encoded lockId and lockingDuration |

### extendLockDuration

Extends the locking duration of a lock.

```solidity
function extendLockDuration(uint256 _lockId, uint64 _lockingDuration) external
```

| Name              | Type    | Description          |
| ----------------- | ------- | -------------------- |
| \_lockId          | uint256 | Lock ID              |
| \_lockingDuration | uint64  | New locking duration |

### initiateUnlock

Initiates the unlock period for a lock.

```solidity
function initiateUnlock(uint256 _lockId) external
```

| Name     | Type    | Description |
| -------- | ------- | ----------- |
| \_lockId | uint256 | Lock ID     |

### withdraw

Withdraws unlocked SDL from a lock.

```solidity
function withdraw(uint256 _lockId, uint256 _amount) external
```

| Name     | Type    | Description        |
| -------- | ------- | ------------------ |
| \_lockId | uint256 | Lock ID            |
| \_amount | uint256 | Amount to withdraw |

### setBaseURI

Sets the base URI for all tokens.

```solidity
function setBaseURI(string calldata _baseURI) external
```

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| \_baseURI | string | Base URI    |

### setBoostController

Sets the boost controller contract.

```solidity
function setBoostController(address _boostController) external
```

| Name              | Type    | Description      |
| ----------------- | ------- | ---------------- |
| \_boostController | address | Boost controller |

### migrate

Used by the delegator pool to migrate user stakes to this contract.

```solidity
function migrate(address _sender, uint256 _amount, uint64 _lockingDuration) external
```

| Name              | Type    | Description      |
| ----------------- | ------- | ---------------- |
| \_sender          | address | Owner of lock    |
| \_amount          | uint256 | Amount to stake  |
| \_lockingDuration | uint64  | Duration of lock |

### distributeTokens

Distributes token balances to their respective rewards pools.

```solidity
function distributeTokens(address[] memory _tokens) public
```

| Name     | Type       | Description             |
| -------- | ---------- | ----------------------- |
| \_tokens | address\[] | List of token addresses |

### distributeToken

Distributes a token balance to its respective rewards pool.

```solidity
function distributeToken(address _token) public
```

| Name    | Type    | Description   |
| ------- | ------- | ------------- |
| \_token | address | Token address |

### withdrawRewards

Withdraws an account's earned rewards for a list of tokens.

```solidity
function withdrawRewards(address[] memory _tokens) public
```

| Name     | Type       | Description             |
| -------- | ---------- | ----------------------- |
| \_tokens | address\[] | List of token addresses |

### addToken

Adds a new token and its rewards pool.

```solidity
function addToken(address _token, address _rewardsPool) public
```

| Name          | Type    | Description        |
| ------------- | ------- | ------------------ |
| \_token       | address | Token to add       |
| \_rewardsPool | address | Token rewards pool |

### removeToken

Removes a supported token.

```solidity
function removeToken(address _token) external
```

| Name    | Type    | Description   |
| ------- | ------- | ------------- |
| \_token | address | Token address |


# Linear Boost Controller

When a user stakes SDL in the `SDLPool`, they can choose to lock it for a certain period of time gaining a boost depending on the duration of time they locked for. `LinearBoostController` handles the boost calculations to determine how much boosted reSDL an account will receive.

## View Functions

### maxLockingDuration

Returns the maximum duration that a lock can have

```solidity
function maxLockingDuration() external view returns (uint256)
```

#### Return Values

| Name               | Type    | Description          |
| ------------------ | ------- | -------------------- |
| maxLockingDuration | uint256 | max locking duration |

### maxBoost

Returns the maximum boost multiplier that can be received for a lock

```solidity
function maxBoost() external view returns (uint256)
```

#### Return Values

| Name     | Type    | Description          |
| -------- | ------- | -------------------- |
| maxBoost | uint256 | max boost multiplier |

### getBoostAmount

Returns the amount of boosted reSDL balance received for `_amount` of SDL with `_lockingDuration`

```solidity
function getBoostAmount(uint256 _amount, uint64 _lockingDuration) external view returns (uint256)
```

#### Parameters

| Name              | Type    | Description                    |
| ----------------- | ------- | ------------------------------ |
| \_amount          | uint256 | amount of tokens to lock       |
| \_lockingDuration | uint64  | duration of the locking period |

#### Return Values

| Name        | Type    | Description                                                           |
| ----------- | ------- | --------------------------------------------------------------------- |
| boostAmount | uint256 | amount of boost balance received in addition to the unboosted balance |

## Write Functions

### setMaxLockingDuration

Sets the maximum locking duration that a lock can have

```solidity
function setMaxLockingDuration(uint64 _maxLockingDuration) external
```

#### Parameters

| Name                 | Type   | Description                     |
| -------------------- | ------ | ------------------------------- |
| \_maxLockingDuration | uint64 | max locking duration in seconds |

### setMaxBoost

Sets the maximum boost multiplier that can be received for a lock

```solidity
function setMaxBoost(uint64 _maxBoost) external
```

#### Parameters

| Name       | Type   | Description          |
| ---------- | ------ | -------------------- |
| \_maxBoost | uint64 | max boost multiplier |


# Staking Allowance

SDL is a staking allowance token which enables stakers to earn a percentage of protocol rewards and grants stakers the right to priority staking access over non SDL holders.

## ERC20 Functions

All standard ERC20 functions are implemented for `StakingAllowance`

## Write Functions

### mint

Mints tokens to an account

```solidity
function mint(address _account, uint256 _amount) public
```

#### Parameters

| Name      | Type    | Description              |
| --------- | ------- | ------------------------ |
| \_account | address | Address to mint to       |
| \_amount  | uint256 | Amount of tokens to mint |

### mintToContract

Mints tokens to a contract on behalf of an account via ERC677

```solidity
function mintToContract(address _contract, address _account, uint256 _amount, bytes _calldata) public
```

#### Parameters

| Name       | Type    | Description                           |
| ---------- | ------- | ------------------------------------- |
| \_contract | address | Address of contract to send tokens to |
| \_account  | address | Address to mint to                    |
| \_amount   | uint256 | Amount of tokens to mint              |
| \_calldata | bytes   |                                       |

### burn

Burns tokens from the sender

```solidity
function burn(uint256 _amount) public
```

#### Parameters

| Name     | Type    | Description              |
| -------- | ------- | ------------------------ |
| \_amount | uint256 | Amount of tokens to burn |

### burnFrom

Burns `_amount` tokens from `_account`, deducting from the sender's allowance

```solidity
function burnFrom(address account, uint256 amount) public
```

#### Parameters

| Name      | Type    | Description              |
| --------- | ------- | ------------------------ |
| \_account | address | Address to burn from     |
| \_amount  | uint256 | Amount of tokens to burn |

### transferAndCall

Transfers tokens to an address and calls `onTokenTransfer` with additional data if the recipient is a contract

```solidity
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool)
```

#### Parameters

| Name    | Type    | Description                       |
| ------- | ------- | --------------------------------- |
| \_to    | address | Address to send the tokens to     |
| \_value | uint256 | Value of token transfer           |
| \_data  | bytes   | Calldata included in the transfer |

### transferAndCallWithSender

Similar to `transferAndCall` but allows the caller to specify a custom sender (used to mint allowance on behalf of an address and send to a contract fallback)

```solidity
function transferAndCallWithSender(address _sender, address _to, uint256 _value, bytes _data) private returns (bool)
```

#### Parameters

| Name     | Type    | Description                                                                   |
| -------- | ------- | ----------------------------------------------------------------------------- |
| \_sender | address | Specified sender of the tokens, the party who 'receives' them into a contract |
| \_to     | address | Contract address to send the tokens to                                        |
| \_value  | uint256 | Value of token transfer                                                       |
| \_data   | bytes   | Calldata included in the transfer                                             |


# Staking Pool

`StakingPool` is one of the most important pieces of the protocol as it handles the liquid staking of tokens. When a user stakes some amount of tokens (such as LINK), they receive liquid staking tokens (such as stLINK) at a 1:1 ratio. These liquid staking tokens represent a user’s staked balance and must be burned to withdraw the underlying tokens they represent.

Once tokens have been staked into the pool, they are deposited into one or more strategy contracts controlled by the pool. These strategies then take the deposited tokens and use them to earn rewards which are distributed to stakers.

*In the case of LINK staking, the tokens are deposited into the Chainlink staking contracts.*

The liquid staking token issued by `StakingPool` is a rebasing token so rewards will be automatically distributed to stakers without any action on their part. This is possible by using a “shares” accounting model where a share represents a certain percentage ownership of the pool. When a user stakes, they receive a number of shares determined by the ratio of total shares to total tokens in the pool. The amount of shares a user owns remains constant unless they stake or withdraw but the ratio of total shares to total tokens changes with each rebase so their shares will be worth more tokens after each rebase. The new token value of their shares will be automatically reflected in their token balance.

While unlikely, it is also possible for a rebase to be negative if strategies earned net negative rewards since the last rebase due to slashing penalties. In this case, each share will be worth less tokens so a user’s token balance will decrease.

## ERC20 Functions

All standard ERC20 functions are implemented for `StakingPool`

## View Functions

### token

Returns the staking token for the pool

```solidity
function token() external view returns (address)
```

#### Return Values

| Name  | Type    | Description              |
| ----- | ------- | ------------------------ |
| token | address | Address of staking token |

### priorityPool

Returns the address of the priority pool for this pool

```solidity
function priorityPool() external view returns (address)
```

#### Return Values

| Name         | Type    | Description              |
| ------------ | ------- | ------------------------ |
| priorityPool | address | address of priority pool |

### totalShares

Returns the total amount of shares in the pool

```solidity
function totalShares() external view returns (uint256)
```

#### Return Values

| Name         | Type    | Description              |
| ------------ | ------- | ------------------------ |
| sharesAmount | uint256 | Total shares in the pool |

### sharesOf

Returns the amount of shares owned by an account

```solidity
function sharesOf(address _account) public view returns (uint256)
```

#### Parameters

| Name      | Type    | Description        |
| --------- | ------- | ------------------ |
| \_account | address | Address of account |

#### Return Values

| Name          | Type    | Description                   |
| ------------- | ------- | ----------------------------- |
| sharesBalance | uint256 | Total shares owned by account |

### getSharesByStake

Returns the amount of shares that corresponds to an amount of stake

```solidity
function getSharesByStake(uint256 _amount) public view returns (uint256)
```

#### Parameters

| Name     | Type    | Description     |
| -------- | ------- | --------------- |
| \_amount | uint256 | Amount of stake |

#### Return Values

| Name         | Type    | Description                    |
| ------------ | ------- | ------------------------------ |
| sharesAmount | uint256 | Corresponding amount of shares |

### getStakeByShares

Returns the amount of stake that corresponds to an amount of shares

```solidity
function getStakeByShares(uint256 _amount) public view returns (uint256)
```

#### Parameters

| Name     | Type    | Description      |
| -------- | ------- | ---------------- |
| \_amount | uint256 | Amount of shares |

#### Return Values

| Name        | Type    | Description                   |
| ----------- | ------- | ----------------------------- |
| stakeAmount | uint256 | Corresponding amount of stake |

### totalStaked

Returns the total amount of tokens in the pool

```solidity
function totalStaked() external view returns (uint256)
```

#### Return Values

| Name         | Type    | Description              |
| ------------ | ------- | ------------------------ |
| stakedAmount | uint256 | Total tokens in the pool |

### getStrategies

Returns a list of all active strategies

```solidity
function getStrategies() external view returns (address[])
```

#### Return Values

| Name       | Type       | Description                         |
| ---------- | ---------- | ----------------------------------- |
| strategies | address\[] | List of strategy contract addresses |

### getFees

Returns a list of all fees

```solidity
function getFees() external view returns (struct StakingPool.Fee[])
```

#### Return Values

| Name | Type          | Description  |
| ---- | ------------- | ------------ |
| fees | struct Fee\[] | list of fees |

### getMaxDeposits

Returns the maximum amount of tokens that the pool can hold

```solidity
function getMaxDeposits() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description           |
| ----------- | ------- | --------------------- |
| maxDeposits | uint256 | maximum deposit limit |

### getMinDeposits

Returns the minimum amount of tokens that must remain in the pool

```solidity
function getMinDeposits() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description           |
| ----------- | ------- | --------------------- |
| minDeposits | uint256 | minimum deposit limit |

### getUnusedDeposits

Returns the amount of unused asset tokens sitting in this pool outside a strategy

*These tokens earn no yield and will be deposited ASAP on the next call to \_depositLiquidity*

```solidity
function getUnusedDeposits() external view returns (uint256)
```

#### Return Values

| Name           | Type    | Description             |
| -------------- | ------- | ----------------------- |
| unusedDeposits | uint256 | amount of unused tokens |

### getStrategyDepositRoom

Returns the sum of available deposit room across all strategies

*Does not account for unused deposits sitting in pool*

```solidity
function getStrategyDepositRoom() external view returns (uint256)
```

#### Return Values

| Name                | Type    | Description                          |
| ------------------- | ------- | ------------------------------------ |
| strategyDepositRoom | uint256 | available deposit room in strategies |

### canDeposit

Returns the total available deposit room for this pool

*Accounts for unused deposits sitting in pool*

```solidity
function canDeposit() external view returns (uint256)
```

#### Return Values

| Name       | Type    | Description            |
| ---------- | ------- | ---------------------- |
| canDeposit | uint256 | available deposit room |

### canWithdraw

Returns the total available withdrawal room for this pool

```solidity
function canWithdraw() external view returns (uint256)
```

#### Return Values

| Name        | Type    | Description               |
| ----------- | ------- | ------------------------- |
| canWithdraw | uint256 | available withdrawal room |

### getStrategyRewards

Returns the amount of rewards earned since the last call to updateStrategyRewards and the\
amount of fees that will be paid on the rewards

```solidity
function getStrategyRewards(uint256[] _strategyIdxs) external view returns (int256, uint256)
```

#### Parameters

| Name           | Type       | Description                                   |
| -------------- | ---------- | --------------------------------------------- |
| \_strategyIdxs | uint256\[] | Indexes of strategies to sum rewards/fees for |

#### Return Values

| Name    | Type    | Description   |
| ------- | ------- | ------------- |
| rewards | int256  | Total rewards |
| fees    | uint256 | Total fees    |

## Write Functions

### deposit

Deposits staking tokens and mints liquid staking tokens

```solidity
function deposit(address _account, uint256 _amount, bytes _data) external
```

#### Parameters

| Name      | Type    | Description                               |
| --------- | ------- | ----------------------------------------- |
| \_account | address | address of account to stake for           |
| \_amount  | uint256 | amount to stake                           |
| \_data    | bytes   | list of deposit data passed to strategies |

### withdraw

Withdraws staking tokens and burns liquid staking tokens

```solidity
function withdraw(address _account, address _receiver, uint256 _amount, bytes _data) external
```

#### Parameters

| Name       | Type    | Description                                  |
| ---------- | ------- | -------------------------------------------- |
| \_account  | address | Address of account to withdraw for           |
| \_receiver | address | Address to receive withdrawal                |
| \_amount   | uint256 | Amount to withdraw                           |
| \_data     | bytes   | list of withdrawal data passed to strategies |

### transferAndCall

Transfers tokens to an address and calls `onTokenTransfer` with additional data if the recipient is a contract

```solidity
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool)
```

#### Parameters

| Name    | Type    | Description                       |
| ------- | ------- | --------------------------------- |
| \_to    | address | Address to send the tokens to     |
| \_value | uint256 | Value of token transfer           |
| \_data  | bytes   | Calldata included in the transfer |

### strategyDeposit

Manually deposits asset tokens into a specific strategy

```solidity
function strategyDeposit(uint256 _index, uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description       |
| -------- | ------- | ----------------- |
| \_index  | uint256 | Index of strategy |
| \_amount | uint256 | Amount to deposit |

### strategyWithdraw

Manually withdraws asset tokens from a strategy

```solidity
function strategyWithdraw(uint256 _index, uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description        |
| -------- | ------- | ------------------ |
| \_index  | uint256 | Index of strategy  |
| \_amount | uint256 | Amount to withdraw |

### addStrategy

Adds a new strategy

```solidity
function addStrategy(address _strategy) external
```

#### Parameters

| Name       | Type    | Description                  |
| ---------- | ------- | ---------------------------- |
| \_strategy | address | Address of strategy contract |

### removeStrategy

Removes a strategy

```solidity
function removeStrategy(uint256 _index, bytes _strategyUpdateData, bytes _strategyWithdrawalData) external
```

#### Parameters

| Name                     | Type    | Description                        |
| ------------------------ | ------- | ---------------------------------- |
| \_index                  | uint256 | Index of strategy                  |
| \_strategyUpdateData     | bytes   | update data passed to strategy     |
| \_strategyWithdrawalData | bytes   | withdrawal data passed to strategy |

### reorderStrategies

Reorders strategies

```solidity
function reorderStrategies(uint256[] _newOrder) external
```

#### Parameters

| Name       | Type       | Description                                     |
| ---------- | ---------- | ----------------------------------------------- |
| \_newOrder | uint256\[] | List containing strategy indexes in a new order |

### addFee

Adds a new fee

```solidity
function addFee(address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description             |
| ---------------- | ------- | ----------------------- |
| \_receiver       | address | Address of fee receiver |
| \_feeBasisPoints | uint256 | Fee in basis points     |

### updateFee

Updates an existing fee

```solidity
function updateFee(uint256 _index, address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description             |
| ---------------- | ------- | ----------------------- |
| \_index          | uint256 | Index of fee            |
| \_receiver       | address | Address of fee receiver |
| \_feeBasisPoints | uint256 | Fee in basis points     |

### updateStrategyRewards

Distributes rewards/fees based on balance changes in strategies since the last update

```solidity
function updateStrategyRewards(uint256[] _strategyIdxs, bytes _data) public
```

#### Parameters

| Name           | Type       | Description                                 |
| -------------- | ---------- | ------------------------------------------- |
| \_strategyIdxs | uint256\[] | Indexes of strategies to update rewards for |
| \_data         | bytes      | update data passed to each strategy         |

### transferShares

Transfers shares from the sender to another account

```solidity
function transferShares(address _receipient, uint256 _sharesAmount) external
```

#### Parameters

| Name           | Type    | Description                   |
| -------------- | ------- | ----------------------------- |
| \_receipient   | address | account to transfer shares to |
| \_sharesAmount | uint256 | amount of shares to transfer  |

### transferShares

Transfers shares between accounts

```solidity
function transferSharesFrom(address _sender, address _receipient, uint256 _sharesAmount) external
```

#### Parameters

| Name           | Type    | Description                     |
| -------------- | ------- | ------------------------------- |
| \_sender       | address | account to transfer shares from |
| \_receipient   | address | account to transfer shares to   |
| \_sharesAmount | uint256 | amount of shares to transfer    |

### setPriorityPool

Sets the address of the priority pool

```solidity
function setPriorityPool(address _priorityPool) external
```

#### Parameters

| Name           | Type    | Description              |
| -------------- | ------- | ------------------------ |
| \_priorityPool | address | address of priority pool |

### setUnusedDepositLimit

Sets the maximum amount of unused deposits that can sit in the pool

```solidity
function setUnusedDepositLimit(uint256 _unusedDepositLimit) external
```

#### Parameters

| Name                 | Type    | Description                       |
| -------------------- | ------- | --------------------------------- |
| \_unusedDepositLimit | uint256 | maximum amount of unused deposits |

### setRebaseController

Sets the address of the rebase controller

```solidity
function setRebaseController(address _rebaseController) external
```

#### Parameters

| Name               | Type    | Description                  |
| ------------------ | ------- | ---------------------------- |
| \_rebaseController | address | address of rebase controller |

### burn

Burns the sender's liquid staking tokens, effectively donating their underlying stake to the pool

```solidity
function burn(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description    |
| -------- | ------- | -------------- |
| \_amount | uint256 | amount to burn |

### donateTokens

Deposits asset tokens into the pool without minting liquid staking tokens, effectively donating them to the pool

```solidity
function donateTokens(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description       |
| -------- | ------- | ----------------- |
| \_amount | uint256 | amount to deposit |


# Priority Pool

The `PriorityPool` allows users to queue asset tokens which are eventually deposited into a `StakingPool` when deposit room becomes available. The liquid staking tokens (LSTs) minted by the `StakingPool` are then distributed using a merkle tree.

Each user will continuously receive LSTs as more depositd are made into the `StakingPool` until they have received an amount equal to the amount of asset tokens they deposited into the `PriorityPool`. The rate at which each user receives LSTs is dependent on the user's reSDL balance in the `SDLPool`. A higher reSDL balance entitles the user to receive LSTs at a faster rate than a user with a smaller reSDL balance. Users that hold no reSDL can also deposit into the `PriorityPool` but they will receive no LSTs as long as there are users with deposits in the `PriorityPool` that also hold reSDL.

The secondary function of the `PriorityPool` is to act as a liquidity buffer for the `StakingPool` it deposits into. When a user redeems LSTs for the underlying asset token, these LSTs will be swapped with queued asset tokens from the `PriorityPool` if possible before queuing tokens in the `WithdrawalPool`. This both reduces gas costs for the user and ensures that the `StakingPool` earns the most yield possible as yield earning asset tokens remain in the pool instead of being withdrawn.

## View Functions

### token

Returns the address of the token this pool handles

```solidity
function token() external view returns (address)
```

#### Return Values

| Name  | Type    | Description      |
| ----- | ------- | ---------------- |
| token | address | address of token |

### stakingPool

Returns the address of the staking pool that this pool deposits into

```solidity
function stakingPool() external view returns (address)
```

#### Return Values

| Name        | Type    | Description             |
| ----------- | ------- | ----------------------- |
| stakingPool | address | address of staking pool |

### sdlPool

Returns the address of the SDL pool

```solidity
function sdlPool() external view returns (address)
```

#### Return Values

| Name    | Type    | Description         |
| ------- | ------- | ------------------- |
| sdlPool | address | address of SDL pool |

### distributionOracle

Returns the address of the oracle that handles distribution of liquid staking tokens

```solidity
function distributionOracle() external view returns (address)
```

#### Return Values

| Name               | Type    | Description                    |
| ------------------ | ------- | ------------------------------ |
| distributionOracle | address | address of distribution oracle |

### rebaseController

Returns the address of the rebase controller

```solidity
function rebaseController() external view returns (address)
```

#### Return Values

| Name             | Type    | Description                  |
| ---------------- | ------- | ---------------------------- |
| rebaseController | address | address of rebase controller |

### withdrawalPool

Returns the address of the withdrawal pool

```solidity
function withdrawalPool() external view returns (address)
```

#### Return Values

| Name           | Type    | Description                |
| -------------- | ------- | -------------------------- |
| withdrawalPool | address | address of withdrawal pool |

### queueDepositMin

Returns the minimum amount of tokens required to execute a deposit

```solidity
function queueDepositMin() external view returns (uint256)
```

#### Return Values

| Name       | Type    | Description           |
| ---------- | ------- | --------------------- |
| depositMin | uint256 | queue deposit minimum |

### queueDepositMax

Returns the maximum amount of tokens that can be deposited in a single deposit

```solidity
function queueDepositMax() external view returns (uint256)
```

#### Return Values

| Name       | Type    | Description           |
| ---------- | ------- | --------------------- |
| depositMax | uint256 | queue deposit maximum |

### poolStatus

Returns the current status of the pool

0 - OPEN (nothing disabled)\
1 - DRAINING (deposits disabled)\
2 - CLOSED (deposits/withdrawals disabled)

```solidity
function poolStatus() external view returns (PoolStatus)
```

#### Return Values

| Name       | Type       | Description                |
| ---------- | ---------- | -------------------------- |
| poolStatus | PoolStatus | current status of the pool |

### merkleRoot

Returns the merkle root for the latest distribution tree

```solidity
function merkleRoot() external view returns (bytes32)
```

#### Return Values

| Name       | Type    | Description         |
| ---------- | ------- | ------------------- |
| merkleRoot | bytes32 | current merkle root |

### ipfsHash

Returns the ipfs hash of the balance data for the latest distribution tree

```solidity
function ipfsHash() external view returns (bytes32)
```

#### Return Values

| Name     | Type    | Description      |
| -------- | ------- | ---------------- |
| ipfsHash | bytes32 | current ipfsHash |

### merkleTreeSize

Returns the number of unique addresses contained in the latest distribution tree

```solidity
function merkleTreeSize() external view returns (uint256)
```

#### Return Values

| Name           | Type    | Description              |
| -------------- | ------- | ------------------------ |
| merkleTreeSize | uint256 | current merkle tree size |

### totalQueued

Returns the total amount of token deposits in the pool waiting to be deposited into the staking pool

```solidity
function totalQueued() external view returns (uint256)
```

#### Return Values

| Name        | Type    | Description                |
| ----------- | ------- | -------------------------- |
| totalQueued | uint256 | total deposits in the pool |

### getAccounts

Returns a list of all accounts that have deposited into the pool in the order that they appear in the distribution tree

```solidity
function getAccounts() external view returns (address[])
```

#### Return Values

| Name     | Type       | Description      |
| -------- | ---------- | ---------------- |
| accounts | address\[] | list of accounts |

### getAccountIndex

Returns the index of an account representing it's position in the distribution tree

```solidity
function getAccountIndex(address _account) external view returns (uint256)
```

#### Parameters

| Name      | Type    | Description     |
| --------- | ------- | --------------- |
| \_account | address | account address |

#### Return Values

| Name  | Type    | Description   |
| ----- | ------- | ------------- |
| index | uint256 | account index |

### getQueuedTokens

Returns an account's current amount of deposits in the pool (`_distributionAmount` is stored on IPFS)

```solidity
function getQueuedTokens(address _account, uint256 _distributionAmount) public view returns (uint256)
```

#### Parameters

| Name                 | Type    | Description                                                     |
| -------------------- | ------- | --------------------------------------------------------------- |
| \_account            | address | account address                                                 |
| \_distributionAmount | uint256 | account's distribution amount from the latest distribution tree |

#### Return Values

| Name         | Type    | Description                         |
| ------------ | ------- | ----------------------------------- |
| queuedTokens | uint256 | amount of queued tokens for account |

### getLSDTokens

Returns an account's current amount of withdrawable liquid staking tokens (`_distributionShareAmount` is stored on IPFS)

```solidity
function getLSDTokens(address _account, uint256 _distributionShareAmount) external view returns (uint256)
```

#### Parameters

| Name                      | Type    | Description                                                            |
| ------------------------- | ------- | ---------------------------------------------------------------------- |
| \_account                 | address | account address                                                        |
| \_distributionShareAmount | uint256 | account's distribution share amounts from the latest distribution tree |

#### Return Values

| Name      | Type    | Description                         |
| --------- | ------- | ----------------------------------- |
| lsdTokens | uint256 | withdrawable LSD tokens for account |

### getLSDTokensBatch

Returns the current amount of withdrawable LSD tokens for multiple accounts.

```solidity
function getLSDTokensBatch(address[] calldata _accounts, uint256[] calldata _distributionShareAmounts) external view returns (uint256[] memory)
```

#### Parameters

| Name                       | Type       | Description                                 |
| -------------------------- | ---------- | ------------------------------------------- |
| \_accounts                 | address\[] | List of account addresses                   |
| \_distributionShareAmounts | uint256\[] | Distribution share amounts for each account |

#### Return Values

| Name      | Type       | Description                          |
| --------- | ---------- | ------------------------------------ |
| lsdTokens | uint256\[] | Withdrawable LSD tokens for accounts |

### canWithdraw

Returns the total amount of asset tokens that an account can withdraw (includes account's queued tokens and stLINK balance and takes into account both priority pool and staking pool liquidity)

```solidity
function canWithdraw(address _account, uint256 _distributionAmount) external view returns (uint256)
```

#### Parameters

| Name                 | Type    | Description                                                     |
| -------------------- | ------- | --------------------------------------------------------------- |
| \_account            | address | account address                                                 |
| \_distributionAmount | uint256 | account's distribution amount from the latest distribution tree |

#### Return Values

| Name        | Type    | Description                  |
| ----------- | ------- | ---------------------------- |
| canWithdraw | uint256 | amount of withrawable tokens |

### checkUpkeep

Returns whether a call should be made to performUpkeep to deposit queued/unused tokens\
into staking pool strategies

```solidity
function checkUpkeep(bytes) external view returns (bool, bytes)
```

#### Return Values

| Name         | Type  | Description                                    |
| ------------ | ----- | ---------------------------------------------- |
| upkeepNeeded | bool  | whether a call should be made to performUpkeep |
| upkeepNeeded | bytes | encoded amount of tokens to be deposited       |

### getDepositsSinceLastUpdate

Returns the amount of new deposits into the staking pool since the last call to updateDistribution and the amount of shares received for those deposits

```solidity
function getDepositsSinceLastUpdate() external view returns (uint256, uint256)
```

#### Return Values

| Name     | Type    | Description        |
| -------- | ------- | ------------------ |
| deposits | uint256 | amount of deposits |
| shares   | uint256 | amount of shares   |

### getAccountData

Returns account data used for calculating a new merkle tree

*A new merkle tree is calculated based on users' reSDL balance and the number of tokens they have queuedAccounts are returned in the same order as they are in the merkle tree*

```solidity
function getAccountData() external view returns (address[], uint256[], uint256[])
```

#### Return Values

| Name           | Type       | Description                                                                    |
| -------------- | ---------- | ------------------------------------------------------------------------------ |
| accounts       | address\[] | list of all accounts that have ever queued tokens                              |
| sdlBalances    | uint256\[] | list of SDL balances for each account                                          |
| queuedBalances | uint256\[] | list of queued token amounts for each account (ignores distributed LSD tokens) |

## Write Functions

### onTokenTransfer

ERC677 implementation to receive a token deposit or withdrawal

*Can receive both asset tokens (deposit) and liquid staking tokens (withdrawal)*

```solidity
function onTokenTransfer(address _sender, uint256 _value, bytes _calldata) external
```

#### Parameters

| Name       | Type    | Description                                                                               |
| ---------- | ------- | ----------------------------------------------------------------------------------------- |
| \_sender   | address | sender of the transfer                                                                    |
| \_value    | uint256 | value of the transfer                                                                     |
| \_calldata | bytes   | encoded shouldQueue (bool) and deposit data to pass to staking pool strategies (bytes\[]) |

### deposit

Deposits asset tokens into the staking pool and/or queues them

```solidity
function deposit(uint256 _amount, bool _shouldQueue, bytes _data) external
```

#### Parameters

| Name          | Type    | Description                                                            |
| ------------- | ------- | ---------------------------------------------------------------------- |
| \_amount      | uint256 | amount to deposit                                                      |
| \_shouldQueue | bool    | whether tokens should be queued if there's no room in the staking pool |
| \_data        | bytes   | deposit data passed to staking pool strategies                         |

### withdraw

Withdraws asset tokens

*Will unqueue sender's asset tokens before swapping liquid staking tokens if there is sufficient liquidity and \_shouldUnqueue is set to true*

```solidity
function withdraw(uint256 _amountToWithdraw, uint256 _amount, uint256 _sharesAmount, bytes32[] _merkleProof, bool _shouldUnqueue, bool _shouldUnqueueWithdrawal) external
```

#### Parameters

| Name                    | Type       | Description                                                                             |
| ----------------------- | ---------- | --------------------------------------------------------------------------------------- |
| \_amountToWithdraw      | uint256    | amount of tokens to withdraw                                                            |
| \_amount                | uint256    | amount as recorded in sender's merkle tree (stored on IPFS)entry                        |
| \_sharesAmount          | uint256    | shares amount as recorded in sender's merkle tree (stored on IPFS)entry                 |
| \_merkleProof           | bytes32\[] | merkle proof for sender's merkle tree entry (generated from IPFS data)                  |
| \_shouldUnqueue         | bool       | whether tokens should be unqueued before taking LSD tokens                              |
| \_shouldQueueWithdrawal | bool       | whether a withdrawal should be queued if the full withdrawal amount cannot be satisfied |

### unqueueTokens

Withdraws queued deposits from the priority pool

```solidity
function unqueueTokens(uint256 _amountToUnqueue, uint256 _amount, uint256 _sharesAmount, bytes32[] _merkleProof) external
```

#### Parameters

| Name              | Type       | Description                                                              |
| ----------------- | ---------- | ------------------------------------------------------------------------ |
| \_amountToUnqueue | uint256    | amount of tokens to unqueue                                              |
| \_amount          | uint256    | amount as recorded in sender's merkle tree entry (stored on IPFS)        |
| \_sharesAmount    | uint256    | shares amount as recorded in sender's merkle tree entry (stored on IPFS) |
| \_merkleProof     | bytes32\[] | merkle proof for sender's merkle tree entry (generated from IPFS data)   |

### claimLSDTokens

Claims withdrawable liquid staking tokens

```solidity
function claimLSDTokens(uint256 _amount, uint256 _sharesAmount, bytes32[] _merkleProof) external
```

#### Parameters

| Name           | Type       | Description                                             |
| -------------- | ---------- | ------------------------------------------------------- |
| \_amount       | uint256    | amount as recorded in sender's merkle tree entry        |
| \_sharesAmount | uint256    | shares amount as recorded in sender's merkle tree entry |
| \_merkleProof  | bytes32\[] | merkle proof for sender's merkle tree entry             |

### depositQueuedTokens

Deposits queued tokens and/or unused tokens sitting in staking pool

```solidity
function depositQueuedTokens(uint256 _queueDepositMin, uint256 _queueDepositMax, bytes[] _data) external
```

#### Parameters

| Name              | Type     | Description                                                                     |
| ----------------- | -------- | ------------------------------------------------------------------------------- |
| \_queueDepositMin | uint256  | min amount of tokens required for deposit into staking pool strategies          |
| \_queueDepositMax | uint256  | max amount of tokens that can be deposited into staking pool strategies at once |
| \_data            | bytes\[] | list of deposit data passed to staking pool strategies                          |

### performUpkeep

Deposits queued and/or unused tokens

```solidity
function performUpkeep(bytes _performData) external
```

#### Parameters

| Name          | Type     | Description                                                                     |
| ------------- | -------- | ------------------------------------------------------------------------------- |
| \_performData | bytes\[] | encoded list of deposit data to be passed to staking pool strategies (bytes\[]) |

### updateDistribution

Distributes a new batch of liquid staking tokens to users that have queued deposits

```solidity
function updateDistribution(bytes32 _merkleRoot, bytes32 _ipfsHash, uint256 _amountDistributed, uint256 _sharesAmountDistributed) external
```

#### Parameters

| Name                      | Type    | Description                                                            |
| ------------------------- | ------- | ---------------------------------------------------------------------- |
| \_merkleRoot              | bytes32 | new merkle root for the distribution tree                              |
| \_ipfsHash                | bytes32 | new ipfs hash for the distribution tree (CIDv0, no prefix - only hash) |
| \_amountDistributed       | uint256 | amount of LSD tokens distributed in this distribution                  |
| \_sharesAmountDistributed | uint256 | amount of LSD shares distributed in this distribution                  |

### executeQueuedWithdrawals

Executes a batch of withdrawals that have been queued in the withdrawal pool

*Withdraws tokens from the staking pool and sends them to the withdrawal pool*

```solidity
 function executeQueuedWithdrawals(uint256 _amount, bytes[] _data) external
```

#### Parameters

| Name     | Type    | Description                                               |
| -------- | ------- | --------------------------------------------------------- |
| \_amount | uint256 | total amount to withdraw                                  |
| \_data   | bytes   | list of withdrawal data passed to staking pool strategies |

### pauseForUpdate

Pauses queueing and unqueueing so a new merkle tree can be generated

```solidity
function pauseForUpdate() external
```

### setPoolStatus

Sets the pool's status

```solidity
function setPoolStatus(enum PriorityPool.PoolStatus _status) external
```

#### Parameters

| Name     | Type       | Description |
| -------- | ---------- | ----------- |
| \_status | PoolStatus | pool status |

### setQueueDepositParams

Sets the minimum and maximum amount that can be deposited into strategies at once

```solidity
function setQueueDepositParams(uint128 _queueDepositMin, uint128 _queueDepositMax) external
```

#### Parameters

| Name              | Type    | Description                                                                         |
| ----------------- | ------- | ----------------------------------------------------------------------------------- |
| \_queueDepositMin | uint128 | minimum amount of tokens required for deposit into staking pool strategies          |
| \_queueDepositMax | uint128 | maximum amount of tokens that can be deposited into staking pool strategies at once |

### setDistributionOracle

Sets the distribution oracle

```solidity
function setDistributionOracle(address _distributionOracle) external
```

#### Parameters

| Name                 | Type    | Description       |
| -------------------- | ------- | ----------------- |
| \_distributionOracle | address | address of oracle |

### setRebaseController

Sets the rebase controller

*This address has authorization to close the pool in case of emergency*

```solidity
function setRebaseController(address _rebaseController_) external
```

#### Parameters

| Name               | Type    | Description                  |
| ------------------ | ------- | ---------------------------- |
| \_rebaseController | address | address of rebase controller |

### setWithdrawalPool

Sets the withdrawal pool

```solidity
function setWithdrawalPool(address _withdrawalPool) external
```

#### Parameters

| Name             | Type    | Description                |
| ---------------- | ------- | -------------------------- |
| \_withdrawalPool | address | address of withdrawal pool |

### setAllowInstantWithdrawals

Sets whether instant withdrawals are enabled.

```solidity
function setAllowInstantWithdrawals(bool _allowInstantWithdrawals) external
```

#### Parameters

| Name                      | Type | Description                         |
| ------------------------- | ---- | ----------------------------------- |
| \_allowInstantWithdrawals | bool | Whether instant withdrawals enabled |

### allowInstantWithdrawals

Returns whether instant withdrawals are enabled.

```solidity
function allowInstantWithdrawals() external view returns (bool)
```

#### Return Values

| Name                    | Type | Description                         |
| ----------------------- | ---- | ----------------------------------- |
| allowInstantWithdrawals | bool | Whether instant withdrawals enabled |


# Withdrawal Pool

The `WithdrawalPool` allows users to queue LST withdrawals if there is insufficient liquidity in the `PriorityPool` to satisfy the withdrawal amount. LST withdrawals will be added to a FIFO queue and will be fulfilled as the `PriorityPool` receives new deposits and/or as funds become available for withdrawal within the `StakingPool`.

## View Functions

### token

Returns the address of the token this pool handles

```solidity
function token() external view returns (address)
```

#### Return Values

| Name  | Type    | Description      |
| ----- | ------- | ---------------- |
| token | address | address of token |

### lst

Returns the address of the liquid staking token this pool handles

```solidity
function lst() external view returns (address)
```

#### Return Values

| Name | Type    | Description    |
| ---- | ------- | -------------- |
| lst  | address | address of lst |

### priorityPool

Returns the address of the priority pool

```solidity
function priorityPool() external view returns (address)
```

#### Return Values

| Name         | Type    | Description              |
| ------------ | ------- | ------------------------ |
| priorityPool | address | address of Priority Pool |

### indexOfNextWithdrawal

Returns the index of the withdrawal that's at the front of the queue

```solidity
function indexOfNextWithdrawal() external view returns (uint256)
```

#### Return Values

| Name                  | Type    | Description                           |
| --------------------- | ------- | ------------------------------------- |
| indexOfNextwithdrawal | uint256 | index of withdrawal at front of queue |

### withdrawalBatchIdCutoff

Returns the index where all batches before have had all withdrawal requests fully withdrawn

```solidity
function withdrawalBatchIdCutoff() external view returns (uint128)
```

#### Return Values

| Name                    | Type    | Description     |
| ----------------------- | ------- | --------------- |
| withdrawalBatchIdCutoff | uint128 | batch id cutoff |

### withdrawalIdCutoff

Returns the index where all requests before have been fully withdrawn

```solidity
function withdrawalIdCutoff() external view returns (uint128)
```

#### Return Values

| Name               | Type    | Description          |
| ------------------ | ------- | -------------------- |
| withdrawalIdCutoff | uint128 | withdrawal id cutoff |

### minWithdrawalAmount

Returns the min amount of LSTs that can be queued for withdrawal

```solidity
function minWithdrawalAmount() external view returns (uint256)
```

#### Return Values

| Name                | Type    | Description           |
| ------------------- | ------- | --------------------- |
| minWithdrawalAmount | uint256 | min withdrawal amount |

### minTimeBetweenWithdrawals

Returns the min amount of time between execution of withdrawals

```solidity
function minTimeBetweenWithdrawals() external view returns (uint64)
```

#### Return Values

| Name                      | Type   | Description                  |
| ------------------------- | ------ | ---------------------------- |
| minTimeBetweenwithdrawals | uint64 | min time between withdrawals |

### timeOfLastWithdrawal

Returns the time of last execution of withdrawals

```solidity
function timeOfLastWithdrawal() external view returns (uint64)
```

#### Return Values

| Name                 | Type   | Description             |
| -------------------- | ------ | ----------------------- |
| timeOfLastWithdrawal | uint64 | time of last withdrawal |

### getTotalQueuedWithdrawals

Returns the total amount of liquid staking tokens queued for withdrawal

```solidity
function getTotalQueuedWithdrawals() external view returns (uint256)
```

#### Return Values

| Name                   | Type    | Description                        |
| ---------------------- | ------- | ---------------------------------- |
| totalQueuedWithdrawals | uint256 | total amount queued for withdrawal |

### getAccountTotalQueuedWithdrawals

Returns the total amount of liquid staking tokens queued for withdrawal by an account

```solidity
function getAccountTotalQueuedWithdrawals(address _account) external view returns (uint256)
```

#### Parameters

| Name      | Type    | Description        |
| --------- | ------- | ------------------ |
| \_account | address | address of account |

#### Return Values

| Name                          | Type    | Description                                |
| ----------------------------- | ------- | ------------------------------------------ |
| accountTotalQueuedWithdrawals | uint256 | total amount queued across all withdrawals |

### getWithdrawals

Returns a list of withdrawals

```solidity
function getWithdrawals(uint256[] _withdrawalIds) external view returns (struct WithdrawalPool.Withdrawal[])
```

#### Parameters

| Name            | Type       | Description            |
| --------------- | ---------- | ---------------------- |
| \_withdrawalIds | uint256\[] | list of withdrawal ids |

#### Return Values

| Name        | Type                                | Description                                         |
| ----------- | ----------------------------------- | --------------------------------------------------- |
| withdrawals | struct WithdrawalPool.Withdrawal\[] | list of withdrawals corresponding to withdrawal ids |

### getBatchIds

Returns batch ids for a list of withdrawals

```solidity
function getBatchIds(uint256[] _withdrawalIds) public view returns (uint256[])
```

#### Parameters

| Name            | Type       | Description           |
| --------------- | ---------- | --------------------- |
| \_withdrawalIds | uint256\[] | list of withrawal ids |

#### Return Values

| Name     | Type       | Description                                       |
| -------- | ---------- | ------------------------------------------------- |
| batchIds | uint256\[] | list of batch ids corresponding to withdrawal ids |

### getWithdrawalIdsByOwner

Returns a list of withdrawal ids owned by an account

```solidity
function getWithdrawalIdsByOwner(address _account) public view returns (uint256[])
```

#### Parameters

| Name      | Type    | Description        |
| --------- | ------- | ------------------ |
| \_account | address | address of account |

#### Return Values

| Name          | Type       | Description            |
| ------------- | ---------- | ---------------------- |
| withdrawalIds | uint256\[] | list of withdrawal ids |

### getFinalizedWithdrawalIdsByOwner

Returns a list of finalized and partially finalized withdrawal ids owned by an account

*These withdrawals have funds available for the owner to withdraw*

```solidity
function getFinalizedWithdrawalIdsByOwner(address _account) external view returns (uint256[], uint256)
```

#### Parameters

| Name      | Type    | Description        |
| --------- | ------- | ------------------ |
| \_account | address | address of account |

#### Return Values

| Name          | Type       | Description                                         |
| ------------- | ---------- | --------------------------------------------------- |
| withdrawalIds | uint256\[] | list of withdrawal ids                              |
| withdrawable  | uint256    | total withdrawable across all account's withdrawals |

### checkUpkeep

Returns whether withdrawals should be executed based on available withdrawal space

```solidity
function checkUpkeep(bytes) external view returns (bool, bytes)
```

#### Return Values

| Name         | Type  | Description                                            |
| ------------ | ----- | ------------------------------------------------------ |
| upkeepNeeded | bool  | true if withdrawal should be executed, false otherwise |
|              | bytes |                                                        |

## Write Functions

### withdraw

Executes a group of fully and/or partially finalized withdrawals owned by the sender

```solidity
function withdraw(uint256[] _withdrawalIds, uint256[] _batchIds) external
```

#### Parameters

| Name            | Type       | Description                                       |
| --------------- | ---------- | ------------------------------------------------- |
| \_withdrawalIds | uint256\[] | list of withdrawal ids to execute                 |
| \_batchIds      | uint256\[] | list of batch ids corresponding to withdrawal ids |

### forceWithdraw

Executes a group of fully finalized withdrawals (owner-only)

```solidity
function forceWithdraw(uint256[] _withdrawalIds, uint256[] _batchIds) external
```

#### Parameters

| Name            | Type       | Description                                       |
| --------------- | ---------- | ------------------------------------------------- |
| \_withdrawalIds | uint256\[] | list of withdrawal ids to execute                 |
| \_batchIds      | uint256\[] | list of batch ids corresponding to withdrawal ids |

### queueWithdrawal

Queues a withdrawal of liquid staking tokens for an account

```solidity
function queueWithdrawal(address _account, uint256 _amount) external
```

#### Parameters

| Name      | Type    | Description        |
| --------- | ------- | ------------------ |
| \_account | address | address of account |
| \_amount  | uint256 | amount of LST      |

### deposit

Deposits asset tokens in exchange for liquid staking tokens, finalizing withdrawals\
starting from the front of the queue

```solidity
function deposit(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| \_amount | uint256 | amount of tokens to deposit |

### performUpkeep

Executes withdrawals if there is sufficient available withdrawal space

```solidity
function performUpkeep(bytes _performData) external
```

#### Parameters

| Name          | Type  | Description                                                       |
| ------------- | ----- | ----------------------------------------------------------------- |
| \_performData | bytes | encoded list of withdrawal data passed to staking pool strategies |

### updateWithdrawalBatchIdCutoff

Updates the withdrawalBatchIdCutoff

*This value is used to more efficiently return data in getBatchIds by skipping old withdrawal batches*

```solidity
function updateWithdrawalBatchIdCutoff() external
```

### setMinWithdrawalAmount

Sets the minimum amount of liquid staking tokens that can be queued for withdrawal

```solidity
function setMinWithdrawalAmount(uint256 _minWithdrawalAmount) external
```

#### Parameters

| Name                  | Type    | Description          |
| --------------------- | ------- | -------------------- |
| \_minWithdrawalAmount | uint256 | minimum token amount |

### setMinTimeBetweenWithdrawals

Sets the minimum amount of of time between calls to performUpkeep to finalize withdrawals

```solidity
function setMinTimeBetweenWithdrawals(uint64 _minTimeBetweenWithdrawals) external
```

#### Parameters

| Name                        | Type   | Description  |
| --------------------------- | ------ | ------------ |
| \_minTimeBetweenWithdrawals | uint64 | minimum time |


# Wrapped SD Token

`WrappedSDToken` wraps rebasing liquid staking tokens (such as stLINK) with a normal ERC20 token.

## ERC20 Functions

All standard ERC20 functions are implemented for `WrappedSDToken`

## View Functions

### sdToken

Returns the underlying staking receipt token that this contract wraps

```solidity
function sdToken() external view returns (address)
```

#### Return Values

| Name    | Type    | Description                      |
| ------- | ------- | -------------------------------- |
| sdToken | address | Address of staking receipt token |

### getWrappedByUnderlying

Returns the amount of wrapped tokens that corresponds an amount of unwrapped tokens

```solidity
function getWrappedByUnderlying(uint256 _amount) external view returns (uint256)
```

#### Parameters

| Name     | Type    | Description                |
| -------- | ------- | -------------------------- |
| \_amount | uint256 | Amount of unwrapped tokens |

#### Return Values

| Name          | Type    | Description                            |
| ------------- | ------- | -------------------------------------- |
| wrappedAmount | uint256 | Amount of corresponding wrapped tokens |

### getUnderlyingByWrapped

Returns the amount of unwrapped tokens that corresponds to an amount of wrapped tokens

```solidity
function getUnderlyingByWrapped(uint256 _amount) external view returns (uint256)
```

#### Parameters

| Name     | Type    | Description              |
| -------- | ------- | ------------------------ |
| \_amount | uint256 | Amount of wrapped tokens |

#### Return Values

| Name            | Type    | Description                              |
| --------------- | ------- | ---------------------------------------- |
| unwrappedAmount | uint256 | Corresponding amount of unwrapped tokens |

## Write Functions

### onTokenTransfer

ERC677 implementation that proxies wrapping

```solidity
function onTokenTransfer(address _sender, uint256 _value, bytes) external
```

#### Parameters

| Name     | Type    | Description                  |
| -------- | ------- | ---------------------------- |
| \_sender | address | Sender of the token transfer |
| \_value  | uint256 | Value of the token transfer  |
|          | bytes   |                              |

### wrap

Wraps tokens

```solidity
function wrap(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description                        |
| -------- | ------- | ---------------------------------- |
| \_amount | uint256 | Amount of unwrapped tokens to wrap |

### unwrap

Unwraps tokens

```solidity
function unwrap(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description                        |
| -------- | ------- | ---------------------------------- |
| \_amount | uint256 | Amount of wrapped tokens to unwrap |

### transferAndCall

Transfers tokens to an address and calls `onTokenTransfer` with additional data if the recipient is a contract

```solidity
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool)
```

#### Parameters

| Name    | Type    | Description                       |
| ------- | ------- | --------------------------------- |
| \_to    | address | Address to send the tokens to     |
| \_value | uint256 | Value of token transfer           |
| \_data  | bytes   | Calldata included in the transfer |


# WrappedTokenBridge

The `WrappedTokenBridge` enables users to wrap a token and transfer it to another chain in a single transaction using CCIP. Additionally it can receive a CCIP token transfer from another chain and automatically unwrap tokens before sending them to their final destination.

*This contract is used to handle stLINK <-> wstLINK transfers between the primary chain and secondary chains.*

## View Functions

### getRouter

Returns the current CCIP router

```solidity
function getRouter() public view returns (address)
```

#### Return Values

| Name   | Type    | Description    |
| ------ | ------- | -------------- |
| router | address | router address |

### linkToken

Returns the address of the LINK token

```solidity
function linkToken() external view returns (address)
```

#### Return Values

| Name      | Type    | Description           |
| --------- | ------- | --------------------- |
| linkToken | address | address of LINK token |

### token

Returns the address of the underlying token bridged by this contract

```solidity
function token() external view returns (address)
```

#### Return Values

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| underlyingToken | address | address of underlying token |

### wrappedToken

Returns the address of the wrapped token bridged by this contract

```solidity
function wrappedToken() external view returns (address)
```

#### Return Values

| Name         | Type    | Description              |
| ------------ | ------- | ------------------------ |
| wrappedToken | address | address of wrapped token |

### getFee

Returns the current fee for a token transfer

```solidity
function getFee(uint64 _destinationChainSelector, uint256 _amount, bool _payNative) external view returns (uint256)
```

#### Parameters

| Name                       | Type    | Description                                      |
| -------------------------- | ------- | ------------------------------------------------ |
| \_destinationChainSelector | uint64  | id of destination chain                          |
| \_amount                   | uint256 | amount of tokens to transfer                     |
| \_payNative                | bool    | whether fee should be paid natively or with LINK |

#### Return Values

| Name | Type    | Description |
| ---- | ------- | ----------- |
| fee  | uint256 | current fee |

## Write Functions

### setRouter

Sets the CCIP router

```solidity
function setRouter(address _router) external
```

#### Parameters

| Name     | Type    | Description    |
| -------- | ------- | -------------- |
| \_router | address | router address |

### onTokenTransfer

ERC677 implementation to receive a token transfer to be wrapped and sent to a destination chain

```solidity
function onTokenTransfer(address _sender, uint256 _value, bytes _calldata) external
```

#### Parameters

| Name       | Type    | Description                                                                                                |
| ---------- | ------- | ---------------------------------------------------------------------------------------------------------- |
| \_sender   | address | address of sender                                                                                          |
| \_value    | uint256 | amount of tokens transferred                                                                               |
| \_calldata | bytes   | encoded calldata consisting of destinationChainSelector (uint64), receiver (address), maxLINKFee (uint256) |

### transferTokens

Wraps and transfers tokens to a destination chain

```solidity
function transferTokens(uint64 _destinationChainSelector, address _receiver, uint256 _amount, bool _payNative, uint256 _maxLINKFee) external payable returns (bytes32 messageId)
```

#### Parameters

| Name                       | Type    | Description                                      |
| -------------------------- | ------- | ------------------------------------------------ |
| \_destinationChainSelector | uint64  | id of destination chain                          |
| \_receiver                 | address | address to receive tokens on destination chain   |
| \_amount                   | uint256 | amount of tokens to transfer                     |
| \_payNative                | bool    | whether fee should be paid natively or with LINK |
| \_maxLINKFee               | uint256 | call will revert if LINK fee exceeds this value  |

### recoverTokens

Withdraws tokens held by this contract

```solidity
function recoverTokens(address[] _tokens, uint256[] _amounts, address _receiver) external
```

#### Parameters

| Name       | Type       | Description                               |
| ---------- | ---------- | ----------------------------------------- |
| \_tokens   | address\[] | list of tokens to withdraw                |
| \_amounts  | uint256\[] | list of corresponding amounts to withdraw |
| \_receiver | address    | address to receive tokens                 |


# Rebase Controller

`RebaseController` is responsible for initiating rebases to distribute rewards in the `StakingPool` and handling emergency pausing and reopening of the pool. It acts as a security and automation layer, ensuring that rewards are updated regularly and that the pool can be paused or reopened in response to detected losses or emergencies.

## View Functions

### stakingPool

Returns the address of the staking pool.

```solidity
function stakingPool() external view returns (address)
```

#### Return Values

| Name        | Type    | Description             |
| ----------- | ------- | ----------------------- |
| stakingPool | address | Address of staking pool |

### priorityPool

Returns the address of the priority pool.

```solidity
function priorityPool() external view returns (address)
```

#### Return Values

| Name         | Type    | Description              |
| ------------ | ------- | ------------------------ |
| priorityPool | address | Address of priority pool |

### securityPool

Returns the address of the security pool.

```solidity
function securityPool() external view returns (address)
```

#### Return Values

| Name         | Type    | Description              |
| ------------ | ------- | ------------------------ |
| securityPool | address | Address of security pool |

### emergencyPauser

Returns the address authorized to pause the pool in case of emergency.

```solidity
function emergencyPauser() external view returns (address)
```

#### Return Values

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| emergencyPauser | address | Address of emergency pauser |

### rewardsUpdater

Returns the address authorized to update rewards.

```solidity
function rewardsUpdater() external view returns (address)
```

#### Return Values

| Name           | Type    | Description                |
| -------------- | ------- | -------------------------- |
| rewardsUpdater | address | Address of rewards updater |

### checkUpkeep

Checks if a loss has been detected in any strategy.

```solidity
function checkUpkeep(bytes calldata) external view returns (bool upkeepNeeded, bytes memory performData)
```

#### Return Values

| Name         | Type  | Description                                    |
| ------------ | ----- | ---------------------------------------------- |
| upkeepNeeded | bool  | True if a loss is detected in any strategy     |
| performData  | bytes | Encoded index of strategy with a loss (if any) |

## Write Functions

### updateRewards

Updates strategy rewards in the staking pool.

```solidity
function updateRewards(bytes calldata _data) external
```

#### Parameters

| Name   | Type  | Description                        |
| ------ | ----- | ---------------------------------- |
| \_data | bytes | Encoded data to pass to strategies |

### performUpkeep

Pauses the priority pool if a loss has been detected in a strategy.

```solidity
function performUpkeep(bytes calldata _performData) external
```

#### Parameters

| Name          | Type  | Description                           |
| ------------- | ----- | ------------------------------------- |
| \_performData | bytes | Encoded index of strategy with a loss |

### pausePool

Pauses the priority pool in the case of an emergency.

```solidity
function pausePool() external
```

*No parameters.*

### reopenPool

Reopens the priority pool and security pool after they were paused due to a loss, and updates strategy rewards.

```solidity
function reopenPool(bytes calldata _data) external
```

#### Parameters

| Name   | Type  | Description                        |
| ------ | ----- | ---------------------------------- |
| \_data | bytes | Encoded data to pass to strategies |

### setEmergencyPauser

Sets the address authorized to pause the pool in case of emergency.

```solidity
function setEmergencyPauser(address _emergencyPauser) external
```

#### Parameters

| Name              | Type    | Description                 |
| ----------------- | ------- | --------------------------- |
| \_emergencyPauser | address | Address of emergency pauser |

### setRewardsUpdater

Sets the address authorized to update rewards.

```solidity
function setRewardsUpdater(address _rewardsUpdater) external
```

#### Parameters

| Name             | Type    | Description                |
| ---------------- | ------- | -------------------------- |
| \_rewardsUpdater | address | Address of rewards updater |


# LST Rewards Splitter Controller

The `LSTRewardsSplitterController` manages multiple `LSTRewardsSplitter` contracts.

## View Functions

### splitters

Returns the splitter corresponding to an account

```solidity
function splitters(address _account) external view returns (address)
```

#### Parameters

| Name    | Type    | Description        |
| ------- | ------- | ------------------ |
| account | address | address of account |

#### Return Values

| Name     | Type    | Description                                  |
| -------- | ------- | -------------------------------------------- |
| splitter | address | address of splitter corresponding to account |

### lst

Returns the min amount of new rewards required to split

```solidity
function lst() external view returns (address)
```

#### Return Values

| Name | Type    | Description    |
| ---- | ------- | -------------- |
| lst  | address | address of LST |

### rewardThreshold

Returns the address of the liquid staking token handled by this contract

```solidity
function rewardThreshold() external view returns (uint256)
```

#### Return Values

| Name            | Type    | Description      |
| --------------- | ------- | ---------------- |
| rewardThreshold | uint256 | reward threshold |

### getAccounts

Returns a list of all accounts that have splitters

```solidity
function getAccounts() external view returns (address[])
```

#### Return Values

| Name     | Type       | Description      |
| -------- | ---------- | ---------------- |
| accounts | address\[] | list of accounts |

### checkUpkeep

Returns whether a call should be made to performUpkeep to split new rewards

```solidity
function checkUpkeep(bytes) external view returns (bool, bytes)
```

#### Return Values

| Name         | Type  | Description                                             |
| ------------ | ----- | ------------------------------------------------------- |
| upkeepNeeded | bool  | true if performUpkeep should be called, false otherwise |
| performData  | bytes | abi encoded list of splitters to call                   |

## Write Functions

### onTokenTransfer

ERC677 implementation to receive an LST deposit

```solidity
function onTokenTransfer(address _sender, uint256 _value, bytes) external
```

#### Parameters

| Name     | Type    | Description       |
| -------- | ------- | ----------------- |
| \_sender | address | address of sender |
| \_value  | uint256 | value of transfer |

### withdraw

Withdraws tokens

```solidity
function withdraw(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description        |
| -------- | ------- | ------------------ |
| \_amount | uint256 | amount to withdraw |

### performUpkeep

Splits new rewards between receivers

```solidity
function performUpkeep(bytes _performData) external
```

#### Parameters

| Name          | Type  | Description                           |
| ------------- | ----- | ------------------------------------- |
| \_performData | bytes | abi encoded list of splitters to call |

### addSplitter

Deploys a new splitter

```solidity
function addSplitter(address _account, struct LSTRewardsSplitter.Fee[] _fees) external
```

#### Parameters

| Name      | Type                             | Description                               |
| --------- | -------------------------------- | ----------------------------------------- |
| \_account | address                          | address of account to deploy splitter for |
| \_fees    | struct LSTRewardsSplitter.Fee\[] | list of splitter fees                     |

### removeSplitter

Removes an account's splitter

```solidity
function removeSplitter(address _account) external
```

#### Parameters

| Name      | Type    | Description        |
| --------- | ------- | ------------------ |
| \_account | address | address of account |

### setRewardThreshold

Sets the min amount of new rewards required to split

```solidity
function setRewardThreshold(uint256 _rewardThreshold) external
```

#### Parameters

| Name              | Type    | Description                                 |
| ----------------- | ------- | ------------------------------------------- |
| \_rewardThreshold | uint256 | min amount of new rewards required to split |


# LST Rewards Splitter

The `LSTRewardsSplitter` enables an account to deposit LSTs and split any earned rewards between itself and other addresses.

## View Functions

### controller

Returns the address of the controller contract

```solidity
function controller() external view returns (address)
```

#### Return Values

| Name       | Type    | Description                             |
| ---------- | ------- | --------------------------------------- |
| controller | address | address of LSTRewardsSplitterController |

### lst

Returns the address of the liquid staking token handled by this contract

```solidity
function lst() external view returns (address)
```

#### Return Values

| Name | Type    | Description    |
| ---- | ------- | -------------- |
| lst  | address | address of LST |

### principalDeposits

Returns the total number of tokens deposited without rewards

```solidity
function stakingPool() external view returns (uint256)
```

#### Return Values

| Name              | Type    | Description              |
| ----------------- | ------- | ------------------------ |
| principalDeposits | uint256 | total principal deposits |

### checkUpkeep

Returns whether a call should be made to performUpkeep to split new rewards

```solidity
function checkUpkeep(bytes) external view returns (bool, bytes)
```

#### Return Values

| Name         | Type  | Description                                             |
| ------------ | ----- | ------------------------------------------------------- |
| upkeepNeeded | bool  | true if performUpkeep should be called, false otherwise |
|              | bytes |                                                         |

### getFees

Returns a list of all fees

```solidity
function getFees() external view returns (struct LSTRewardsSplitter.Fee[])
```

#### Return Values

| Name | Type                             | Description  |
| ---- | -------------------------------- | ------------ |
| fees | struct LSTRewardsSplitter.Fee\[] | list of fees |

## Write Functions

### deposit

Deposits tokens

```solidity
function deposit(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description       |
| -------- | ------- | ----------------- |
| \_amount | uint256 | amount to deposit |

### withdraw

Withdraws tokens

```solidity
function withdraw(uint256 _amount, address _receiver) external
```

#### Parameters

| Name       | Type    | Description               |
| ---------- | ------- | ------------------------- |
| \_amount   | uint256 | amount to withdraw        |
| \_receiver | address | address to receive tokens |

### performUpkeep

Splits new rewards between fee receivers

```solidity
function performUpkeep(bytes) external
```

### splitRewards

Splits new rewards between fee receivers

*Bypasses rewardThreshold*

```solidity
function splitRewards() external
```

### addFee

Adds a new fee

```solidity
function addFee(address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description         |
| ---------------- | ------- | ------------------- |
| \_receiver       | address | receiver of fee     |
| \_feeBasisPoints | uint256 | fee in basis points |

### updateFee

Updates an existing fee

```solidity
function updateFee(uint256 _index, address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description         |
| ---------------- | ------- | ------------------- |
| \_index          | uint256 | index of fee        |
| \_receiver       | address | receiver of fee     |
| \_feeBasisPoints | uint256 | fee in basis points |


# Rewards Pool

`RewardsPool` handles the distribution of a single token to a parent pool such as the `SDLPool`. A parent pool may control multiple `RewardsPools` if stakers receive rewards in the form of multiple different tokens.

## View Functions

### token

Returns the address of the rewards token this pool distributes

```solidity
function token() external view returns (address)
```

#### Return Values

| Name  | Type    | Description              |
| ----- | ------- | ------------------------ |
| token | address | Address of rewards token |

### withdrawableRewards

Returns an account's total unclaimed rewards

```solidity
function withdrawableRewards(address _account) public view returns (uint256)
```

#### Parameters

| Name      | Type    | Description        |
| --------- | ------- | ------------------ |
| \_account | address | Address of account |

#### Return Values

| Name    | Type    | Description             |
| ------- | ------- | ----------------------- |
| rewards | uint256 | Total unclaimed rewards |

## Write Functions

### withdraw

Withdraws the sender's unclaimed rewards

```solidity
function withdraw() external
```

### withdraw

Withdraws an account's unclaimed rewards

```solidity
function withdraw(address _account) external
```

#### Parameters

| Name      | Type    | Description             |
| --------- | ------- | ----------------------- |
| \_account | address | Account to withdraw for |

### onTokenTransfer

ERC677 implementation that receives rewards and distributes them

```solidity
function onTokenTransfer(address, uint256, bytes) external
```

### distributeRewards

Distributes new rewards that have been deposited

```solidity
function distributeRewards() public
```

### updateReward

Updates an account's principal reward balance

```solidity
function updateReward(address _account) public
```

#### Parameters

| Name      | Type    | Description        |
| --------- | ------- | ------------------ |
| \_account | address | Address of account |


# Rewards Pool WSD

`RewardsPoolWSD` is similar to `RewardsPool` but it handles a single rebasing token minted by a `StakingPool` by wrapping the tokens when they’re received for distribution and unwrapping them when a user claims their rewards.

## View Functions

### token

Returns the address of the rewards token this pool distributes

```solidity
function token() external view returns (address)
```

#### Return Values

| Name  | Type    | Description              |
| ----- | ------- | ------------------------ |
| token | address | Address of rewards token |

### wsdToken

Returns the address of the wrapped version of the token this pool distributes

```solidity
function wsdToken() external view returns (address)
```

#### Return Values

| Name         | Type    | Description                      |
| ------------ | ------- | -------------------------------- |
| wrappedToken | address | Address of wrapped rewards token |

### withdrawableRewards

Returns an account's total unwrapped unclaimed rewards

```solidity
function withdrawableRewards(address _account) public view returns (uint256)
```

#### Parameters

| Name      | Type    | Description        |
| --------- | ------- | ------------------ |
| \_account | address | Address of account |

#### Return Values

| Name    | Type    | Description                         |
| ------- | ------- | ----------------------------------- |
| rewards | uint256 | Total unclaimed rewards (unwrapped) |

### withdrawableRewardsWrapped

Returns an account's total wrapped unclaimed rewards

```solidity
function withdrawableRewardsWrapped(address _account) public view returns (uint256)
```

#### Parameters

| Name      | Type    | Description        |
| --------- | ------- | ------------------ |
| \_account | address | Address of account |

#### Return Values

| Name    | Type    | Description                       |
| ------- | ------- | --------------------------------- |
| rewards | uint256 | Total unclaimed rewards (wrapped) |

## Write Functions

### withdraw

Withdraws the sender's unclaimed rewards

```solidity
function withdraw() external
```

### withdraw

Withdraws an account's unclaimed rewards

```solidity
function withdraw(address _account) external
```

#### Parameters

| Name      | Type    | Description             |
| --------- | ------- | ----------------------- |
| \_account | address | Account to withdraw for |

### onTokenTransfer

ERC677 implementation that receives rewards and distributes them

```solidity
function onTokenTransfer(address, uint256, bytes) external
```

### distributeRewards

Distributes new rewards that have been deposited

```solidity
function distributeRewards() public
```

### updateReward

Updates an account's principal reward balance

```solidity
function updateReward(address _account) public
```

#### Parameters

| Name      | Type    | Description        |
| --------- | ------- | ------------------ |
| \_account | address | Address of account |


# Operator VCS

`OperatorVCS` is a staking strategy that manages many `OperatorVault` contracts by tracking the balance of each and moving tokens in and out of them.

## View Functions

### token

Returns the token this strategy supports

```solidity
function token() external view returns (address)
```

#### Return Values

| Name  | Type    | Description      |
| ----- | ------- | ---------------- |
| token | address | Address of token |

### canDeposit

Returns the available deposit room for this strategy

```solidity
function canDeposit() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description                  |
| ----------- | ------- | ---------------------------- |
| depositRoom | uint256 | Amount that can be deposited |

### canWithdraw

Returns the available withdrawal room for this strategy

```solidity
function canWithdraw() public view returns (uint256)
```

#### Return Values

| Name           | Type    | Description                  |
| -------------- | ------- | ---------------------------- |
| withdrawalRoom | uint256 | Amount that can be withdrawn |

### pendingFees

Returns the total amount of fees that will be paid on the next call to `updateDeposits`

```solidity
function pendingFees() external view returns (uint256)
```

#### Return Values

| Name      | Type    | Description                         |
| --------- | ------- | ----------------------------------- |
| totalFees | uint256 | Amount of tokens to be paid as fees |

### getTotalDeposits

Returns the total amount of deposits in this strategy

```solidity
function getTotalDeposits() public view returns (uint256)
```

#### Return Values

| Name          | Type    | Description                      |
| ------------- | ------- | -------------------------------- |
| totalDeposits | uint256 | Total amount of tokens deposited |

### getMaxDeposits

Returns the maximum amount of tokens this strategy can hold

*Accounts for total current deposits + current additional vault space + current space in the Chainlink*

```solidity
function getMaxDeposits() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description            |
| ----------- | ------- | ---------------------- |
| maxDeposits | uint256 | Maximum token deposits |

### getMinDeposits

Returns the minimum amount of tokens that must remain in this strategy

```solidity
function getMinDeposits() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description            |
| ----------- | ------- | ---------------------- |
| minDeposits | uint256 | Minimum token deposits |

### getDepositChange

Returns the deposit change since the last call to `updateDeposits` (ignores stakes/withdraws)

```solidity
function getDepositChange() public view returns (int256)
```

#### Return Values

| Name          | Type   | Description                    |
| ------------- | ------ | ------------------------------ |
| depositChange | int256 | Change in total token deposits |

### getVaults

Returns a list of all vaults

```solidity
function getVaults() external view returns (contract IVault[])
```

#### Return Values

| Name   | Type       | Description             |
| ------ | ---------- | ----------------------- |
| vaults | address\[] | List of vault addresses |

### getVaultDepositLimits

Returns the vault deposit limits

```solidity
function getVaultDepositLimits() public view returns (uint256, uint256)
```

#### Return Values

| Name        | Type    | Description                                      |
| ----------- | ------- | ------------------------------------------------ |
| minDeposits | uint256 | minimum amount of deposits that a vault can hold |
| maxDeposits | uint256 | maximum amount of deposits that a vault can hold |

### vaultImplementation

Returns the address of the vault implementation contract this strategy will use for new vaults

```solidity
function vaultImplementation() external view returns (address)
```

#### Return Values

| Name                | Type    | Description                              |
| ------------------- | ------- | ---------------------------------------- |
| vaultImplementation | address | Address of vault implementation contract |

### getFees

Returns a list of all fees

```solidity
function getFees() external view returns (struct VaultControllerStrategy.Fee[])
```

#### Return Values

| Name | Type                                  | Description  |
| ---- | ------------------------------------- | ------------ |
| fees | struct VaultControllerStrategy.Fee\[] | List of fees |

### operatorRewardPercentage

Returns the basis point amount of an operator's earned rewards that they receive

```solidity
function operatorRewardPercentage() external view
```

#### Return Values

| Name                     | Type    | Description                            |
| ------------------------ | ------- | -------------------------------------- |
| operatorRewardPercentage | uint256 | Basis point operator reward percentage |

### getOperatorRewards

Returns the total unclaimed operator rewards

```solidity
function getOperatorRewards() external view returns (uint256, uint256)
```

#### Return Values

| Name                     | Type    | Description                      |
| ------------------------ | ------- | -------------------------------- |
| unclaimedOperatorRewards | uint256 | Total unclaimed operator rewards |
| availableRewards         | uint256 | Total available operator rewards |

### getVaultRemovalQueue

Returns a list of all vaults queued for removal

```solidity
function getVaultRemovalQueue() external view returns (address[])
```

#### Return Values

| Name  | Type       | Description                       |
| ----- | ---------- | --------------------------------- |
| queue | address\[] | List of vaults queued for removal |

## Write Functions

### deposit

Deposits tokens from the staking pool into vaults

```solidity
function deposit(uint256 _amount, bytes _data) external
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| \_amount | uint256 | Amount to deposit           |
| \_data   | bytes   | Encoded vault deposit order |

### withdraw

Withdraws tokens from vaults and sends them to the staking pool

```solidity
function withdraw(uint256 _amount, bytes _data) external
```

#### Parameters

| Name     | Type    | Description                    |
| -------- | ------- | ------------------------------ |
| \_amount | uint256 | Amount to withdraw             |
| \_data   | bytes   | Encoded vault withdrawal order |

### onTokenTransfer

ERC677 implementation to receive operator rewards

```solidity
function onTokenTransfer(address, uint256, bytes) external
```

### withdrawOperatorRewards

Used by vaults to withdraw operator rewards

```solidity
function withdrawOperatorRewards(address _receiver, uint256 _amount) external
```

#### Parameters

| Name       | Type    | Description                |
| ---------- | ------- | -------------------------- |
| \_receiver | address | Address to receive rewards |
| \_amount   | uint256 | Amount to withdraw         |

### updateDeposits

Updates deposit accounting and calculates fees on newly earned rewards

```solidity
function updateDeposits(bytes _data) external returns (uint256 depositChange, address[] receivers, uint256[] amounts)
```

#### Parameters

| Name   | Type  | Description                                                                     |
| ------ | ----- | ------------------------------------------------------------------------------- |
| \_data | bytes | Encoded min amount of rewards required to claim (set 0 to skip reward claiming) |

#### Return Values

| Name          | Type       | Description                          |
| ------------- | ---------- | ------------------------------------ |
| depositChange | uint256    | change in deposits since last update |
| receivers     | address\[] | List of fee receivers                |
| amounts       | uint256\[] | List of fee amounts                  |

### updateVaultGroups

Executes a vault group update

*Re-unbonds all vaults in the current vault group and increments the current vault group*

```solidity
function updateVaultGroups(uint256[] _curGroupVaultsToUnbond, uint256 _curGroupTotalDepositRoom, uint256 _nextGroup,
uint256 _nextGroupTotalUnbonded) external
```

#### Parameters

| Name                       | Type       | Description                                                 |
| -------------------------- | ---------- | ----------------------------------------------------------- |
| \_curGroupVaultsToUnbond   | uint256\[] | list of vaults to unbond in current vault group             |
| \_curGroupTotalDepositRoom | uint256\[] | total deposit room across all vaults in current vault group |
| \_nextGroup                | uint256\[] | index of next vault group                                   |
| \_nextGroupTotalUnbonded   | uint256\[] | total unbonded across all vaults in next vault group        |

### upgradeVaults

Upgrades vaults to a new implementation contract

```solidity
function upgradeVaults(uint256 _startIndex, uint256 _numVaults, bytes _data) external
```

#### Parameters

| Name         | Type    | Description                                                 |
| ------------ | ------- | ----------------------------------------------------------- |
| \_startIndex | uint256 | Index of first vault to upgrade                             |
| \_numVaults  | uint256 | Number of vaults to upgrade starting at \_startIndex        |
| \_data       | bytes   | Optional encoded function call to be executed after upgrade |

### setWithdrawalIndexes

Manually sets the withdrawal index for each vault group

```solidity
function setWithdrawalIndexes(uint64 _withdrawalIndexes) external
```

#### Parameters

| Name                | Type      | Description                                     |
| ------------------- | --------- | ----------------------------------------------- |
| \_withdrawalIndexes | uint64\[] | list of withdrawal indexes for each vault group |

### addFee

Adds a new fee

```solidity
function addFee(address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description             |
| ---------------- | ------- | ----------------------- |
| \_receiver       | address | Address of fee receiver |
| \_feeBasisPoints | uint256 | Fee in basis points     |

### updateFee

Updates an existing fee

```solidity
function updateFee(uint256 _index, address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description             |
| ---------------- | ------- | ----------------------- |
| \_index          | uint256 | Index of fee            |
| \_receiver       | address | Address of fee receiver |
| \_feeBasisPoints | uint256 | Fee in basis points     |

### setVaultImplementation

Sets a new vault implementation contract to be used when deploying/upgrading vaults

```solidity
function setVaultImplementation(address _vaultImplementation) external
```

#### Parameters

| Name                  | Type    | Description                        |
| --------------------- | ------- | ---------------------------------- |
| \_vaultImplementation | address | Address of implementation contract |

### addVault

Deploys a new vault

```solidity
function addVault(address _operator) external
```

#### Parameters

| Name       | Type    | Description                                   |
| ---------- | ------- | --------------------------------------------- |
| \_operator | address | Address of operator that the vault represents |

### queueVaultRemoval

Queues a vault for removal

*A vault can only be queued for removal if the operator has been removed from the Chainlink staking contract*

```solidity
function queueVaultRemoval(uint256 _index) external
```

#### Parameters

| Name    | Type    | Description    |
| ------- | ------- | -------------- |
| \_index | uint256 | Index of vault |

### removeVault

Removes a vault that has been queued for removal

```solidity
function removeVault(uint256 _queueIndex) external
```

#### Parameters

| Name         | Type    | Description                     |
| ------------ | ------- | ------------------------------- |
| \_queueIndex | uint256 | Index of vault in removal queue |

### updateVaultGroupAccounting

Updates accounting for any number of vault groups

*Used to correct minor accounting errors that result from the removal or slashing of operators in the Chainlink staking contract*

```solidity
function updateVaultGroupAccounting(
        uint256[] _vaultGroups,
        uint256[] _totalDepositRoom,
        uint256 _totalUnbonded,
        uint256 _vaultMaxDeposits
    ) external
```

#### Parameters

| Name               | Type       | Description                                                    |
| ------------------ | ---------- | -------------------------------------------------------------- |
| \_vaultGroups      | uint256\[] | list of vault groups to update                                 |
| \_totalDepositRoom | uint256\[] | list of totalDepositRoom corresponding to list of vault groups |
| \_totalUnbonded    | uint256    | total amount currently unbonded                                |
| \_vaultMaxDeposits | uint256    | vault deposit limit as defined in Chainlink staking contract   |

### setOperator

Sets a vault's operator address

```solidity
function setOperator(uint256 _index, address _operator) external
```

#### Parameters

| Name       | Type    | Description                                   |
| ---------- | ------- | --------------------------------------------- |
| \_index    | uint256 | Index of vault                                |
| \_operator | address | Address of operator that the vault represents |

### setRewardsReceiver

Sets the address authorized to claim rewards for a vault

```solidity
function setRewardsReceiver(address _rewardsReceiver) external
```

#### Parameters

| Name       | Type    | Description                           |
| ---------- | ------- | ------------------------------------- |
| \_operator | address | Address of rewards receiver for vault |

### setOperatorRewardPercentage

Sets the basis point amount of an operator's earned rewards that they receive

```solidity
function setOperatorRewardPercentage(uint256 _operatorRewardPercentage) external
```

#### Parameters

| Name                       | Type    | Description                            |
| -------------------------- | ------- | -------------------------------------- |
| \_operatorRewardPercentage | uint256 | Basis point operator reward percentage |


# Operator Vault

`OperatorVault` is a vault contract used for depositing LINK into the Chainlink staking contract as a node operator.

## View Functions

### vaultController

Returns the address of the vault controller

```solidity
function vaultController() external view returns (address)
```

#### Return Values

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| vaultController | address | address of vault controller |

### stakeController

Returns the address of the Chainlink staking contract

```solidity
function stakeController() external view returns (address)
```

#### Return Values

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| stakeController | address | address of staking contract |

### rewardsController

Returns the address of the Chainlink staking rewards contract

```solidity
function rewardsController() external view returns (address)
```

#### Return Values

| Name              | Type    | Description                 |
| ----------------- | ------- | --------------------------- |
| rewardsController | address | address of rewards contract |

### delegateRegistry

Returns the address of the delegate registry

```solidity
function delegateRegistry() external view returns (address)
```

#### Return Values

| Name             | Type    | Description                  |
| ---------------- | ------- | ---------------------------- |
| delegateRegistry | address | address of delegate registry |

### rewardsReceiver

Returns the rewards receiver address for this vault

```solidity
function rewardsReceiver() external view returns (address)
```

#### Return Values

| Name            | Type    | Description              |
| --------------- | ------- | ------------------------ |
| rewardsReceiver | address | Rewards receiver address |

### pfAlertsController

Returns the address of the price feed alerts controller

```solidity
function pfAlertsController() external view returns (address)
```

#### Return Values

| Name               | Type    | Description                  |
| ------------------ | ------- | ---------------------------- |
| pfAlertsController | address | Price feed alerts controller |

### trackedTotalDeposits

Returns the tracked total deposits for this vault

```solidity
function trackedTotalDeposits() external view returns (uint128)
```

#### Return Values

| Name                 | Type    | Description            |
| -------------------- | ------- | ---------------------- |
| trackedTotalDeposits | uint128 | Tracked total deposits |

### unclaimedRewards

Returns the unclaimed rewards for this vault

```solidity
function unclaimedRewards() external view returns (uint128)
```

#### Return Values

| Name             | Type    | Description       |
| ---------------- | ------- | ----------------- |
| unclaimedRewards | uint128 | Unclaimed rewards |

### getTotalDeposits

Returns the total balance of this contract in the Chainlink staking contract

```solidity
function getTotalDeposits() public view returns (uint256)
```

#### Return Values

| Name          | Type    | Description           |
| ------------- | ------- | --------------------- |
| totalDeposits | uint256 | Total deposit balance |

### getPrincipalDeposits

Returns the principal balance of this contract in the Chainlink staking contract

```solidity
function getPrincipalDeposits() public view returns (uint256)
```

#### Return Values

| Name              | Type    | Description               |
| ----------------- | ------- | ------------------------- |
| principalDeposits | uint256 | Principal deposit balance |

### getRewards

Returns the claimable rewards balance of this contract in the Chainlink staking rewards contract

```solidity
function getRewards() public view returns (uint256)
```

#### Return Values

| Name    | Type    | Description       |
| ------- | ------- | ----------------- |
| rewards | uint256 | Claimable rewards |

### getUnclaimedRewards

Returns the total unclaimed operator rewards for this vault

```solidity
function getUnclaimedRewards() public view returns (uint256)
```

#### Return Values

| Name             | Type    | Description                |
| ---------------- | ------- | -------------------------- |
| unclaimedRewards | uint256 | Unclaimed operator rewards |

### getPendingRewards

Returns the amount of rewards that will be earned by this vault on the next update

```solidity
function getPendingRewards() public view returns (uint256)
```

#### Return Values

| Name             | Type    | Description                |
| ---------------- | ------- | -------------------------- |
| unclaimedRewards | uint256 | Unclaimed operator rewards |

### operator

Returns the operator address for this vault

```solidity
function operator() external view returns (address)
```

#### Return Values

| Name     | Type    | Description      |
| -------- | ------- | ---------------- |
| operator | address | Operator address |

### claimPeriodActive

Returns whether the claim period is active for this contract in the Chainlink staking contract

```solidity
function claimPeriodActive() external
```

#### Return Values

| Name     | Type | Description                     |
| -------- | ---- | ------------------------------- |
| \_active | bool | true if active, false otherwise |

### isRemoved

Returns whether the operator for this vault has been removed from the Chainlink staking contract

```solidity
function isRemoved() external
```

#### Return Values

| Name        | Type | Description                                        |
| ----------- | ---- | -------------------------------------------------- |
| \_isRemoved | bool | true if operator has been removed, false otherwise |

### getDelegations

Returns all enabled delegations this vault has given out

```solidity
function getDelegations() external view returns (IDelegateRegistry.Delegation[] memory)
```

#### Return Values

| Name        | Type                            | Description         |
| ----------- | ------------------------------- | ------------------- |
| delegations | IDelegateRegistry.Delegation\[] | list of delegations |

## Write Functions

### deposit

Deposits tokens from the vaultController into the Chainlink staking contract

```solidity
function deposit(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description       |
| -------- | ------- | ----------------- |
| \_amount | uint256 | Amount to deposit |

### withdraw

Withdraws tokens from the Chainlink staking contract and sends them to the vault controller

```solidity
function withdraw(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description        |
| -------- | ------- | ------------------ |
| \_amount | uint256 | Amount to withdraw |

### unbond

Unbonds tokens in the Chainlink staking contract

```solidity
function unbond() external
```

### raiseAlert

Raises an alert in the Chainlink staking contract

```solidity
function raiseAlert(address _feed) external
```

#### Parameters

| Name   | Type    | Description                                  |
| ------ | ------- | -------------------------------------------- |
| \_feed | address | Address of Chainlink feed to raise alert for |
|        |         |                                              |

### withdrawRewards

Withdraws the unclaimed operator rewards for this vault

```solidity
function withdrawRewards() external
```

### updateDeposits

Updates the deposit and reward accounting for this vault

```solidity
function updateDeposits(uint256 _minRewards, address _rewardsReceiver) external
```

#### Parameters

| Name              | Type    | Description                                                    |
| ----------------- | ------- | -------------------------------------------------------------- |
| \_minRewards      | uint256 | Min amount of rewards to claim (set 0 to skip reward claiming) |
| \_rewardsReceiver | address | Address to receive claimed rewards (set if \_minRewards > 0)   |

### exitVault

Withdraws tokens from the Chainlink staking contract and sends them to the vault controller

*Used to withdraw remaining principal and rewards after operator has been removedWill also send any unclaimed operator rewards to rewards receiver*

```solidity
function exitVault() external
```

#### Return Values

| Name                 | Type    | Description               |
| -------------------- | ------- | ------------------------- |
| \_prinicpalWithdrawn | uint256 | Total principal withdrawn |
| \_rewardsWithdrawn   | uint256 | Total rewards withdrawn   |

### delegate

Delegates to an address for this vault

```solidity
function delegate(address _to, bytes32 _rights, bool _enable) external
```

#### Parameters

| Name     | Type    | Description                            |
| -------- | ------- | -------------------------------------- |
| \_to     | address | address to delegate to                 |
| \_rights | bytes32 | rights to grant                        |
| \_enable | bool    | whether to enable or revoke delegation |

### withdrawTokenRewards

Withdraws any non-LINK token rewards sitting in this vault

```solidity
function withdrawTokenRewards(address[] calldata _tokens) external
```

#### Parameters

| Name     | Type       | Description                |
| -------- | ---------- | -------------------------- |
| \_tokens | address\[] | list of tokens to withdraw |

### setDelegateRegistry

Sets the delegate registry

```solidity
function setDelegateRegistry(address _delegateRegistry) external
```

#### Parameters

| Name               | Type    | Description                  |
| ------------------ | ------- | ---------------------------- |
| \_delegateRegistry | address | address of delegate registry |

### setOperator

Sets the operator address for this vault if not already set

```solidity
function setOperator(address _operator) external
```

#### Parameters

| Name       | Type    | Description      |
| ---------- | ------- | ---------------- |
| \_operator | address | Operator address |

### setRewardsReceiver

Sets the address to receive operator rewards

```solidity
function setRewardsReceiver(address _rewardsReceiver_) external
```

#### Parameters

| Name              | Type    | Description                 |
| ----------------- | ------- | --------------------------- |
| \_rewardsReceiver | address | Address of rewards receiver |


# Community VCS

`CommunityVCS` is a staking strategy that manages many `CommunityVault` contracts by tracking the balance of each and moving tokens in and out of them.

## View Functions

### token

Returns the token this strategy supports

```solidity
function token() external view returns (address)
```

#### Return Values

| Name  | Type    | Description      |
| ----- | ------- | ---------------- |
| token | address | Address of token |

### canDeposit

Returns the available deposit room for this strategy

```solidity
function canDeposit() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description                  |
| ----------- | ------- | ---------------------------- |
| depositRoom | uint256 | Amount that can be deposited |

### canWithdraw

Returns the available withdrawal room for this strategy

```solidity
function canWithdraw() public view returns (uint256)
```

#### Return Values

| Name           | Type    | Description                  |
| -------------- | ------- | ---------------------------- |
| withdrawalRoom | uint256 | Amount that can be withdrawn |

### pendingFees

Returns the total amount of fees that will be paid on the next call to `updateDeposits`

```solidity
function pendingFees() external view returns (uint256)
```

#### Return Values

| Name      | Type    | Description                         |
| --------- | ------- | ----------------------------------- |
| totalFees | uint256 | Amount of tokens to be paid as fees |

### getTotalDeposits

Returns the total amount of deposits in this strategy

```solidity
function getTotalDeposits() public view returns (uint256)
```

#### Return Values

| Name          | Type    | Description                      |
| ------------- | ------- | -------------------------------- |
| totalDeposits | uint256 | Total amount of tokens deposited |

### getMaxDeposits

Returns the maximum amount of tokens this strategy can hold

*Accounts for total current deposits + current additional vault space + current space in the Chainlink*

```solidity
function getMaxDeposits() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description            |
| ----------- | ------- | ---------------------- |
| maxDeposits | uint256 | Maximum token deposits |

### getMinDeposits

Returns the minimum amount of tokens that must remain in this strategy

```solidity
function getMinDeposits() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description            |
| ----------- | ------- | ---------------------- |
| minDeposits | uint256 | Minimum token deposits |

### checkUpkeep

Returns whether a new batch of vaults should be deployed

```solidity
function checkUpkeep(bytes) external view returns (bool, bytes)
```

#### Return Values

| Name         | Type | Description                                      |
| ------------ | ---- | ------------------------------------------------ |
| upkeepNeeded | bool | Whether a new batch of vaults should be deployed |

### getDepositChange

Returns the deposit change since the last call to `updateDeposits` (ignores stakes/withdraws)

```solidity
function getDepositChange() public view returns (int256)
```

#### Return Values

| Name          | Type   | Description                    |
| ------------- | ------ | ------------------------------ |
| depositChange | int256 | Change in total token deposits |

### getVaults

Returns a list of all vaults controlled by this contract

```solidity
function getVaults() external view returns (address[] memory)
```

#### Return Values

| Name   | Type       | Description             |
| ------ | ---------- | ----------------------- |
| vaults | address\[] | List of vault addresses |

### getVaultDepositLimits

Returns the vault deposit limits

```solidity
function getVaultDepositLimits() public view returns (uint256, uint256)
```

#### Return Values

| Name        | Type    | Description                                      |
| ----------- | ------- | ------------------------------------------------ |
| minDeposits | uint256 | minimum amount of deposits that a vault can hold |
| maxDeposits | uint256 | maximum amount of deposits that a vault can hold |

### vaultImplementation

Returns the address of the vault implementation contract this strategy will use for new vaults

```solidity
function vaultImplementation() external view returns (address)
```

#### Return Values

| Name                | Type    | Description                              |
| ------------------- | ------- | ---------------------------------------- |
| vaultImplementation | address | Address of vault implementation contract |

### vaultDeploymentThreshold

Returns the minimum number of non-full vaults before a new batch is deployed

```solidity
function vaultDeploymentThreshold() external view returns (uint256)
```

#### Return Values

| Name                     | Type    | Description                |
| ------------------------ | ------- | -------------------------- |
| vaultDeploymentThreshold | uint256 | Vault deployment threshold |

### vaultDeploymentAmount

Returns the amount of vaults to deploy when threshold is met

```solidity
function vaultDeploymentAmount() external view returns (uint256)
```

#### Return Values

| Name                  | Type    | Description      |
| --------------------- | ------- | ---------------- |
| vaultDeploymentAmount | uint256 | number of vaults |

### getFees

Returns a list of all fees

```solidity
function getFees() external view returns (struct VaultControllerStrategy.Fee[])
```

#### Return Values

| Name | Type                                  | Description  |
| ---- | ------------------------------------- | ------------ |
| fees | struct VaultControllerStrategy.Fee\[] | List of fees |

### stakeController

Returns the address of the Chainlink staking contract

```solidity
function stakeController() external view returns (address)
```

#### Return Values

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| stakeController | address | address of staking contract |

## Write Functions

### deposit

Deposits tokens from the staking pool into vaults

```solidity
function deposit(uint256 _amount, bytes _data) external
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| \_amount | uint256 | Amount to deposit           |
| \_data   | bytes   | Encoded vault deposit order |

### withdraw

Withdraws tokens from vaults and sends them to the staking pool

```solidity
function withdraw(uint256 _amount, bytes _data) external
```

#### Parameters

| Name     | Type    | Description                    |
| -------- | ------- | ------------------------------ |
| \_amount | uint256 | Amount to withdraw             |
| \_data   | bytes   | Encoded vault withdrawal order |

### performUpkeep

Deploys a new batch of vaults

```solidity
function performUpkeep(bytes _performData) external
```

### addVaults

Deploys a new batch of vaults

```solidity
function addVaults(uint256 _numVaults) external
```

#### Parameters

| Name        | Type    | Description                |
| ----------- | ------- | -------------------------- |
| \_numVaults | uint256 | Number of vaults to deploy |

### updateDeposits

Updates the total deposit amount for reward distribution and calculates applicable fees

```solidity
function updateDeposits() external returns (address[] receivers, uint256[] amounts)
```

#### Return Values

| Name      | Type       | Description           |
| --------- | ---------- | --------------------- |
| receivers | address\[] | List of fee receivers |
| amounts   | uint256\[] | List of fee amounts   |

### updateVaultGroups

Executes a vault group update

*Re-unbonds all vaults in the current vault group and increments the current vault group*

```solidity
function updateVaultGroups(uint256[] _curGroupVaultsToUnbond, uint256 _curGroupTotalDepositRoom, uint256 _nextGroup,
uint256 _nextGroupTotalUnbonded) external
```

#### Parameters

| Name                       | Type       | Description                                                 |
| -------------------------- | ---------- | ----------------------------------------------------------- |
| \_curGroupVaultsToUnbond   | uint256\[] | list of vaults to unbond in current vault group             |
| \_curGroupTotalDepositRoom | uint256\[] | total deposit room across all vaults in current vault group |
| \_nextGroup                | uint256\[] | index of next vault group                                   |
| \_nextGroupTotalUnbonded   | uint256\[] | total unbonded across all vaults in next vault group        |

### upgradeVaults

Upgrades vaults to a new implementation contract

```solidity
function upgradeVaults(uint256 _startIndex, uint256 _numVaults, bytes _data) external
```

#### Parameters

| Name         | Type    | Description                                                 |
| ------------ | ------- | ----------------------------------------------------------- |
| \_startIndex | uint256 | Index of first vault to upgrade                             |
| \_numVaults  | uint256 | Number of vaults to upgrade starting at \_startIndex        |
| \_data       | bytes   | Optional encoded function call to be executed after upgrade |

### setWithdrawalIndexes

Manually sets the withdrawal index for each vault group

```solidity
function setWithdrawalIndexes(uint64 _withdrawalIndexes) external
```

#### Parameters

| Name                | Type      | Description                                     |
| ------------------- | --------- | ----------------------------------------------- |
| \_withdrawalIndexes | uint64\[] | list of withdrawal indexes for each vault group |

### addFee

Adds a new fee

```solidity
function addFee(address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description             |
| ---------------- | ------- | ----------------------- |
| \_receiver       | address | Address of fee receiver |
| \_feeBasisPoints | uint256 | Fee in basis points     |

### updateFee

Updates an existing fee

```solidity
function updateFee(uint256 _index, address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description             |
| ---------------- | ------- | ----------------------- |
| \_index          | uint256 | Index of fee            |
| \_receiver       | address | Address of fee receiver |
| \_feeBasisPoints | uint256 | Fee in basis points     |

### setVaultDeploymentParams

Sets the vault deployment parameters

```solidity
function setVaultDeploymentParams(uint256 _vaultDeploymentThreshold, uint256 _vaultDeploymentAmount) external
```

#### Parameters

| Name                       | Type    | Description                                                      |
| -------------------------- | ------- | ---------------------------------------------------------------- |
| \_vaultDeploymentThreshold | uint256 | Minimum number of non-full vaults before a new batch is deployed |
| \_vaultDeploymentAmount\_  | uint256 | Amount of vaults to deploy when threshold is met                 |

### setVaultImplementation

Sets a new vault implementation contract to be used when deploying/upgrading vaults

```solidity
function setVaultImplementation(address _vaultImplementation) external
```

#### Parameters

| Name                  | Type    | Description                        |
| --------------------- | ------- | ---------------------------------- |
| \_vaultImplementation | address | Address of implementation contract |

### setMaxDepositSizeBP

Sets the basis point amount of the remaing deposit room in the Chainlink staking contract\
that can be deposited at once

```solidity
function setMaxDepositSizeBP(uint256 _maxDeposits) external
```

#### Parameters

| Name               | Type    | Description                      |
| ------------------ | ------- | -------------------------------- |
| \_maxDepositSizeBP | uint256 | Maximum basis point deposit size |


# Community Vault

`CommunityVault` is a vault contract used for depositing LINK into the Chainlink staking contract as a community staker.

## View Functions

### token

Returns the address of the staking token

```solidity
function token() external view returns (address)
```

#### Return Values

| Name  | Type    | Description      |
| ----- | ------- | ---------------- |
| token | address | address of token |

### vaultController

Returns the address of the vault controller

```solidity
function vaultController() external view returns (address)
```

#### Return Values

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| vaultController | address | address of vault controller |

### stakeController

Returns the address of the Chainlink staking contract

```solidity
function stakeController() external view returns (address)
```

#### Return Values

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| stakeController | address | address of staking contract |

### rewardsController

Returns the address of the Chainlink staking rewards contract

```solidity
function rewardsController() external view returns (address)
```

#### Return Values

| Name              | Type    | Description                 |
| ----------------- | ------- | --------------------------- |
| rewardsController | address | address of rewards contract |

### delegateRegistry

Returns the address of the delegate registry

```solidity
function delegateRegistry() external view returns (address)
```

#### Return Values

| Name             | Type    | Description                  |
| ---------------- | ------- | ---------------------------- |
| delegateRegistry | address | address of delegate registry |

### getTotalDeposits

Returns the total balance of this contract in the Chainlink staking contract

```solidity
function getTotalDeposits() public view returns (uint256)
```

#### Return Values

| Name          | Type    | Description           |
| ------------- | ------- | --------------------- |
| totalDeposits | uint256 | Total deposit balance |

### getPrincipalDeposits

Returns the principal balance of this contract in the Chainlink staking contract

```solidity
function getPrincipalDeposits() public view returns (uint256)
```

#### Return Values

| Name              | Type    | Description               |
| ----------------- | ------- | ------------------------- |
| principalDeposits | uint256 | Principal deposit balance |

### getRewards

Returns the claimable rewards balance of this contract in the Chainlink staking rewards contract

```solidity
function getRewards() public view returns (uint256)
```

#### Return Values

| Name    | Type    | Description       |
| ------- | ------- | ----------------- |
| rewards | uint256 | Claimable rewards |

### claimPeriodActive

Returns whether the claim period is active for this contract in the Chainlink staking contract

```solidity
function claimPeriodActive() external view returns (bool)
```

#### Return Values

| Name   | Type | Description                     |
| ------ | ---- | ------------------------------- |
| active | bool | true if active, false otherwise |

### getDelegations

Returns all enabled delegations this vault has given out

```solidity
function getDelegations() external view returns (IDelegateRegistry.Delegation[] memory)
```

#### Return Values

| Name        | Type                            | Description         |
| ----------- | ------------------------------- | ------------------- |
| delegations | IDelegateRegistry.Delegation\[] | list of delegations |

## Write Functions

### deposit

Deposits tokens from the vaultController into the Chainlink staking contract

```solidity
function deposit(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description       |
| -------- | ------- | ----------------- |
| \_amount | uint256 | Amount to deposit |

### withdraw

Withdraws tokens from the Chainlink staking contract and sends them to the vault controller

```solidity
function withdraw(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description        |
| -------- | ------- | ------------------ |
| \_amount | uint256 | Amount to withdraw |

### unbond

Unbonds tokens in the Chainlink staking contract

```solidity
function unbond() external
```

### delegate

Delegates to an address for this vault

```solidity
function delegate(address _to, bytes32 _rights, bool _enable) external
```

#### Parameters

| Name     | Type    | Description                            |
| -------- | ------- | -------------------------------------- |
| \_to     | address | address to delegate to                 |
| \_rights | bytes32 | rights to grant                        |
| \_enable | bool    | whether to enable or revoke delegation |

### withdrawTokenRewards

Withdraws any non-LINK token rewards sitting in this vault

```solidity
function withdrawTokenRewards(address[] calldata _tokens) external
```

#### Parameters

| Name     | Type       | Description                |
| -------- | ---------- | -------------------------- |
| \_tokens | address\[] | list of tokens to withdraw |

### setDelegateRegistry

Sets the delegate registry

```solidity
function setDelegateRegistry(address _delegateRegistry) external
```

#### Parameters

| Name               | Type    | Description                  |
| ------------------ | ------- | ---------------------------- |
| \_delegateRegistry | address | address of delegate registry |

### claimRewards

Claims rewards from the Chainlink staking contract

```solidity
function claimRewards(uint256 _minRewards, address _rewardsReceiver) external
```

#### Parameters

| Name              | Type    | Description                        |
| ----------------- | ------- | ---------------------------------- |
| \_minRewards      | uint256 | Min amount of rewards to claim     |
| \_rewardsReceiver | address | Address to receive claimed rewards |


# Fund Flow Controller

The `FundFlowController` manages deposits and withdrawals for Chainlink staking vaults in the `OperatorVCS` and `CommunityVCS`. Specifcally, it calculates vault deposit/withdrawal order, calculates the current state of accounting across vault groups, and periodically unbonds vaults in the Chainlink staking contract to ensure there are always funds available to withdraw.

## View Functions

### operatorVCS

Returns the address of the Operator VCS

```solidity
function operatorVCS() public view returns (address)
```

#### Return Values

| Name        | Type    | Description             |
| ----------- | ------- | ----------------------- |
| operatorVCS | address | Address of Operator VCS |

### communityVCS

Returns the address of the Community VCS

```solidity
function communityVCS() public view returns (address)
```

#### Return Values

| Name         | Type    | Description              |
| ------------ | ------- | ------------------------ |
| communityVCS | address | Address of Community VCS |

### unbondingPeriod

Returns the duration of the unbonding period in the Chainlink staking contract

```solidity
function unbondingPeriod() public view returns (uint64)
```

#### Return Values

| Name            | Type   | Description      |
| --------------- | ------ | ---------------- |
| unbondingPeriod | uint64 | Unbonding period |

### claimPeriod

Returns the duration of the claim period in the Chainlink staking contract

```solidity
function claimPeriod() public view returns (uint64)
```

#### Return Values

| Name        | Type   | Description  |
| ----------- | ------ | ------------ |
| claimPeriod | uint64 | Claim period |

### numVaultGroups

Returns the total number of vault groups

```solidity
function numVaultGroups() public view returns (uint64)
```

#### Return Values

| Name           | Type   | Description            |
| -------------- | ------ | ---------------------- |
| numVaultGroups | uint64 | Number of vault groups |

### curUnbondedVaultGroup

Returns the index of current unbonded vault group

```solidity
function curUnbondedVaultGroup() public view returns (uint64)
```

#### Return Values

| Name                  | Type   | Description                  |
| --------------------- | ------ | ---------------------------- |
| curUnbondedVaultGroup | uint64 | Current unbonded vault group |

### timeOfLastUpdateByGroup

Returns the time that a vault group was last unbonded

```solidity
function timeOfLastUpdateByGroup() public view returns (uint64)
```

#### Parameters

| Name       | Type   | Description          |
| ---------- | ------ | -------------------- |
| vaultGroup | uint64 | Index of vault group |

#### Return Values

| Name             | Type   | Description                            |
| ---------------- | ------ | -------------------------------------- |
| timeOfLastUpdate | uint64 | Time of last update for selected group |

### getDepositData

Returns encoded vault deposit order for each strategy

*Return data should be passed to the priority pool when depositing into the staking pool*

```solidity
function getDepositData(uint256 _toDeposit) external view returns (bytes[])
```

#### Parameters

| Name        | Type    | Description       |
| ----------- | ------- | ----------------- |
| \_toDeposit | uint256 | amount to deposit |

#### Return Values

| Name        | Type     | Description                        |
| ----------- | -------- | ---------------------------------- |
| depositData | bytes\[] | list of encoded vault deposit data |

### getWithdrawalData

Returns encoded vault withdrawal order for each strategy

*Return data should be passed to the priority pool when withdrawing from the staking pool*

```solidity
function getWithdrawalData(uint256 _toWithdraw) external view returns (bytes[])
```

#### Parameters

| Name         | Type    | Description        |
| ------------ | ------- | ------------------ |
| \_toWithdraw | uint256 | amount to withdraw |

#### Return Values

| Name           | Type     | Description                           |
| -------------- | -------- | ------------------------------------- |
| withdrawalData | bytes\[] | list of encoded vault withdrawal data |

### claimPeriodActive

Returns whether claim period is active

*Funds can only be withdrawn while the claim period is active*

```solidity
function claimPeriodActive() external view returns (bool)
```

#### Return Values

| Name     | Type | Description                                     |
| -------- | ---- | ----------------------------------------------- |
| isActive | bool | true if claim period is active, false otherwise |

### shouldUpdateVaultGroups

Returns whether vault groups should be updated.

```solidity
function shouldUpdateVaultGroups() external view returns (bool)
```

#### Return Values

| Name         | Type | Description                                             |
| ------------ | ---- | ------------------------------------------------------- |
| shouldUpdate | bool | true if vault groups should be updated, false otherwise |

## Write Functions

### updateVaultGroups

Executes a vault group update

*Re-unbonds all vaults in the current vault group and increments the current vault group*\
*to the next one which will have just entered the claim period*\
*an update is needed once per claim period right after the claim period expires for the*\
*current vault group*

```solidity
function updateVaultGroups() external
```

### updateOperatorVaultGroupAccounting

Calculates and updates totalDepositRoom and totalUnbonded for a list of operator vault groups

*Used to correct minor accounting errors that result from the removal or slashing*\
*of operators in the Chainlink staking contract*

```solidity
function updateOperatorVaultGroupAccounting(uint256[] _vaultGroups) external
```

#### Parameters

| Name          | Type       | Description          |
| ------------- | ---------- | -------------------- |
| \_vaultGroups | uint256\[] | list of vault groups |

### delegateVaults

Delegates to an address for a group of vaults.

```solidity
function delegateVaults(address[] _vaults, address _to, bytes32 _rights, bool _enable) external
```

#### Parameters

| Name     | Type       | Description                            |
| -------- | ---------- | -------------------------------------- |
| \_vaults | address\[] | List of vault addresses                |
| \_to     | address    | Address to delegate to                 |
| \_rights | bytes32    | Rights to grant                        |
| \_enable | bool       | Whether to enable or revoke delegation |

### withdrawTokenRewards

Withdraws non-LINK token rewards from a group of vaults.

```solidity
function withdrawTokenRewards(address[] _vaults, address[] _tokens) external
```

#### Parameters

| Name     | Type       | Description                |
| -------- | ---------- | -------------------------- |
| \_vaults | address\[] | List of vault addresses    |
| \_tokens | address\[] | List of tokens to withdraw |

### setNonLINKRewardReceiver

Sets the address of reward receiver for non-LINK vault rewards.

```solidity
function setNonLINKRewardReceiver(address _nonLINKRewardReceiver) external
```

#### Parameters

| Name                    | Type    | Description                |
| ----------------------- | ------- | -------------------------- |
| \_nonLINKRewardReceiver | address | Address of reward receiver |


# Operator Staking Pool

The `OperatorStakingPool` tracks node operator LST balances for the purpose of differentiating from community LST balances. Node operators are required to stake their LSTs into this contract.

## View Functions

### lst

Returns the address of the liquid staking token supported by this pool

```solidity
function lst() external view returns (address)
```

#### Return Values

| Name | Type    | Description    |
| ---- | ------- | -------------- |
| lst  | address | address of LST |

### depositLimit

Returns the max amount of deposits per operator

```solidity
function depositLimit() external view returns (uint256)
```

#### Return Values

| Name         | Type    | Description                         |
| ------------ | ------- | ----------------------------------- |
| depositLimit | uint256 | max amount of deposits per operator |

### getOperators

Returns a list of all operators

```solidity
function getOperators() external view returns (address[])
```

#### Return Values

| Name      | Type       | Description       |
| --------- | ---------- | ----------------- |
| operators | address\[] | list of operators |

### getOperatorPrincipal

Returns an operator's principal staked balance

```solidity
function getOperatorPrincipal(address _operator) public view returns (uint256)
```

#### Parameters

| Name       | Type    | Description         |
| ---------- | ------- | ------------------- |
| \_operator | address | address of operator |

#### Return Values

| Name              | Type    | Description                      |
| ----------------- | ------- | -------------------------------- |
| operatorPrincipal | uint256 | operator principal staked amount |

### getOperatorStaked

Returns an operator's total staked balance

```solidity
function getOperatorStaked(address _operator) public view returns (uint256)
```

#### Parameters

| Name       | Type    | Description         |
| ---------- | ------- | ------------------- |
| \_operator | address | address of operator |

#### Return Values

| Name           | Type    | Description            |
| -------------- | ------- | ---------------------- |
| operatorStaked | uint256 | operator staked amount |

### getTotalPrincipal

Returns the total principal staked amount

```solidity
function getTotalPrincipal() external view returns (uint256)
```

#### Return Values

| Name           | Type    | Description                   |
| -------------- | ------- | ----------------------------- |
| totalPrincipal | uint256 | total principal staked amount |

### getTotalStaked

Returns the total staked amount

```solidity
function getTotalStaked() external view returns (uint256)
```

#### Return Values

| Name        | Type    | Description         |
| ----------- | ------- | ------------------- |
| totalStaked | uint256 | total staked amount |

### isOperator

Returns whether an account is an operator

```solidity
function isOperator(address _account) public view returns (bool)
```

#### Return Values

| Name       | Type | Description                                  |
| ---------- | ---- | -------------------------------------------- |
| isOperator | bool | true if account is operator, false otherwise |

## Write Functions

### onTokenTransfer

ERC677 implementation to receive deposits

```solidity
function onTokenTransfer(address _sender, uint256 _value, bytes) external
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| \_sender | address | address of sender           |
| \_value  | uint256 | amount of tokens to deposit |
|          | bytes   |                             |

### withdraw

Withdraws tokens

```solidity
function withdraw(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description        |
| -------- | ------- | ------------------ |
| \_amount | uint256 | amount to withdraw |

### addOperators

Adds new operators

```solidity
function addOperators(address[] _operators) external
```

#### Parameters

| Name        | Type       | Description              |
| ----------- | ---------- | ------------------------ |
| \_operators | address\[] | list of operators to add |

### removeOperators

Removes existing operators

```solidity
function removeOperators(address[] _operators) external
```

#### Parameters

| Name        | Type       | Description                 |
| ----------- | ---------- | --------------------------- |
| \_operators | address\[] | list of operators to remove |

### setDepositLimit

Sets the max amount of deposits per operator

```solidity
function setDepositLimit(uint256 _depositLimit) external
```

#### Parameters

| Name           | Type    | Description                         |
| -------------- | ------- | ----------------------------------- |
| \_depositLimit | uint256 | max amount of deposits per operator |


# Polygon Strategy

`PolygonStrategy` is a staking strategy that manages multiple `PolygonVault` contracts by tracking the balance of each and moving tokens in and out of them.

## View Functions

### token

Returns the address of the staking token (POL).

```solidity
function token() public view returns (address)
```

#### Return Values

| Name  | Type    | Description       |
| ----- | ------- | ----------------- |
| token | address | POL token address |

### stakingPool

Returns the address of the staking pool that controls this strategy.

```solidity
function stakingPool() public view returns (address)
```

#### Return Values

| Name        | Type    | Description          |
| ----------- | ------- | -------------------- |
| stakingPool | address | Staking pool address |

### stakeManager

Returns the address of the Polygon stake manager contract.

```solidity
function stakeManager() public view returns (address)
```

#### Return Values

| Name         | Type    | Description           |
| ------------ | ------- | --------------------- |
| stakeManager | address | Stake manager address |

### fundFlowController

Returns the address of the fund flow controller contract.

```solidity
function fundFlowController() public view returns (address)
```

#### Return Values

| Name               | Type    | Description                  |
| ------------------ | ------- | ---------------------------- |
| fundFlowController | address | Fund flow controller address |

### validatorMEVRewardsPool

Returns the address of the MEV rewards pool contract.

```solidity
function validatorMEVRewardsPool() public view returns (address)
```

#### Return Values

| Name                    | Type    | Description              |
| ----------------------- | ------- | ------------------------ |
| validatorMEVRewardsPool | address | MEV rewards pool address |

### validatorMEVRewardsPercentage

Returns the percentage of MEV rewards validators will receive (basis points).

```solidity
function validatorMEVRewardsPercentage() public view returns (uint256)
```

#### Return Values

| Name                          | Type    | Description             |
| ----------------------------- | ------- | ----------------------- |
| validatorMEVRewardsPercentage | uint256 | Validator MEV rewards % |

### vaultImplementation

Returns the address of the vault implementation contract.

```solidity
function vaultImplementation() public view returns (address)
```

#### Return Values

| Name                | Type    | Description                  |
| ------------------- | ------- | ---------------------------- |
| vaultImplementation | address | Vault implementation address |

### validatorRemoval

Returns the current validator removal state.

```solidity
function validatorRemoval() public view returns (bool isActive, uint64 validatorId, uint128 queuedWithdrawals)
```

#### Return Values

| Name              | Type    | Description          |
| ----------------- | ------- | -------------------- |
| isActive          | bool    | If removal is active |
| validatorId       | uint64  | Validator ID         |
| queuedWithdrawals | uint128 | Queued withdrawals   |

### totalQueued

Returns the total number of tokens queued for deposit into vaults.

```solidity
function totalQueued() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description         |
| ----------- | ------- | ------------------- |
| totalQueued | uint256 | Total queued tokens |

### numVaultsUnbonding

Returns the total number of vaults currently unbonding.

```solidity
function numVaultsUnbonding() public view returns (uint256)
```

#### Return Values

| Name               | Type    | Description                |
| ------------------ | ------- | -------------------------- |
| numVaultsUnbonding | uint256 | Number of vaults unbonding |

### validatorWithdrawalIndex

Returns the index of validator to withdraw from on next withdrawal.

```solidity
function validatorWithdrawalIndex() public view returns (uint256)
```

#### Return Values

| Name                     | Type    | Description                |
| ------------------------ | ------- | -------------------------- |
| validatorWithdrawalIndex | uint256 | Validator withdrawal index |

### canDeposit

Returns the available deposit room for this strategy.

```solidity
function canDeposit() public view returns (uint256)
```

#### Return Values

| Name       | Type    | Description            |
| ---------- | ------- | ---------------------- |
| canDeposit | uint256 | Available deposit room |

### canWithdraw

Returns the available withdrawal room for this strategy.

```solidity
function canWithdraw() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description               |
| ----------- | ------- | ------------------------- |
| canWithdraw | uint256 | Available withdrawal room |

### getTotalDeposits

Returns the total amount of deposits in this strategy.

```solidity
function getTotalDeposits() public view returns (uint256)
```

#### Return Values

| Name          | Type    | Description    |
| ------------- | ------- | -------------- |
| totalDeposits | uint256 | Total deposits |

### getMaxDeposits

Returns the maximum that can be deposited into this strategy.

```solidity
function getMaxDeposits() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description      |
| ----------- | ------- | ---------------- |
| maxDeposits | uint256 | Maximum deposits |

### getMinDeposits

Returns the minimum that must remain in this strategy.

```solidity
function getMinDeposits() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description      |
| ----------- | ------- | ---------------- |
| minDeposits | uint256 | Minimum deposits |

### getValidators

Returns a list of all validators.

```solidity
function getValidators() external view returns (Validator[] memory)
```

#### Return Values

| Name       | Type         | Description        |
| ---------- | ------------ | ------------------ |
| validators | Validator\[] | List of validators |

### getVaults

Returns a list of all vaults controlled by this contract.

```solidity
function getVaults() external view returns (IPolygonVault[] memory)
```

#### Return Values

| Name   | Type             | Description    |
| ------ | ---------------- | -------------- |
| vaults | IPolygonVault\[] | List of vaults |

### getDepositChange

Returns the deposit change since deposits were last updated.

```solidity
function getDepositChange() public view returns (int)
```

#### Return Values

| Name          | Type | Description              |
| ------------- | ---- | ------------------------ |
| depositChange | int  | Change in total deposits |

### getFees

Returns a list of all fees and fee receivers.

```solidity
function getFees() external view returns (Fee[] memory)
```

#### Return Values

| Name | Type   | Description  |
| ---- | ------ | ------------ |
| fees | Fee\[] | List of fees |

### staked

Returns whether an account should receive validator rewards (used by the validator MEV rewards pool).

```solidity
function staked(address _account) public view returns (uint256)
```

#### Parameters

| Name      | Type    | Description     |
| --------- | ------- | --------------- |
| \_account | address | Account address |

#### Return Values

| Name   | Type    | Description                |
| ------ | ------- | -------------------------- |
| staked | uint256 | 1 if eligible, 0 otherwise |

### totalStaked

Returns the total number of active validators (used by the validator MEV rewards pool).

```solidity
function totalStaked() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description          |
| ----------- | ------- | -------------------- |
| totalStaked | uint256 | Number of validators |

## Write Functions

### deposit

Deposits tokens from the staking pool into this strategy.

```solidity
function deposit(uint256 _amount, bytes calldata) external
```

#### Parameters

| Name     | Type    | Description       |
| -------- | ------- | ----------------- |
| \_amount | uint256 | Amount to deposit |

### withdraw

Withdraws tokens from this strategy and sends them to staking pool.

```solidity
function withdraw(uint256 _amount, bytes calldata) external
```

#### Parameters

| Name     | Type    | Description        |
| -------- | ------- | ------------------ |
| \_amount | uint256 | Amount to withdraw |

### depositQueuedTokens

Deposits queued tokens into vaults.

```solidity
function depositQueuedTokens(uint256[] calldata _vaultIds, uint256[] calldata _amounts) external
```

#### Parameters

| Name       | Type       | Description                  |
| ---------- | ---------- | ---------------------------- |
| \_vaultIds | uint256\[] | List of vault IDs            |
| \_amounts  | uint256\[] | Amounts to deposit per vault |

### unbond

Unbonds token deposits in vaults.

```solidity
function unbond(uint256 _toUnbond) external
```

#### Parameters

| Name       | Type    | Description      |
| ---------- | ------- | ---------------- |
| \_toUnbond | uint256 | Amount to unbond |

### forceUnbond

Unbonds token deposits in vaults (used to rebalance between vaults).

```solidity
function forceUnbond(uint256[] calldata _vaultIds, uint256[] calldata _amounts) external
```

#### Parameters

| Name       | Type       | Description                 |
| ---------- | ---------- | --------------------------- |
| \_vaultIds | uint256\[] | List of vault IDs           |
| \_amounts  | uint256\[] | Amounts to unbond per vault |

### unstakeClaim

Claims and withdraws tokens from vaults that are unbonded.

```solidity
function unstakeClaim(uint256[] calldata _vaultIds) external
```

#### Parameters

| Name       | Type       | Description       |
| ---------- | ---------- | ----------------- |
| \_vaultIds | uint256\[] | List of vault IDs |

### updateDeposits

Updates deposit accounting and calculates fees on newly earned rewards.

```solidity
function updateDeposits(bytes calldata) external returns (int256 depositChange, address[] memory receivers, uint256[] memory amounts)
```

#### Return Values

| Name          | Type       | Description                          |
| ------------- | ---------- | ------------------------------------ |
| depositChange | int256     | Change in deposits since last update |
| receivers     | address\[] | List of fee receivers                |
| amounts       | uint256\[] | List of fee amounts                  |

### restakeRewards

Restakes rewards in the polygon staking contract for given vaults.

```solidity
function restakeRewards(uint256[] calldata _vaultIds) external
```

#### Parameters

| Name       | Type       | Description       |
| ---------- | ---------- | ----------------- |
| \_vaultIds | uint256\[] | List of vault IDs |

### addValidator

Adds a new validator.

```solidity
function addValidator(address _pool, address _rewardsReceiver) external
```

#### Parameters

| Name              | Type    | Description                    |
| ----------------- | ------- | ------------------------------ |
| \_pool            | address | Validator shares pool address  |
| \_rewardsReceiver | address | Validator MEV rewards receiver |

### queueValidatorRemoval

Queues a validator for removal.

```solidity
function queueValidatorRemoval(uint256 _validatorId) external
```

#### Parameters

| Name          | Type    | Description  |
| ------------- | ------- | ------------ |
| \_validatorId | uint256 | Validator ID |

### finalizeValidatorRemoval

Finalizes a queued validator removal.

```solidity
function finalizeValidatorRemoval() external
```

### upgradeVaults

Upgrades vaults to a new implementation contract.

```solidity
function upgradeVaults(address[] calldata _vaults, bytes[] memory _data) external
```

#### Parameters

| Name     | Type       | Description                      |
| -------- | ---------- | -------------------------------- |
| \_vaults | address\[] | List of vault addresses          |
| \_data   | bytes\[]   | Encoded function calls per vault |

### addFee

Adds a new fee.

```solidity
function addFee(address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description          |
| ---------------- | ------- | -------------------- |
| \_receiver       | address | Fee receiver address |
| \_feeBasisPoints | uint256 | Fee in basis points  |

### updateFee

Updates an existing fee.

```solidity
function updateFee(uint256 _index, address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description          |
| ---------------- | ------- | -------------------- |
| \_index          | uint256 | Fee index            |
| \_receiver       | address | Fee receiver address |
| \_feeBasisPoints | uint256 | Fee in basis points  |

### setValidatorMEVRewardsPool

Sets the validator MEV rewards pool.

```solidity
function setValidatorMEVRewardsPool(address _validatorMEVRewardsPool) external
```

#### Parameters

| Name                      | Type    | Description              |
| ------------------------- | ------- | ------------------------ |
| \_validatorMEVRewardsPool | address | MEV rewards pool address |

### setValidatorMEVRewardsPercentage

Sets the percentage of MEV rewards that validators receive.

```solidity
function setValidatorMEVRewardsPercentage(uint256 _validatorMEVRewardsPercentage) external
```

#### Parameters

| Name                            | Type    | Description             |
| ------------------------------- | ------- | ----------------------- |
| \_validatorMEVRewardsPercentage | uint256 | Validator MEV rewards % |

### setVaultImplementation

Sets a new vault implementation contract to be used when deploying/upgrading vaults.

```solidity
function setVaultImplementation(address _vaultImplementation) external
```

#### Parameters

| Name                  | Type    | Description                  |
| --------------------- | ------- | ---------------------------- |
| \_vaultImplementation | address | Vault implementation address |

### setFundFlowController

Sets the fund flow controller.

```solidity
function setFundFlowController(address _fundFlowController) external
```

#### Parameters

| Name                 | Type    | Description                  |
| -------------------- | ------- | ---------------------------- |
| \_fundFlowController | address | Fund flow controller address |


# Polygon Vault

`PolygonVault` manages deposits of POL into a Polygon validator delegation contract.

## View Functions

### token

Returns the address of the staking token (POL).

```solidity
function token() public view returns (address)
```

#### Return Values

| Name  | Type    | Description       |
| ----- | ------- | ----------------- |
| token | address | POL token address |

### vaultController

Returns the address of the strategy that controls this vault.

```solidity
function vaultController() public view returns (address)
```

#### Return Values

| Name            | Type    | Description              |
| --------------- | ------- | ------------------------ |
| vaultController | address | Vault controller address |

### stakeManager

Returns the address of the Polygon stake manager contract.

```solidity
function stakeManager() public view returns (address)
```

#### Return Values

| Name         | Type    | Description           |
| ------------ | ------- | --------------------- |
| stakeManager | address | Stake manager address |

### validatorPool

Returns the address of the Polygon validator delegation contract.

```solidity
function validatorPool() public view returns (address)
```

#### Return Values

| Name          | Type    | Description            |
| ------------- | ------- | ---------------------- |
| validatorPool | address | Validator pool address |

### getTotalDeposits

Returns the total balance of this contract (principal, rewards, queued withdrawals, and tokens held).

```solidity
function getTotalDeposits() public view returns (uint256)
```

#### Return Values

| Name          | Type    | Description   |
| ------------- | ------- | ------------- |
| totalDeposits | uint256 | Total balance |

### getPrincipalDeposits

Returns the principal balance of this contract in the validator pool.

```solidity
function getPrincipalDeposits() public view returns (uint256)
```

#### Return Values

| Name              | Type    | Description       |
| ----------------- | ------- | ----------------- |
| principalDeposits | uint256 | Principal balance |

### getRewards

Returns the claimable rewards balance of this contract in the validator pool.

```solidity
function getRewards() public view returns (uint256)
```

#### Return Values

| Name    | Type    | Description       |
| ------- | ------- | ----------------- |
| rewards | uint256 | Claimable rewards |

### getQueuedWithdrawals

Returns the amount of queued withdrawals for this contract in the validator pool.

```solidity
function getQueuedWithdrawals() public view returns (uint256)
```

#### Return Values

| Name              | Type    | Description        |
| ----------------- | ------- | ------------------ |
| queuedWithdrawals | uint256 | Queued withdrawals |

### isWithdrawable

Returns whether deposits can be withdrawn from the validator pool.

```solidity
function isWithdrawable() external view returns (bool)
```

#### Return Values

| Name         | Type | Description                           |
| ------------ | ---- | ------------------------------------- |
| withdrawable | bool | true if withdrawable, false otherwise |

### isUnbonding

Returns whether this vault is currently unbonding.

```solidity
function isUnbonding() external view returns (bool)
```

#### Return Values

| Name      | Type | Description                        |
| --------- | ---- | ---------------------------------- |
| unbonding | bool | true if unbonding, false otherwise |

### minRewardClaimAmount

Returns the minimum amount of rewards that can be claimed/restaked.

```solidity
function minRewardClaimAmount() external view returns (uint256)
```

#### Return Values

| Name      | Type    | Description       |
| --------- | ------- | ----------------- |
| minAmount | uint256 | Minimum claimable |

## Write Functions

### deposit

Deposits tokens from the vault controller into the validator pool.

```solidity
function deposit(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description       |
| -------- | ------- | ----------------- |
| \_amount | uint256 | Amount to deposit |

### withdraw

Withdraws tokens from the validator pool and sends them to the vault controller.

```solidity
function withdraw() external returns (uint256)
```

#### Return Values

| Name   | Type    | Description      |
| ------ | ------- | ---------------- |
| amount | uint256 | Amount withdrawn |

### unbond

Queues tokens for withdrawal in the validator pool.

```solidity
function unbond(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description      |
| -------- | ------- | ---------------- |
| \_amount | uint256 | Amount to unbond |

### restakeRewards

Restakes rewards in the validator pool.

```solidity
function restakeRewards() external
```

### withdrawRewards

Withdraws rewards from the validator pool.

```solidity
function withdrawRewards() external
```


# Polygon Fund Flow Controller

`PolygonFundFlowController` manages deposits and withdrawals for Polygon staking vaults, including unbonding, restaking, and reward management. It coordinates with the strategy and withdrawal pool contracts and exposes functions for vault and reward state queries.

## View Functions

### strategy

Returns the address of the staking strategy contract.

```solidity
function strategy() public view returns (address)
```

#### Return Values

| Name     | Type    | Description              |
| -------- | ------- | ------------------------ |
| strategy | address | Staking strategy address |

### withdrawalPool

Returns the address of the withdrawal pool contract.

```solidity
function withdrawalPool() public view returns (address)
```

#### Return Values

| Name           | Type    | Description             |
| -------------- | ------- | ----------------------- |
| withdrawalPool | address | Withdrawal pool address |

### depositController

Returns the address authorized to deposit queued tokens into vaults.

```solidity
function depositController() public view returns (address)
```

#### Return Values

| Name              | Type    | Description                |
| ----------------- | ------- | -------------------------- |
| depositController | address | Deposit controller address |

### minTimeBetweenUnbonding

Returns the minimum number of seconds between unbonding calls.

```solidity
function minTimeBetweenUnbonding() public view returns (uint64)
```

#### Return Values

| Name                    | Type   | Description                       |
| ----------------------- | ------ | --------------------------------- |
| minTimeBetweenUnbonding | uint64 | Minimum seconds between unbonding |

### timeOfLastUnbond

Returns the time of the last unbonding call.

```solidity
function timeOfLastUnbond() public view returns (uint64)
```

#### Return Values

| Name             | Type   | Description            |
| ---------------- | ------ | ---------------------- |
| timeOfLastUnbond | uint64 | Time of last unbonding |

### canDepositQueuedTokens

Returns whether tokens can be deposited.

```solidity
function canDepositQueuedTokens() external view returns (bool)
```

#### Return Values

| Name       | Type | Description                |
| ---------- | ---- | -------------------------- |
| canDeposit | bool | true if deposit is allowed |

### shouldUnbondVaults

Returns whether vaults should be unbonded.

```solidity
function shouldUnbondVaults() external view returns (bool)
```

#### Return Values

| Name         | Type | Description                 |
| ------------ | ---- | --------------------------- |
| shouldUnbond | bool | true if unbonding is needed |

### shouldWithdrawVaults

Returns whether vaults are unbonded and ready to be withdrawn from, and the list of withdrawable vaults.

```solidity
function shouldWithdrawVaults() external view returns (bool, uint256[] memory)
```

#### Return Values

| Name        | Type       | Description                    |
| ----------- | ---------- | ------------------------------ |
| canWithdraw | bool       | true if withdrawal is possible |
| vaultIds    | uint256\[] | List of withdrawable vault IDs |

### getVaultDeposits

Returns a list of total deposits for all vaults.

```solidity
function getVaultDeposits() external view returns (uint256[] memory)
```

#### Return Values

| Name     | Type       | Description            |
| -------- | ---------- | ---------------------- |
| deposits | uint256\[] | List of vault deposits |

### getVaultRewards

Returns a list of unclaimed rewards for all vaults.

```solidity
function getVaultRewards() external view returns (uint256[] memory)
```

#### Return Values

| Name    | Type       | Description           |
| ------- | ---------- | --------------------- |
| rewards | uint256\[] | List of vault rewards |

### getUnbondingVaults

Returns a list of currently unbonding vaults (excluding those queued for removal).

```solidity
function getUnbondingVaults() external view returns (uint256[] memory)
```

#### Return Values

| Name     | Type       | Description              |
| -------- | ---------- | ------------------------ |
| vaultIds | uint256\[] | List of unbonding vaults |

### getWithdrawableVaults

Returns a list of currently withdrawable vaults (excluding those queued for removal).

```solidity
function getWithdrawableVaults() public view returns (uint256[] memory)
```

#### Return Values

| Name     | Type       | Description                 |
| -------- | ---------- | --------------------------- |
| vaultIds | uint256\[] | List of withdrawable vaults |

## Write Functions

### depositQueuedTokens

Deposits queued tokens into vaults.

```solidity
function depositQueuedTokens(uint256[] calldata _vaultIds, uint256[] calldata _amounts) external
```

#### Parameters

| Name       | Type       | Description                  |
| ---------- | ---------- | ---------------------------- |
| \_vaultIds | uint256\[] | List of vault IDs            |
| \_amounts  | uint256\[] | Amounts to deposit per vault |

### unbondVaults

Unbonds vaults if needed.

```solidity
function unbondVaults() external
```

### forceUnbondVaults

Unbonds vaults to rebalance deposits between vaults.

```solidity
function forceUnbondVaults(uint256[] calldata _vaultIds, uint256[] calldata _amounts) external
```

#### Parameters

| Name       | Type       | Description                 |
| ---------- | ---------- | --------------------------- |
| \_vaultIds | uint256\[] | List of vault IDs           |
| \_amounts  | uint256\[] | Amounts to unbond per vault |

### withdrawVaults

Withdraws from vaults and triggers withdrawal pool upkeep if needed.

```solidity
function withdrawVaults(uint256[] calldata _vaultIds) external
```

#### Parameters

| Name       | Type       | Description       |
| ---------- | ---------- | ----------------- |
| \_vaultIds | uint256\[] | List of vault IDs |

### restakeRewards

Restakes vault rewards for given vaults.

```solidity
function restakeRewards(uint256[] calldata _vaultIds) external
```

#### Parameters

| Name       | Type       | Description       |
| ---------- | ---------- | ----------------- |
| \_vaultIds | uint256\[] | List of vault IDs |

### setDepositController

Sets the address authorized to deposit queued tokens.

```solidity
function setDepositController(address _depositController) external
```

#### Parameters

| Name                | Type    | Description                |
| ------------------- | ------- | -------------------------- |
| \_depositController | address | Deposit controller address |

### setMinTimeBetweenUnbonding

Sets the minimum time between unbonding calls.

```solidity
function setMinTimeBetweenUnbonding(uint64 _minTimeBetweenUnbonding) external
```

#### Parameters

| Name                      | Type   | Description                       |
| ------------------------- | ------ | --------------------------------- |
| \_minTimeBetweenUnbonding | uint64 | Minimum seconds between unbonding |


# Espresso Strategy

`EspressoStrategy` is a staking strategy that manages multiple `EspressoVault` contracts by tracking the balance of each and moving tokens in and out of them.

## View Functions

### token

Returns the address of the staking token (ESP).

```solidity
function token() public view returns (address)
```

#### Return Values

| Name  | Type    | Description       |
| ----- | ------- | ----------------- |
| token | address | ESP token address |

### stakingPool

Returns the address of the staking pool that controls this strategy.

```solidity
function stakingPool() public view returns (address)
```

#### Return Values

| Name        | Type    | Description          |
| ----------- | ------- | -------------------- |
| stakingPool | address | Staking pool address |

### espressoStaking

Returns the address of the Espresso delegation contract.

```solidity
function espressoStaking() public view returns (address)
```

#### Return Values

| Name            | Type    | Description                          |
| --------------- | ------- | ------------------------------------ |
| espressoStaking | address | Espresso delegation contract address |

### espressoRewards

Returns the address of the Espresso rewards contract.

```solidity
function espressoRewards() public view returns (address)
```

#### Return Values

| Name            | Type    | Description                       |
| --------------- | ------- | --------------------------------- |
| espressoRewards | address | Espresso rewards contract address |

### fundFlowController

Returns the address of the fund flow controller contract.

```solidity
function fundFlowController() public view returns (address)
```

#### Return Values

| Name               | Type    | Description                  |
| ------------------ | ------- | ---------------------------- |
| fundFlowController | address | Fund flow controller address |

### rewardsOracle

Returns the address of the rewards oracle.

```solidity
function rewardsOracle() public view returns (address)
```

#### Return Values

| Name          | Type    | Description            |
| ------------- | ------- | ---------------------- |
| rewardsOracle | address | Rewards oracle address |

### maxRewardChangeBPS

Returns the max reward change allowed per update in basis points.

```solidity
function maxRewardChangeBPS() public view returns (uint256)
```

#### Return Values

| Name               | Type    | Description                        |
| ------------------ | ------- | ---------------------------------- |
| maxRewardChangeBPS | uint256 | Max reward change per update (bps) |

### vaultImplementation

Returns the address of the vault implementation contract.

```solidity
function vaultImplementation() public view returns (address)
```

#### Return Values

| Name                | Type    | Description                  |
| ------------------- | ------- | ---------------------------- |
| vaultImplementation | address | Vault implementation address |

### totalQueued

Returns the total number of tokens queued for deposit into vaults.

```solidity
function totalQueued() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description         |
| ----------- | ------- | ------------------- |
| totalQueued | uint256 | Total queued tokens |

### numVaultsUnbonding

Returns the total number of vaults currently unbonding.

```solidity
function numVaultsUnbonding() public view returns (uint256)
```

#### Return Values

| Name               | Type    | Description                |
| ------------------ | ------- | -------------------------- |
| numVaultsUnbonding | uint256 | Number of vaults unbonding |

### vaultWithdrawalIndex

Returns the index of vault to withdraw from on next withdrawal.

```solidity
function vaultWithdrawalIndex() public view returns (uint256)
```

#### Return Values

| Name                 | Type    | Description            |
| -------------------- | ------- | ---------------------- |
| vaultWithdrawalIndex | uint256 | Vault withdrawal index |

### canDeposit

Returns the available deposit room for this strategy.

```solidity
function canDeposit() public view returns (uint256)
```

#### Return Values

| Name       | Type    | Description            |
| ---------- | ------- | ---------------------- |
| canDeposit | uint256 | Available deposit room |

### canWithdraw

Returns the available withdrawal room for this strategy.

```solidity
function canWithdraw() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description               |
| ----------- | ------- | ------------------------- |
| canWithdraw | uint256 | Available withdrawal room |

### getTotalDeposits

Returns the total amount of deposits in this strategy.

```solidity
function getTotalDeposits() public view returns (uint256)
```

#### Return Values

| Name          | Type    | Description    |
| ------------- | ------- | -------------- |
| totalDeposits | uint256 | Total deposits |

### getMaxDeposits

Returns the maximum that can be deposited into this strategy.

```solidity
function getMaxDeposits() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description      |
| ----------- | ------- | ---------------- |
| maxDeposits | uint256 | Maximum deposits |

### getMinDeposits

Returns the minimum that must remain in this strategy.

```solidity
function getMinDeposits() public view returns (uint256)
```

#### Return Values

| Name        | Type    | Description      |
| ----------- | ------- | ---------------- |
| minDeposits | uint256 | Minimum deposits |

### getVaults

Returns a list of all vaults controlled by this contract.

```solidity
function getVaults() external view returns (IEspressoVault[] memory)
```

#### Return Values

| Name   | Type              | Description    |
| ------ | ----------------- | -------------- |
| vaults | IEspressoVault\[] | List of vaults |

### getDepositChange

Returns the deposit change since deposits were last updated.

```solidity
function getDepositChange() public view returns (int)
```

#### Return Values

| Name          | Type | Description              |
| ------------- | ---- | ------------------------ |
| depositChange | int  | Change in total deposits |

### getFees

Returns a list of all fees and fee receivers.

```solidity
function getFees() external view returns (Fee[] memory)
```

#### Return Values

| Name | Type   | Description  |
| ---- | ------ | ------------ |
| fees | Fee\[] | List of fees |

## Write Functions

### deposit

Deposits tokens from the staking pool into this strategy.

```solidity
function deposit(uint256 _amount, bytes calldata) external
```

#### Parameters

| Name     | Type    | Description       |
| -------- | ------- | ----------------- |
| \_amount | uint256 | Amount to deposit |

### withdraw

Withdraws tokens from this strategy and sends them to staking pool.

```solidity
function withdraw(uint256 _amount, bytes calldata) external
```

#### Parameters

| Name     | Type    | Description        |
| -------- | ------- | ------------------ |
| \_amount | uint256 | Amount to withdraw |

### depositQueuedTokens

Deposits queued tokens into vaults.

```solidity
function depositQueuedTokens(uint256[] calldata _vaultIds, uint256[] calldata _amounts) external
```

#### Parameters

| Name       | Type       | Description                  |
| ---------- | ---------- | ---------------------------- |
| \_vaultIds | uint256\[] | List of vault IDs            |
| \_amounts  | uint256\[] | Amounts to deposit per vault |

### unbond

Unbonds token deposits in vaults.

```solidity
function unbond(uint256 _toUnbond) external
```

#### Parameters

| Name       | Type    | Description      |
| ---------- | ------- | ---------------- |
| \_toUnbond | uint256 | Amount to unbond |

### forceUnbond

Unbonds token deposits in vaults (used to rebalance between vaults).

```solidity
function forceUnbond(uint256[] calldata _vaultIds, uint256[] calldata _amounts) external
```

#### Parameters

| Name       | Type       | Description                 |
| ---------- | ---------- | --------------------------- |
| \_vaultIds | uint256\[] | List of vault IDs           |
| \_amounts  | uint256\[] | Amounts to unbond per vault |

### claimUnbond

Claims and withdraws tokens from vaults that are unbonded.

```solidity
function claimUnbond(uint256[] calldata _vaultIds) external
```

#### Parameters

| Name       | Type       | Description       |
| ---------- | ---------- | ----------------- |
| \_vaultIds | uint256\[] | List of vault IDs |

### updateDeposits

Updates deposit accounting and calculates fees on newly earned rewards.

```solidity
function updateDeposits(bytes calldata) external returns (int256 depositChange, address[] memory receivers, uint256[] memory amounts)
```

#### Return Values

| Name          | Type       | Description                          |
| ------------- | ---------- | ------------------------------------ |
| depositChange | int256     | Change in deposits since last update |
| receivers     | address\[] | List of fee receivers                |
| amounts       | uint256\[] | List of fee amounts                  |

### restakeRewards

Restakes rewards in the Espresso staking contract for given vaults.

```solidity
function restakeRewards(uint256[] calldata _vaultIds, uint256[] calldata _lifetimeRewards, bytes[] calldata _authData) external
```

#### Parameters

| Name              | Type       | Description                            |
| ----------------- | ---------- | -------------------------------------- |
| \_vaultIds        | uint256\[] | List of vault IDs                      |
| \_lifetimeRewards | uint256\[] | Lifetime rewards values for each vault |
| \_authData        | bytes\[]   | Authorization data for each vault      |

### withdrawRewards

Withdraws rewards from the Espresso staking contract for given vaults.

```solidity
function withdrawRewards(uint256[] calldata _vaultIds, uint256[] calldata _lifetimeRewards, bytes[] calldata _authData) external
```

#### Parameters

| Name              | Type       | Description                            |
| ----------------- | ---------- | -------------------------------------- |
| \_vaultIds        | uint256\[] | List of vault IDs                      |
| \_lifetimeRewards | uint256\[] | Lifetime rewards values for each vault |
| \_authData        | bytes\[]   | Authorization data for each vault      |

### updateLifetimeRewards

Updates lifetime rewards tracking for specified vaults. Used to sync lifetime rewards which is fetched off chain.

```solidity
function updateLifetimeRewards(uint256[] calldata _vaultIds, uint256[] calldata _lifetimeRewards) external
```

#### Parameters

| Name              | Type       | Description                            |
| ----------------- | ---------- | -------------------------------------- |
| \_vaultIds        | uint256\[] | List of vault IDs                      |
| \_lifetimeRewards | uint256\[] | Lifetime rewards values for each vault |

### claimValidatorExits

Claims validator exits for specified vaults.

```solidity
function claimValidatorExits(uint256[] calldata _vaultIds) external
```

#### Parameters

| Name       | Type       | Description       |
| ---------- | ---------- | ----------------- |
| \_vaultIds | uint256\[] | List of vault IDs |

### addVault

Adds a new vault for a validator.

```solidity
function addVault(address _validator) external
```

#### Parameters

| Name        | Type    | Description       |
| ----------- | ------- | ----------------- |
| \_validator | address | Validator address |

### removeVaults

Removes vaults. Withdraws any remaining principal deposits so vault must be empty or any unbonding periods must have elapsed for remaining deposits. Will not claim rewards so rewards must be claimed before removing a vault.

```solidity
function removeVaults(uint256[] calldata _vaultIdxs) external
```

#### Parameters

| Name        | Type       | Description                                     |
| ----------- | ---------- | ----------------------------------------------- |
| \_vaultIdxs | uint256\[] | List of vault indices (must be ascending order) |

### upgradeVaults

Upgrades vaults to a new implementation contract.

```solidity
function upgradeVaults(address[] calldata _vaults, bytes[] memory _data) external
```

#### Parameters

| Name     | Type       | Description                      |
| -------- | ---------- | -------------------------------- |
| \_vaults | address\[] | List of vault addresses          |
| \_data   | bytes\[]   | Encoded function calls per vault |

### addFee

Adds a new fee.

```solidity
function addFee(address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description          |
| ---------------- | ------- | -------------------- |
| \_receiver       | address | Fee receiver address |
| \_feeBasisPoints | uint256 | Fee in basis points  |

### updateFee

Updates an existing fee. Set `_feeBasisPoints` to 0 to remove the fee.

```solidity
function updateFee(uint256 _index, address _receiver, uint256 _feeBasisPoints) external
```

#### Parameters

| Name             | Type    | Description          |
| ---------------- | ------- | -------------------- |
| \_index          | uint256 | Fee index            |
| \_receiver       | address | Fee receiver address |
| \_feeBasisPoints | uint256 | Fee in basis points  |

### setVaultImplementation

Sets a new vault implementation contract to be used when deploying/upgrading vaults.

```solidity
function setVaultImplementation(address _vaultImplementation) external
```

#### Parameters

| Name                  | Type    | Description                  |
| --------------------- | ------- | ---------------------------- |
| \_vaultImplementation | address | Vault implementation address |

### setFundFlowController

Sets the fund flow controller.

```solidity
function setFundFlowController(address _fundFlowController) external
```

#### Parameters

| Name                 | Type    | Description                  |
| -------------------- | ------- | ---------------------------- |
| \_fundFlowController | address | Fund flow controller address |

### setRewardsOracle

Sets the rewards oracle.

```solidity
function setRewardsOracle(address _rewardsOracle) external
```

#### Parameters

| Name            | Type    | Description            |
| --------------- | ------- | ---------------------- |
| \_rewardsOracle | address | Rewards oracle address |

### setMaxRewardChangeBPS

Sets the max reward change allowed per update in basis points.

```solidity
function setMaxRewardChangeBPS(uint256 _maxRewardChangeBPS) external
```

#### Parameters

| Name                 | Type    | Description                        |
| -------------------- | ------- | ---------------------------------- |
| \_maxRewardChangeBPS | uint256 | Max reward change per update (bps) |


# Espresso Vault

`EspressoVault` manages deposits of ESP into an Espresso validator delegation contract.

## View Functions

### token

Returns the address of the staking token (ESP).

```solidity
function token() public view returns (address)
```

#### Return Values

| Name  | Type    | Description       |
| ----- | ------- | ----------------- |
| token | address | ESP token address |

### vaultController

Returns the address of the strategy that controls this vault.

```solidity
function vaultController() public view returns (address)
```

#### Return Values

| Name            | Type    | Description              |
| --------------- | ------- | ------------------------ |
| vaultController | address | Vault controller address |

### espressoStaking

Returns the address of the Espresso delegation contract.

```solidity
function espressoStaking() public view returns (address)
```

#### Return Values

| Name            | Type    | Description                          |
| --------------- | ------- | ------------------------------------ |
| espressoStaking | address | Espresso delegation contract address |

### espressoRewards

Returns the address of the Espresso rewards contract.

```solidity
function espressoRewards() public view returns (address)
```

#### Return Values

| Name            | Type    | Description                       |
| --------------- | ------- | --------------------------------- |
| espressoRewards | address | Espresso rewards contract address |

### validator

Returns the address of the validator that this vault delegates to.

```solidity
function validator() public view returns (address)
```

#### Return Values

| Name      | Type    | Description       |
| --------- | ------- | ----------------- |
| validator | address | Validator address |

### getTotalDeposits

Returns the total balance of this contract (principal, rewards, queued withdrawals, and tokens held).

```solidity
function getTotalDeposits() public view returns (uint256)
```

#### Return Values

| Name          | Type    | Description   |
| ------------- | ------- | ------------- |
| totalDeposits | uint256 | Total balance |

### getPrincipalDeposits

Returns the principal balance of this contract in the validator pool.

```solidity
function getPrincipalDeposits() public view returns (uint256)
```

#### Return Values

| Name              | Type    | Description       |
| ----------------- | ------- | ----------------- |
| principalDeposits | uint256 | Principal balance |

### getRewards

Returns the claimable rewards balance of this contract in the validator pool.

```solidity
function getRewards() public view returns (uint256)
```

#### Return Values

| Name    | Type    | Description       |
| ------- | ------- | ----------------- |
| rewards | uint256 | Claimable rewards |

### getQueuedWithdrawals

Returns the amount of queued withdrawals for this contract in the validator pool.

```solidity
function getQueuedWithdrawals() public view returns (uint256)
```

#### Return Values

| Name              | Type    | Description        |
| ----------------- | ------- | ------------------ |
| queuedWithdrawals | uint256 | Queued withdrawals |

### isWithdrawable

Returns whether deposits can be withdrawn from the validator pool.

```solidity
function isWithdrawable() external view returns (bool)
```

#### Return Values

| Name         | Type | Description                           |
| ------------ | ---- | ------------------------------------- |
| withdrawable | bool | true if withdrawable, false otherwise |

### isUnbonding

Returns whether this vault is currently unbonding.

```solidity
function isUnbonding() external view returns (bool)
```

#### Return Values

| Name      | Type | Description                        |
| --------- | ---- | ---------------------------------- |
| unbonding | bool | true if unbonding, false otherwise |

### isActive

Returns whether the validator this vault delegates to is active.

```solidity
function isActive() external view returns (bool)
```

#### Return Values

| Name   | Type | Description                     |
| ------ | ---- | ------------------------------- |
| active | bool | true if active, false otherwise |

### exitIsWithdrawable

Returns whether deposits can be withdrawn from the pool for an inactive validator.

```solidity
function exitIsWithdrawable() external view returns (bool)
```

#### Return Values

| Name         | Type | Description                           |
| ------------ | ---- | ------------------------------------- |
| withdrawable | bool | true if withdrawable, false otherwise |

## Write Functions

### deposit

Deposits tokens from the vault controller into the validator pool.

```solidity
function deposit(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description       |
| -------- | ------- | ----------------- |
| \_amount | uint256 | Amount to deposit |

### withdraw

Withdraws tokens from the validator pool and sends them to the vault controller.

```solidity
function withdraw() external returns (uint256)
```

#### Return Values

| Name   | Type    | Description      |
| ------ | ------- | ---------------- |
| amount | uint256 | Amount withdrawn |

### unbond

Queues tokens for withdrawal in the validator pool.

```solidity
function unbond(uint256 _amount) external
```

#### Parameters

| Name     | Type    | Description      |
| -------- | ------- | ---------------- |
| \_amount | uint256 | Amount to unbond |

### restakeRewards

Restakes rewards in the validator pool.

```solidity
function restakeRewards(uint256 _lifetimeRewards, bytes calldata _authData) external
```

#### Parameters

| Name              | Type    | Description                      |
| ----------------- | ------- | -------------------------------- |
| \_lifetimeRewards | uint256 | Total lifetime rewards for vault |
| \_authData        | bytes   | Authorization data for claiming  |

### withdrawRewards

Claims rewards from the validator pool and transfers them to the vault controller.

```solidity
function withdrawRewards(uint256 _lifetimeRewards, bytes calldata _authData) external
```

#### Parameters

| Name              | Type    | Description                      |
| ----------------- | ------- | -------------------------------- |
| \_lifetimeRewards | uint256 | Total lifetime rewards for vault |
| \_authData        | bytes   | Authorization data for claiming  |

### updateLifetimeRewards

Updates the lifetime rewards tracking for this vault. Used to sync lifetime rewards which is fetched off chain.

```solidity
function updateLifetimeRewards(uint256 _lifetimeRewards) external
```

#### Parameters

| Name              | Type    | Description                |
| ----------------- | ------- | -------------------------- |
| \_lifetimeRewards | uint256 | New lifetime rewards value |

### claimValidatorExit

Withdraws tokens from the validator pool when a validator has exited, and sends them to the vault controller.

```solidity
function claimValidatorExit() external
```


# Espresso Fund Flow Controller

`EspressoFundFlowController` manages deposits and withdrawals for Espresso staking vaults, including unbonding, restaking, and reward management. It coordinates with the strategy and withdrawal pool contracts and exposes functions for vault and reward state queries.

## View Functions

### strategy

Returns the address of the staking strategy contract.

```solidity
function strategy() public view returns (address)
```

#### Return Values

| Name     | Type    | Description              |
| -------- | ------- | ------------------------ |
| strategy | address | Staking strategy address |

### withdrawalPool

Returns the address of the withdrawal pool contract.

```solidity
function withdrawalPool() public view returns (address)
```

#### Return Values

| Name           | Type    | Description             |
| -------------- | ------- | ----------------------- |
| withdrawalPool | address | Withdrawal pool address |

### depositController

Returns the address authorized to deposit queued tokens into vaults.

```solidity
function depositController() public view returns (address)
```

#### Return Values

| Name              | Type    | Description                |
| ----------------- | ------- | -------------------------- |
| depositController | address | Deposit controller address |

### minTimeBetweenUnbonding

Returns the minimum number of seconds between unbonding calls.

```solidity
function minTimeBetweenUnbonding() public view returns (uint64)
```

#### Return Values

| Name                    | Type   | Description                       |
| ----------------------- | ------ | --------------------------------- |
| minTimeBetweenUnbonding | uint64 | Minimum seconds between unbonding |

### timeOfLastUnbond

Returns the time of the last unbonding call.

```solidity
function timeOfLastUnbond() public view returns (uint64)
```

#### Return Values

| Name             | Type   | Description            |
| ---------------- | ------ | ---------------------- |
| timeOfLastUnbond | uint64 | Time of last unbonding |

### shouldDepositQueuedTokens

Returns whether tokens should be deposited and the amount available for deposit.

```solidity
function shouldDepositQueuedTokens() external view returns (bool, uint256)
```

#### Return Values

| Name       | Type    | Description                           |
| ---------- | ------- | ------------------------------------- |
| canDeposit | bool    | true if deposit is allowed            |
| amount     | uint256 | Amount of tokens available to deposit |

### shouldUnbondVaults

Returns whether vaults should be unbonded.

```solidity
function shouldUnbondVaults() external view returns (bool)
```

#### Return Values

| Name         | Type | Description                 |
| ------------ | ---- | --------------------------- |
| shouldUnbond | bool | true if unbonding is needed |

### shouldWithdrawVaults

Returns whether vaults are unbonded and ready to be withdrawn from, and the list of withdrawable vaults.

```solidity
function shouldWithdrawVaults() external view returns (bool, uint256[] memory)
```

#### Return Values

| Name        | Type       | Description                    |
| ----------- | ---------- | ------------------------------ |
| canWithdraw | bool       | true if withdrawal is possible |
| vaultIds    | uint256\[] | List of withdrawable vault IDs |

### getVaultDeposits

Returns a list of total deposits for all vaults.

```solidity
function getVaultDeposits() external view returns (uint256[] memory)
```

#### Return Values

| Name     | Type       | Description            |
| -------- | ---------- | ---------------------- |
| deposits | uint256\[] | List of vault deposits |

### getVaultRewards

Returns a list of unclaimed rewards for all vaults.

```solidity
function getVaultRewards() external view returns (uint256[] memory)
```

#### Return Values

| Name    | Type       | Description           |
| ------- | ---------- | --------------------- |
| rewards | uint256\[] | List of vault rewards |

### getUnbondingVaults

Returns a list of currently unbonding vaults.

```solidity
function getUnbondingVaults() external view returns (uint256[] memory)
```

#### Return Values

| Name     | Type       | Description              |
| -------- | ---------- | ------------------------ |
| vaultIds | uint256\[] | List of unbonding vaults |

### getWithdrawableVaults

Returns a list of currently withdrawable vaults.

```solidity
function getWithdrawableVaults() public view returns (uint256[] memory)
```

#### Return Values

| Name     | Type       | Description                 |
| -------- | ---------- | --------------------------- |
| vaultIds | uint256\[] | List of withdrawable vaults |

### getInactiveVaults

Returns a list of inactive vaults (validators that have exited).

```solidity
function getInactiveVaults() public view returns (uint256[] memory)
```

#### Return Values

| Name     | Type       | Description             |
| -------- | ---------- | ----------------------- |
| vaultIds | uint256\[] | List of inactive vaults |

### getInactiveWithdrawableVaults

Returns a list of inactive and currently withdrawable vaults.

```solidity
function getInactiveWithdrawableVaults() public view returns (uint256[] memory)
```

#### Return Values

| Name     | Type       | Description                          |
| -------- | ---------- | ------------------------------------ |
| vaultIds | uint256\[] | List of inactive withdrawable vaults |

## Write Functions

### depositQueuedTokens

Deposits queued tokens into vaults.

```solidity
function depositQueuedTokens(uint256[] calldata _vaultIds, uint256[] calldata _amounts) external
```

#### Parameters

| Name       | Type       | Description                  |
| ---------- | ---------- | ---------------------------- |
| \_vaultIds | uint256\[] | List of vault IDs            |
| \_amounts  | uint256\[] | Amounts to deposit per vault |

### unbondVaults

Unbonds vaults if needed.

```solidity
function unbondVaults() external
```

### forceUnbondVaults

Unbonds vaults to rebalance deposits between vaults.

```solidity
function forceUnbondVaults(uint256[] calldata _vaultIds, uint256[] calldata _amounts) external
```

#### Parameters

| Name       | Type       | Description                 |
| ---------- | ---------- | --------------------------- |
| \_vaultIds | uint256\[] | List of vault IDs           |
| \_amounts  | uint256\[] | Amounts to unbond per vault |

### withdrawVaults

Withdraws from vaults and triggers withdrawal pool upkeep if needed.

```solidity
function withdrawVaults(uint256[] calldata _vaultIds) external
```

#### Parameters

| Name       | Type       | Description       |
| ---------- | ---------- | ----------------- |
| \_vaultIds | uint256\[] | List of vault IDs |

### restakeRewards

Restakes vault rewards for given vaults.

```solidity
function restakeRewards(uint256[] calldata _vaultIds, uint256[] calldata _lifetimeRewards, bytes[] calldata _authData) external
```

#### Parameters

| Name              | Type       | Description                            |
| ----------------- | ---------- | -------------------------------------- |
| \_vaultIds        | uint256\[] | List of vault IDs                      |
| \_lifetimeRewards | uint256\[] | Lifetime rewards values for each vault |
| \_authData        | bytes\[]   | Authorization data for each vault      |

### withdrawRewards

Withdraws vault rewards for given vaults.

```solidity
function withdrawRewards(uint256[] calldata _vaultIds, uint256[] calldata _lifetimeRewards, bytes[] calldata _authData) external
```

#### Parameters

| Name              | Type       | Description                            |
| ----------------- | ---------- | -------------------------------------- |
| \_vaultIds        | uint256\[] | List of vault IDs                      |
| \_lifetimeRewards | uint256\[] | Lifetime rewards values for each vault |
| \_authData        | bytes\[]   | Authorization data for each vault      |

### setDepositController

Sets the address authorized to deposit queued tokens.

```solidity
function setDepositController(address _depositController) external
```

#### Parameters

| Name                | Type    | Description                |
| ------------------- | ------- | -------------------------- |
| \_depositController | address | Deposit controller address |

### setMinTimeBetweenUnbonding

Sets the minimum time between unbonding calls.

```solidity
function setMinTimeBetweenUnbonding(uint64 _minTimeBetweenUnbonding) external
```

#### Parameters

| Name                      | Type   | Description                       |
| ------------------------- | ------ | --------------------------------- |
| \_minTimeBetweenUnbonding | uint64 | Minimum seconds between unbonding |


# Deployed Contracts

Find here the relevant smart contract addresses for the contracts and tokens that power the stake.link protocol

## Protocol Contracts

***

### SDL Pool

|  Chain  |      Contract      |                                                        Address                                                        |
| :-----: | :----------------: | :-------------------------------------------------------------------------------------------------------------------: |
| Mainnet |      SDL Pool      | [0x0B2eF910ad0b34bf575Eb09d37fd7DA6c148CA4d](https://etherscan.io/address/0x0B2eF910ad0b34bf575Eb09d37fd7DA6c148CA4d) |
| Mainnet | stLINK Reward Pool | [0x8753C00D1a94D04A01b931830011d882A3F8Cc72](https://etherscan.io/address/0x8753C00D1a94D04A01b931830011d882A3F8Cc72) |

### LINK Staking

|  Chain  |          Contract         |                                                        Address                                                        |
| :-----: | :-----------------------: | :-------------------------------------------------------------------------------------------------------------------: |
| Mainnet |     LINK Priority Pool    | [0xDdC796a66E8b83d0BcCD97dF33A6CcFBA8fd60eA](https://etherscan.io/address/0xDdC796a66E8b83d0BcCD97dF33A6CcFBA8fd60eA) |
| Mainnet |     LINK Staking Pool     | [0xb8b295df2cd735b15BE5Eb419517Aa626fc43cD5](https://etherscan.io/address/0xb8b295df2cd735b15be5eb419517aa626fc43cd5) |
| Mainnet |    LINK Withdrawal Pool   | [0xa60B5146E44ff755e32BD51532842ceB41D0C248](https://etherscan.io/address/0xa60B5146E44ff755e32BD51532842ceB41D0C248) |
| Mainnet | LINK Fund Flow Controller | [0xd2e7381d8d3FcC97C1b4d88761bDBc8Dd26a0200](https://etherscan.io/address/0xd2e7381d8d3FcC97C1b4d88761bDBc8Dd26a0200) |
| Mainnet |   LINK Rebase Controller  | [0x1711e93eec78ba83D38C26f0fF284eB478bdbec4](https://etherscan.io/address/0x1711e93eec78ba83D38C26f0fF284eB478bdbec4) |
| Mainnet |        Operator VCS       | [0x4852e48215A4785eE99B640CACED5378Cc39D2A4](https://etherscan.io/address/0x4852e48215A4785eE99B640CACED5378Cc39D2A4) |
| Mainnet |       Community VCS       | [0xAc12290b097f6893322F5430627e472131fBC1B5](https://etherscan.io/address/0xAc12290b097f6893322F5430627e472131fBC1B5) |
|         |                           |                                                                                                                       |

## Polygon Staking

| Chain    | Contract                      | Address                                                                                                               |
| -------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| Ethereum | POL StakingPool               | [0x2ff4390dB61F282Ef4E6D4612c776b809a541753](https://etherscan.io/address/0x2ff4390dB61F282Ef4E6D4612c776b809a541753) |
| Ethereum | POL PriorityPool              | [0xCfa197495CF8E82D7B5df858F55B73208B8B9d67](https://etherscan.io/address/0xCfa197495CF8E82D7B5df858F55B73208B8B9d67) |
| Ethereum | POL RebaseController          | [0xDa669F2Ea3A54150242965238392D351235b1C1f](https://etherscan.io/address/0xDa669F2Ea3A54150242965238392D351235b1C1f) |
| Ethereum | POL WithdrawalPool            | [0xbfbF47b2a3B9e54A44257bf57d4b078170096458](https://etherscan.io/address/0xbfbF47b2a3B9e54A44257bf57d4b078170096458) |
| Ethereum | POL WrappedSDToken            | [0x2091d83592D79B4De5fD2ce3D98679c32A9555e6](https://etherscan.io/address/0x2091d83592D79B4De5fD2ce3D98679c32A9555e6) |
| Ethereum | POL PolygonStrategy           | [0x7D145AD7860d0A9C7Bb824D5B2f85F575D0300AA](https://etherscan.io/address/0x7D145AD7860d0A9C7Bb824D5B2f85F575D0300AA) |
| Ethereum | POL PolygonFundFlowController | [0x70F7DaBA7F2D0866088ecB1e3b29401a97f65951](https://etherscan.io/address/0x70F7DaBA7F2D0866088ecB1e3b29401a97f65951) |
| Ethereum | POL MEVRewardsPool            | [0xD6Dbdda416C10ae2B7aCBe2d141c0E52b1802C59](/core-staking-contracts/withdrawalpool)                                  |
| Ethereum | stPOL SDLRewardsPool          | [0x77F555A6B9Ec1fBFf5f545128046338a566b5a56](https://etherscan.io/address/0x77F555A6B9Ec1fBFf5f545128046338a566b5a56) |

## Espresso Staking

| Chain    | Contract                       | Address                                                                                                               |
| -------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
| Ethereum | ESP StakingPool                | [0x5273a75694311A6c4F2AcF5C5B8566D965cb6e50](https://etherscan.io/address/0x5273a75694311A6c4F2AcF5C5B8566D965cb6e50) |
| Ethereum | ESP PriorityPool               | [0xdC26867B7d0F599BD2DeF704468a8cF073375FD3](https://etherscan.io/address/0xdC26867B7d0F599BD2DeF704468a8cF073375FD3) |
| Ethereum | ESP RebaseController           | [0x5537F6762c181125De36b3a6884e9726e35DdB90](https://etherscan.io/address/0x5537F6762c181125De36b3a6884e9726e35DdB90) |
| Ethereum | ESP WithdrawalPool             | [0x908B892276fb70fB6FD362FF97D58E7abF6d3690](https://etherscan.io/address/0x908B892276fb70fB6FD362FF97D58E7abF6d3690) |
| Ethereum | ESP WrappedSDToken             | [0x43ff5fFaB0973815EF8672F71c49ee5e53f30a48](https://etherscan.io/address/0x43ff5fFaB0973815EF8672F71c49ee5e53f30a48) |
| Ethereum | ESP EspressoStrategy           | [0xF0fb3Aa0f6a4B84494B78f81103a789e81540344](https://etherscan.io/address/0xF0fb3Aa0f6a4B84494B78f81103a789e81540344) |
| Ethereum | ESP EspressoFundFlowController | [0xF36BDBc45219f9fbAc0741a92a546F95C97104bd](https://etherscan.io/address/0xF36BDBc45219f9fbAc0741a92a546F95C97104bd) |
| Ethereum | stESP SDLRewardsPool           | [0x4A18AEA755bD2Ec7c0b7dD6f065bBB3725490342](https://etherscan.io/address/0x4A18AEA755bD2Ec7c0b7dD6f065bBB3725490342) |

## Token Contracts

***

|     Chain    |  Token  |                                                          Address                                                         |
| :----------: | :-----: | :----------------------------------------------------------------------------------------------------------------------: |
|    Mainnet   |   SDL   |   [0xA95C5ebB86E0dE73B4fB8c47A45B792CFeA28C23](https://etherscan.io/address/0xa95c5ebb86e0de73b4fb8c47a45b792cfea28c23)  |
|    Mainnet   |  reSDL  |   [0x0B2eF910ad0b34bf575Eb09d37fd7DA6c148CA4d](https://etherscan.io/address/0x0B2eF910ad0b34bf575Eb09d37fd7DA6c148CA4d)  |
|    Mainnet   |  stLINK |   [0xb8b295df2cd735b15BE5Eb419517Aa626fc43cD5](https://etherscan.io/address/0xb8b295df2cd735b15be5eb419517aa626fc43cd5)  |
|    Mainnet   | wstLINK |   [0x911D86C72155c33993d594B0Ec7E6206B4C803da](https://etherscan.io/address/0x911D86C72155c33993d594B0Ec7E6206B4C803da)  |
|    Mainnet   |  stPOL  |    [0x2ff4390dB61F282Ef4E6D4612c776b809a541753](https://etherscan.io/token/0x2ff4390db61f282ef4e6d4612c776b809a541753)   |
|    Mainnet   |  wstPOL |    [0x2091d83592D79B4De5fD2ce3D98679c32A9555e6](https://etherscan.io/token/0x2091d83592d79b4de5fd2ce3d98679c32a9555e6)   |
|    Mainnet   |  stESP  |    [0x5273a75694311A6c4F2AcF5C5B8566D965cb6e50](https://etherscan.io/token/0x5273a75694311A6c4F2AcF5C5B8566D965cb6e50)   |
|    Mainnet   |  wstESP |    [0x43ff5fFaB0973815EF8672F71c49ee5e53f30a48](https://etherscan.io/token/0x43ff5fFaB0973815EF8672F71c49ee5e53f30a48)   |
| Arbitrum One |   SDL   |   [0xdFeA35757264F5b6C0ff21104151D9F991D0eEC0](https://arbiscan.io/address/0xdFeA35757264F5b6C0ff21104151D9F991D0eEC0)   |
| Arbitrum One | wstLINK |   [0x3106E2e148525b3DB36795b04691D444c24972fB](https://arbiscan.io/address/0x3106E2e148525b3DB36795b04691D444c24972fB)   |
|     Base     |   SDL   |   [0xe5B64a705db9d2395C471af1608972cCbacE26E6](https://basescan.org/address/0xe5B64a705db9d2395C471af1608972cCbacE26E6)  |
|     Base     | wstLINK |    [0xF2f7901B7bbA5799493B617B06EAd1862F771297](https://basescan.org/token/0xf2f7901b7bba5799493b617b06ead1862f771297)   |
|    Polygon   |  wstPOL |  [0x1d0347C535C88Cf6BB72df75AED34363edB4B2AE](https://polygonscan.com/token/0x1d0347c535c88cf6bb72df75aed34363edb4b2ae)  |
|    Polygon   | wstLINK | [0xc271A17DB5cE6F53745A3F466077Ec816bC20a9C](https://polygonscan.com/address/0xc271a17db5ce6f53745a3f466077ec816bc20a9c) |

## Governance Contracts

***

|  Chain  |          Contract          |                                                        Address                                                        |
| :-----: | :------------------------: | :-------------------------------------------------------------------------------------------------------------------: |
| Mainnet | GnosisSafeProxy (MultiSig) | [0xB351EC0FEaF4B99FdFD36b484d9EC90D0422493D](https://etherscan.io/address/0xB351EC0FEaF4B99FdFD36b484d9EC90D0422493D) |
| Mainnet |     GovernanceTimelock     | [0xb72d8F5213b3E52FAf13Aa074b03C4788e78349F](https://etherscan.io/address/0xb72d8F5213b3E52FAf13Aa074b03C4788e78349F) |

## Integrations

***

|  Chain  |          App         |                                                                             Link                                                                             |
| :-----: | :------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------: |
| Mainnet | Chainlink Automation |                                   [stLINK Rebase](https://etherscan.io/address/0x1711e93eec78ba83D38C26f0fF284eB478bdbec4)                                   |
| Mainnet | Chainlink Automation |                                    [stPOL Rebase](https://etherscan.io/address/0xDa669F2Ea3A54150242965238392D351235b1C1f)                                   |
| Mainnet |      Uniswap V3      | [SDL/LINK](https://app.uniswap.org/swap?inputCurrency=0xa95c5ebb86e0de73b4fb8c47a45b792cfea28c23\&outputCurrency=0x514910771af9ca656af840dff83e8264ecf986ca) |
| Mainnet |         Curve        |                                  [stLINK/LINK](https://www.curve.finance/dex/ethereum/pools/factory-stable-ng-403/deposit/)                                  |
| Polygon |         Curve        |                                     [wstPOL/wPOL](https://www.curve.finance/dex/polygon/pools/factory-stable-ng-237/swap)                                    |


# Financial Statements

In the interest of providing full transparency and a comprehensive financial overview here you will find the official financial statements for the StakedotLink DAO, as prepared by ht.digital.

## Financials to July 2025

{% file src="/files/trjWRSlDTNwTyoWEr8MQ" %}

***

<p align="center"><em>ht.digital is the official accountant of StakedotLink Limited</em></p>

<figure><img src="/files/PkCHDu375ZCFFhtCirHi" alt=""><figcaption></figcaption></figure>

<p align="center"><em>For more information visit</em> <a href="https://ht.digital"><em>ht.digital</em></a></p>


