# Poolside

<figure><img src="https://3919962298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1OyEScoUCIfVRkK0pfQm%2Fuploads%2F6PjnxeFu9yqpCsoPII5S%2FPoolside_Wordmark_Lockup.jpg?alt=media&amp;token=bb0a529b-db0e-48c6-9a07-3d16255979d8" alt=""><figcaption></figcaption></figure>

Poolside is DeFi's liquidity hub for receipt tokens and yield-bearing assets. Built on a next-gen AMM, Poolside optimizes the LP experience for tokens that accrue value, like LSTs and LRTs by recognizing when tokens earn yield and protecting that added value from being arbitraged away. Other AMMs expose LPs to unnecessary losses due to a poor understanding of token and AMM design. Poolside solves fundamental errors that others make and is the only DEX capable of facilitating deep markets for LSTs like Lido's stETH and BENQI's sAVAX.

Poolside also maximizes earning potential with Poolside Party, a non-custodial rewards program that algorithmically distributes incentives. LPs on Poolside can subscribe their LP tokens to multiple rewards programs to earn tokens, on-chain points, NFTs, and more. These LP tokens earn incentives without leaving the user's wallet, remaining freely tradable and useable in greater DeFi. **Poolside LPs earn fees from trades, keep their staking rewards, earn incentives, and can further leverage their LP tokens as collateral in DeFi.**

Poolside is the critical missing piece that enables LSTs and other yield-bearing assets to scale. Long-term liquidity inside Poolside enables protocols to grow without disturbances from withdrawals. This is crucial for liquid staking and lending protocols that rely on committed collateral to meet expected returns. The liquidity in AMMs also facilitates DeFi activities that allow LSTs to be used as collateral in other protocols. Since LPs no longer suffer permanent loss inside our AMM, Poolside is the most cost-efficient place to incentivize liquidity for protocols and DAOs. Poolside's alignment of protocols and LPs fosters deep markets that can support the growth of LSTs, LRTs, and emerging categories like tokenized real-world assets (RWAs) and yield-bearing stablecoins to be the foundation of DeFi.

[**Read the Poolside V1 whitepaper to learn more.**](https://uploads-ssl.webflow.com/64d1f08b78cbfe9cb944f777/64e80e03a9432f9989ba0091_Poolside___A_Simple_AMM_for_Value_Accruing_and_Rebasing_Tokens___V1.pdf) The Poolside V2 whitepaper is coming soon.


# Core Concepts

Poolside is a composable AMM that introduces liquidity segmentation. On Poolside, the liquidity of an asset pair exists in pockets of **active liquidity&#x20;*****(pools)*** and **inactive liquidity&#x20;*****(reservoirs)***. \
\
This segmentation allows yield, such as staking rewards, to accrue inside reservoirs. This protects LPs from unnecessary losses due to arbitrage and maintains an accurate pool price. LPs can later add tokens from reservoirs to the pool under some constraints. This means yield that would have been lost in other AMMs is preserved and becomes productive in Poolside.

## Token & AMM Design

Understanding Poolside requires a basic understanding of both token and AMM design. Although Poolside can trade any token pair, it works best for LSTs, LRTs, and other yield-bearing assets.\
\
Protocols that issue value-accruing tokens must decide how the yield is distributed to token holders. In DeFi, the prevailing token designs for this have been rebase tokens or ones based on [cTokens](https://docs.compound.finance/v2/ctokens/). \
\
While these token designs achieve similar outcomes and work fine for entering and exiting positions through the token issuers, they both suffer inside liquidity positions. This is because AMMs don't have a way of understanding when yield, like staking rewards, is distributed.&#x20;

### Rebase Tokens

LSTs and yield-bearing assets that rebase update supply to map 1:1 with an underlying asset. The usage of rebase tokens in this manner was pioneered by AAVE's [aTokens](https://docs.aave.com/developers/tokens/atoken) and Lido's [stETH](https://blog.lido.fi/steth-the-mechanics-of-steth/). stETH is a receipt token for an amount of the original ETH collateral and the accrued ETH rewards. stETH being a rebase token, when rewards are distributed, the entire supply of stETH changes to match the underlying ETH.

The problem with rebase tokens inside AMMs stems from the volatility in the supply. Since AMMs use the balance of reserves as one of the inputs to determine price, any fluctuation of the token supply will render a new price calculation. So when stETH earns staking rewards, the supply of stETH in a pool goes up, which means that stETH will become cheaper against the other token. This leaves the pool vulnerable to arbitrage. LPs will lose their expected staking rewards and earn less in swap fees as their deployed liquidity has been undervalued.&#x20;

Poolside uses this rebase to our advantage. This helps our AMM understand that value is changing and accrues the staking rewards into reservoirs.

### cTokens

Yield-bearing tokens based on cTokens can be minted or burned according to a floating exchange rate. The majority of LSTs and LRTs use a form of this design. rETH, for example, is also a receipt token for an amount of staked ETH collateral and accrued ETH rewards. When ETH rewards are distributed to rETH holders, the supply of rETH remains constant. However, what changes is the exchange rate, so the amount of ETH that rETH can redeem with the primary issuer becomes larger.

While this token design is more straightforward to integrate, it does introduce some quirks. Because rETH is not pegged to ETH and is continually representative of more staked ETH, it will experience divergences in price over time. These divergences are vulnerable inside liquidity positions, especially inside AMMs for pegged assets.

When staking rewards are distributed to rETH holders, the token becomes intrinsically more valuable, as rETH can claim more ETH than before. This creates value leakage inside AMMs because the price between a pair doesn't change despite the value of rETH increasing. Again, AMMs need help understanding when a token's value has changed outside of the pool. LPs lose their yield to arbitrage as the market price doesn't reflect the value change. Inside AMMs that optimize for pegged assets, less liquidity facilitates more potent trading, but all this means for yield-bearing tokens is that this arbitrage occurs more efficiently.

### Poolside Wrappers

Poolside Wrappers turn fixed-supply assets that accrue value, like LSTs based on cTokens, into wrapped rebase tokens that benefit from Poolside's design. These wrapped rebase tokens track an exchange rate through an oracle or a ratio of queryable balances. This exchange rate is expressed in the token supply, simplifying accounting and allowing reservoirs to work as designed.

Poolside wrappers are used to map receipt tokens to their underlying asset. This allows tokens like cbETH and sAVAX to be understood in ETH and AVAX terms, respectively. For example, sAVAX is wrapped and turned into rsAVAX (Rebasing sAVAX). One rsAVAX has a claim on 1 AVAX. So instead of referring to a smart contract to understand how much claim your balance of sAVAX has on staked AVAX, rsAVAX shows you this information in its balance.

As the underlying assets accrue value, the wrapped rebasing versions of the token update the total supply to reflect the change. These rebase events occur in the reservoirs, unlocking the protection from unnecessary losses that native rebase tokens enjoy inside Poolside.

## Liquidity Pools and LPs

Liquidity pools represent active liquidity. These pools dictate the swap ratio between two unique tokens. Poolside uses liquidity pools to match buyers and sellers. Poolside offers two curves, a [stableswap](/overview/amm/stable-pools) for pegged assets and a [CFMM](/overview/amm/volatile-pools) for volatile assets. \
\
In exchange for providing liquidity, LPs receive minted LP tokens. LP tokens represent a portion of the pool's liquidity and fees generated from swaps. LPs can withdraw liquidity and redeem for the underlying assets anytime.

## Reservoirs

Poolside adds two additional token balances called **reservoirs**, one for each token. The added reservoirs represent inactive liquidity and allow for the following:

* Staking rewards and yield to accrue to LPs instead of being arbitraged away
* Liquidity to avoid unnecessary divergence loss
* Pools to remain accurately priced, maximizing swap fee potential

Most existing AMMs struggle to support rebase tokens because of how pools work. Pools use the token balances of their reserves to determine the price between a pair of assets. This works fine for tokens with static supplies but is detrimental to any productive token.

Tokens that rebase suffer because AMMs mistake the additional supply as less demand. LPs' tokens get discounted, and they lose out on fee potential. Tokens that accrue value also suffer because pools are inductive. Pools with these tokens leak value since the protocol doesn't understand the exchange rate has changed.

The diagram below shows how existing AMMs treat rebasing events:&#x20;

<figure><img src="https://3919962298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1OyEScoUCIfVRkK0pfQm%2Fuploads%2Fyc3T5lflQ46xm1Sd7OnY%2FSwap%20--%205.1%20-%20Page%202%20(1).svg?alt=media&amp;token=e87f9fa8-de7f-4309-ac6a-3880fa311e26" alt=""><figcaption><p>Let prETH represent a positive rebasing token (ex: stETH)</p></figcaption></figure>

### Positive Rebase

In contrast, new tokens from positive rebases on Poolside flow into reservoirs rather than immediately into active liquidity pools:

<figure><img src="https://3919962298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1OyEScoUCIfVRkK0pfQm%2Fuploads%2FNuCO7a1UYEinKwJl5VLp%2FSwap%20--%205.1%20-%20Page%202%20(2).svg?alt=media&amp;token=63af72ec-2364-4c43-9194-34115420734a" alt=""><figcaption><p>Notice how the swap ratio stays consistent (the price of 1 ETH = 1 prETH)</p></figcaption></figure>

As shown in the [User Guide](/guide/liquidity-providers), LPs can balance out pools by depositing the asset with less liquidity. Using the example above, LPs can mint liquidity tokens by depositing ETH. The value from the new deposit (ETH) and the reservoir value (prETH) then automatically flow into the active liquidity pool.

{% hint style="info" %}
No matter the chain of events, there will always be at least one empty reservoir.
{% endhint %}

### Negative Rebase

Negative rebases are handled by letting tokens flow between the liquidity pool and reservoirs to maintain the swap ratio. The flow of tokens is dependent on whether one of the reservoirs is empty or partially filled:

* prETH moves from the reservoir to the active liquidity pool.
* ETH moves from the liquidity pool into a reservoir (if prETH's reservoir is empty).
* Reservoirs can also be used for **non-rebasing**, **yield-bearing tokens** using a Button Wrapper.


# AMM


# Stable Pools

Poolside V2 introduces Stable Pools designed for pegged assets that trade near parity and for highly correlated assets that trade at a known exchange rate. Poolside's implementation of a stableswap is different from that of existing offerings. The invariant curve we designed is specialized and optimized for receipt tokens like LSTs and yield-bearing stablecoins. \
\
The invariant curve is defined as follows:

$$
P = \frac{Y + K \sqrt{P\_{L}}}{X + K \sqrt{P\_{L}}}
$$

Poolside's stable curve is symmetric and aggressive compared to other stableswaps. This enables Poolside to compete with various DEX designs on order flows while protecting our LPs from unnecessary yield loss. Another key difference is that Poolside can calculate a fair price based on the underlying staked balances of LSTs and LRTs using Poolside Wrappers. This means that correlated tokens don't suffer divergence loss inside our Stable Pools as they do in other stableswaps.


# Volatile Pools

Poolside V1 introduced a custom Constant Function Market Maker with an integrated inventory management system. Poolside V2 retains these Volatile Pools, allowing for unique asset pairs that would not otherwise exist on centralized exchanges. Poolside also extends the capabilities of CFMMs, popularized by Uniswap v2, by fully integrating rebase tokens. Natively rebasing tokens like Lido's stETH or Ampleforth's AMPL do not require a wrapper in our protocols.

Volatile Pools use the Constant Product Invariant `(y*x=k)`, where `x` and `y` are the pool’s reserves of the two assets. These pools are perfect for pairs like stETH/USDC or ones including memecoins.


# Party & Points

Points are fully on-chain, non-custodial, and algorithmic.

Poolside Party is a novel rewards program optimized to be fully on-chain, non-custodial, and algorithmic. Liquidity Providers can participate and "[Join the Part](/guide/liquidity-providers/joining-party)[y](/guide/liquidity-providers/joining-party)" by staking their LP tokens in a non-custodial vault. The non-custodial vault can hold several different incentives at once. An example of multi-incentives is the sAVAX/AVAX pool which rewards LPs with Points and $QI tokens, but these vaults can do much more. \
\
Poolside Party is comprised of several permissionless and concurrent rewards programs. Party utilizes universal vaults (a composable NFT standard) to provide an interface for subscribing and unsubscribing tokens to track positions and accrue rewards.

For example, a pool on Poolside could be eligible to earn token incentives, on-chain points, and a fractionalized NFT. Under the hood, three different reward programs have their own parameters. The user deposits the LP tokens for this pool into the universal vault and is automatically subscribed to all whitelisted rewards programs. \
\
In the above example, the user would accrue tokens, on-chain points, and fractionalized NFT shares into the universal vault. Users can also opt-out of specific rewards programs if desired. This gives the user the freedom to claim the incentives they want and the amount they want at their own leisure.

The non-custodial nature of the Party Program allows LP tokens to remain in the user's wallet and makes them freely tradeable while remaining subscribed to rewards programs and earning swap fees. Subscribed LP tokens can be further leveraged in greater DeFi as collateral, making Poolside Party one of the most capital-efficient rewards programs.


# Liquidity Providers

Liquidity providers supply liquidity to a pool for traders to swap against. In return for supplying liquidity, LPs receive swap fees from trades. The liquidity that is provided to a pool is represented by liquidity tokens. These tokens represent a proportional share of the liquidity pool and reservoir(s). The liquidity in a reservoir does not earn fees but can be reintegrated into the liquidity pool by LPs. This reintegration or balancing of a pool is done by adding single-sided liquidity. The protocol places constraints on this process to protect LPs further.

## Adding Liquidity

LPs can add liquidity to an existing pool in two different ways:

1. **Double-Sided:** Depositing liquidity for both assets of the token pair at a proportional rate.
2. **Single-Sided:** Depositing liquidity for the asset with less liquidity, further balancing out the pool.

Let *<mark style="color:blue;">`‘s’`</mark>* represent the number of liquidity tokens, and *<mark style="color:blue;">`‘z’`</mark>* represent the total number of tokens in the pool:

$$
s\_-minted/s\_-starting=z\_-deposited/z\_-starting
$$

{% hint style="info" %}
LPs will always be able to deposit an equivalent amount of <mark style="color:blue;">`Token X`</mark> and <mark style="color:blue;">`Y`</mark>. When one reservoir, i.e. <mark style="color:blue;">`Token X`</mark>, is partially filled, LPs can mint liquidity tokens by depositing <mark style="color:blue;">`Token Y`</mark> to balance the pool. &#x20;
{% endhint %}

## Removing Liquidity

There are two types of redemption:&#x20;

1. LPs can withdraw liquidity and redeem (burn liquidity tokens) for a proportional share of the pool and reservoir
2. LPs can withdraw from a single-asset reservoir up to the total number of tokens in the reservoir.

{% hint style="info" %}
Option #1 will always be available to LPs, resulting in an equivalent withdrawal of <mark style="color:blue;">`Token X`</mark> and <mark style="color:blue;">`Token Y`</mark>. If one reservoir is partially filled, i.e. <mark style="color:blue;">`Token X`</mark>, LPs can redeem liquidity tokens for just <mark style="color:blue;">`Token X`</mark>.&#x20;
{% endhint %}

{% hint style="warning" %}
If you deposit single-asset liquidity, this does not mean you can redeem for a single asset.
{% endhint %}

## Initialization of a Pool

The creation of a pool determines the initial price of an asset pair and its resulting swap ratio. The initializer receives liquidity tokens for creating the pool. A larger amount of liquidity deposited will result in more liquidity tokens for the initializer. Increased liquidity will also lead to less slippage and a more stable pool.


# Wrapping Tokens

{% hint style="info" %}
The Poolside team has implemented a router to manage wrapping and unwrapping tokens automatically. This removes the need for this step and obfuscates this feature from the UI. Users can still navigate to the Wrap page to unwrap their assets.
{% endhint %}

Users will need to wrap specific tokens before interacting with the application. This process turns receipt tokens into rebase tokens. These wrapped tokens can be used in Poolside to provide liquidity or make swaps. To understand our wrappers, please read about them in [Core Concepts](/overview/core-concepts#wrappers). The wrap feature is available in the navigation on supported networks like Avalanche and Base.

### Unwrapping

Users can unwrap the rebasing versions of their tokens and redeem the underlying assets at any time. This can be done using the Wrap feature inside of the application. Alternatively, users can also trade the rebasing version of their tokens for the underlying asset. This method may incur slippage depending on liquidity for the pair.

### Non-Custodial & Audited

Poolside Wrappers are built on Buttonwood contracts. These wrappers are non-custodial, and users can redeem the underlying assets at any time. The smart contracts have been [audited](/resources/security) and are included in an [active bug bounty](https://immunefi.com/bounty/buttonwood/).


# Joining Party

Users must add liquidity to an eligible pool before joining Poolside Party's reward programs. Users can navigate to Poolside Party via the navigation after acquiring LP tokens. First-time users will have a universal vault NFT minted as a part of their first transactions to track subscriptions and accrued rewards. Users with existing universal vault NFT(s) can select the one they want to use through the interface. You can learn more about [Poolside Party](/overview/party-and-points) in our overview section.

## Depositing LP Tokens

Users can navigate to specific party pages to see parameters and expected rewards. Depositing LP tokens to be tracked by your universal vault NFT will automatically subscribe you to all whitelisted rewards programs. New reward programs added after your initial deposit require you to manually subscribe. In this scenario, the interface will give show a button to subscribe to the new rewards program.

:tada: It's that easy! You're now earning incentives!

## Withdrawing LP Tokens

Withdrawing LP tokens from the universal vault NFT is a two-step process. LP tokens must be unsubscribed from all rewards programs. This can be done through the interface by inputting the desired balance and unlocking LP tokens. After LP tokens are unlocked, they can be withdrawn in a separate transaction.

## Claiming Rewards

Claiming of rewards depends on the parameters and the duration of specific reward programs. If incentives are claimable, the interface will show a button to claim incentives. For some programs, this can be done without unsubscribing LP tokens. Poolside's Points Party will not be immediately claimable and will accrue to the universal vault NFT. The latest information on Points will be available on [@Poolside\_Party](https://twitter.com/ButtonDeFi) and in our [Discord](https://discord.gg/MMM7zkVApj).


# Swappers

Swapping one asset for another is seamless and can be done here: <https://app.poolside.party/swap>


# PARTY Token & Tokenomics

:sunglasses: Coming soon...


# Security

Poolside is an AMM protocol built on Buttonwood contracts, namely <mark style="color:blue;">`buttonswap-core`</mark>. Statemind has audited these contracts in full, and CertiK audited the wrapper contracts which will be used for non-rebasing assets.

Below are relevant audit reports to Poolside:

{% file src="/files/LX9JbMz59ZbTWNWFmMm7" %}
Statemind (2023-07-27)
{% endfile %}

{% file src="/files/NBr8hqZpZGAq3p5ak3OJ" %}
Certik (2021-08-04)
{% endfile %}


# Contracts

**Poolside Stableswap:** Coming soon. \
\
**Poolside Volatile AMM:** Below are the ButtonswapFactory contract addresses for each chain:

| Chain            | Swap Factory Address                       |
| ---------------- | ------------------------------------------ |
| Ethereum Mainnet | 0xB8DE4aB6C65e274630F5279f74eB69b66327CE50 |
| Avalanche CChain | 0x19470c5e0199B7157822Ca627860B08750eCe375 |
| Base             | 0x75a92DfB38C3506dcE3Bbb5EB32A10852f9ba64a |
| Arbitrum One     | 0xdb55fdd06134424372eF3458Da3CcC20e3A6Ca16 |
| Optimism         | 0xbd3EfbBb506209a7b4EED55E8C91C3829d79bAbA |


# FAQ

**What are the costs of providing liquidity?**

The costs of providing liquidity can be referred to as divergence loss. Divergence loss refers to the loss LPs incur relative to holding the assets they provide as liquidity. Divergence loss is also known as mark-to-market loss, impermanent loss, or unrealized opportunity cost. It is unavoidable with most asset pairs, but is solvable to an extent for liquid staking and yield-bearing tokens.

**What makes Poolside different?**

Poolside is the only AMM to eliminate the type of loss that liquidity providers incur during rebases and value-accruing events. This makes Poolside optimal for liquid staking tokens like stETH, preventing arbitrage that happens as these assets appreciate relative to ETH.

**How does Poolside eliminate LP losses?**

AMMs have liquidity pools representing the active liquidity that can be traded. Poolside adds reservoirs, which represent inactive liquidity. Typically, after every rebase or value-accruing event, traders can arbitrage value out of the pools. With Poolside, the new tokens or additional value temporarily flow into the reservoirs (inactive liquidity). This allows LPs to retain value in the pool.\
\
**What security measures are taken to ensure the safety of user funds in Poolside contracts?**

Statemind has audited Poolside's core contracts and CertiK has audited the wrapper contracts. The protocol has also undergone extensive peer review with DeFi's brightest minds. Additionally, there is an active $500K bug bounty on Immunefi.\
\
**How does pricing work in Poolside?**

As with many other AMMs, we use the constant product market maker formula <mark style="color:blue;">`y*x=k`</mark> to price assets.&#x20;

**What asset pairs make sense for Poolside?**

Poolside technically supports any asset. However, the value of our design is best realized when one or two of the paired assets are either rebasing or value-accruing.&#x20;

**How can I become a liquidity provider on Poolside? Why should I?**

LPs can deposit one or both assets to their preferred token pair and receive liquidity tokens. The liquidity tokens represent ownership of the pool. Liquidity tokens earn fees based on the volume of the pool. LPs can also be rewarded with incentives.

**How are fees distributed among liquidity providers and to the protocol?**

On Poolside, 100% of the swap fees accrue to liquidity providers. All pools have a default 0.30% swap fee.&#x20;

**What are the risks of providing liquidity?**

The biggest risk for providing liquidity on AMMs is impermanent loss. While this still happens on Poolside based on market demand, Poolside mitigates a type of impermanent loss for rebasing and value-accruing assets. Other risks include price slippage, smart contract risk, and systemic risks.

**What are rebasing assets?**

Rebasing assets are tokens that have balances that change uniformly across all holders. These balance changes are based on predetermined rules or external factors. Rebasing assets present new opportunities for use as a staking position (stETH), elastic commodity (AMPL), or interest-bearing assets (AAVE aTokens). Rebasing assets also present some challenges. One of those challenges is how rebasing events are handled in existing AMMs. As stated in the [Uniswap docs](https://docs.uniswap.org/concepts/protocol/integration-issues), LPs bear the loss for negative rebases. Poolside solves this and neatly integrates rebasing assets.


# Glossary

### Automated Market Maker (AMM):

A type of decentralized exchange protocol that relies on a mathematical formula to price assets. As with many other AMMs, we use the constant product market maker formula <mark style="color:blue;">`y*x=k`</mark> to price assets.&#x20;

### Liquidity Provider (LP)

LPs are users that deposit liquidity into a pair and receive liquidity tokens. LPs help support healthy markets and are compensated with revenue earned from swap fees, and sometimes, incentives from DAOs.

### Liquidity Pools

Pools represent the active liquidity in the pair owned by liquidity providers. Pools dictate the swap ratio, or marginal price, between two assets.&#x20;

### Reservoirs

Reservoirs are a novel concept pioneered by Buttonwood that represents the inactive liquidity in an asset pair. Reservoirs allow Poolside to maintain a consistent swap ratio and protect liquidity providers from an impermanent loss caused by arbitrage.&#x20;

### Liquid Staking Tokens

Tokens that allow users to access the liquidity of their staked assets.&#x20;

### Rebase Tokens

Tokens that have balances that can change uniformly across all holders based on predetermined rules or external factors.&#x20;

### Value Accruing Assets

Tokens that appreciate in value based on an increasing exchange rate (rETH, swETH). &#x20;


