# Welcome

***

InfinityPools is a decentralized exchange that can offer **unlimited leverage** on **any asset**, with **no liquidations**, **no counterparty risk** & **no oracles**.

In order to mitigate liquidation risk, futures exchanges limit the maximum leverage available, the assets that can be traded and position sizes. Furthermore, traders are also subject to liquidation penalties that [eat into their expected returns](https://infpools.medium.com/introducing-infinitypools-or-how-i-learned-to-stop-worrying-and-love-leverage-9b44fc8367b6).&#x20;

Leverage is often necessary as investing is only worth a person’s time if the return upside is high enough. InfinityPools found a way to get rid of these constraints and make "good" leverage accessible to everyone.

Trade on insight, not capital.


# Core contributors

The core contributors of the InfinityPools protocol are the team members at Lemma Labs. Their former employers include 0x, Goldman Sachs, Bridgewater, Uber, Google, Facebook, Microsoft and they have received degrees from Cambridge University, Princeton, Columbia etc.

Lemma Labs raised a seed round in December 2021 from the following investors:

<figure><img src="/files/KFbY1TywipjCkFBD9R6p" alt=""><figcaption></figcaption></figure>

If you'd also like to contribute reach out to our team on [Discord](http://discord.gg/qKjpMxYBnY).


# Trading

<figure><img src="/files/YGLnVkl2PAEDHsblutPK" alt=""><figcaption></figcaption></figure>

## FAQ

### Will traders have access to 10,000x leverage on all assets?

The short answer is no. The maximum leverage available initially will depend on the volatility of the underlying asset pair and the utilization rate in the market (demand vs. supply). For example, pegged asset pairs (ie. USDC/USDT, stETH/ETH) can have access to those levels of leverage but more volatile pairs (ie. shitcoins) will be limited to \~500x or less.

### If traders can't get liquidated, does that mean they can keep a position open forever?

No, traders can only keep their position open as long as they pay the interest for their leverage.  InfinityPools uses deposited collateral (margin) and/or the trader's unrealized PnL to pay the interest rate.&#x20;

All trades therefore have a base amount of time that they can last, and if a trade is successful then it can be extended indefinitely by using unrealized profits. If a position runs out of collateral and unrealized profits to pay for interest, and it is not closed by the trader, then it will get closed with no liquidation penalties (either via TWAP or market order).

### What are the fees to enter and exit positions?

InfinityPools traders are able to get the best price in the entire spot market when executing their orders.

This is because they can enter and exit their trades using any spot DEX or DEX aggregator. The InfinityPools UI abstracts this away and uses a DEX aggregator (currently 1inch) in its backend to execute orders. For example, if a trader wanted to long ETH, InfinityPools would borrow USDC using its AMM liquidity and then swap that USDC for ETH using a DEX aggregator.

### Will the interest rates always be in line with options premiums?

No, the two may be completely different at times. However, there are a few strategies that traders can execute to bring the two rates closer. For example:

* If the rates on InfinityPools are below options premiums (traders are underpaying for volatility), then traders can create a strangle (going long and short simultaneously on the asset). This strategy buys up cheap volatility and pushes InfinityPools rates up. This strategy will only initially be possible by trading with two separate wallets or by interacting directly with the InfinityPools smart contracts.
* If the rates on InfinityPools are consistently above options premiums, then traders can provide liquidity to the protocol and hedge their exposure with options.

### What is counterparty risk and what are some other risks to be mindful of?

> Counterparty risk is the probability that the other party in an investment, credit, or trading transaction may not fulfill its part of the deal and may default on the contractual obligations.

This risk usually occurs in crypto because of inefficient liquidations, oracle manipulation or because exchanges (like FTX) misappropriate assets. InfinityPools doesn’t have liquidations (positions are mathematically predetermined to settle correctly), is oracle-less and non custodial.

Like with any other protocol, users must always be mindful of smart contract risk and do their own research on the mechanism. All funds could be lost due to an exploit. That said, security is a top priority for InfinityPools, and amongst other measures, the protocol will undergo audits to increase user confidence in the resiliency of the smart contracts.


# Earn

Put USDC in and get InfinityPools + basis trading yield passively: <https://infinitypools.finance/earn>

## Native USD yield (6 month backtest 10/24 - 03/25)

***

Over the backtest period the largest drawdown was 0.3%.

| Utilization | APY   |
| ----------- | ----- |
| 0%          | 11.5% |
| 50%         | 12.1% |
| 67%         | 13.7% |
| 80%         | 19.5% |
| 90%         | 51.1% |

## Unlock schedule

***

After starting the unstaking process, the provided assets and fees generated are unlocked on an exponential schedule (50% after 1 day, 75% after 2 days etc.).

<figure><img src="/files/fYGrfq5tVoEnOHKsWA3o" alt=""><figcaption><p>Withdrawal process after 1 day</p></figcaption></figure>

## How it works

***

Providing liquidity to InfinityPools AMM markets creates squared root exposure to the underlying assets (eg. BTC). We use HyperLiquid to dynamically hedge out this exposure and collect the basis. The rebalancing is triggered every 50 bps move in price and the shorts are \~4x levered for maximal capital efficiency & preservation. There is a 10% protocol fee taken on yield generated.


# Providing liquidity

<figure><img src="/files/WcK2ALF0SJQMnAo0M6vC" alt=""><figcaption></figcaption></figure>

## FAQ

### **Is the yield on InfinityPools going to be higher than spot AMMs?**

While there are many factors to consider (eg. token incentives on specific DEXes), and no guarantees can be made, the short answer is that yes, the InfinityPools LP yields should be higher on average than spot AMMs.&#x20;

This is because liquidity providers' active liquidity generates yield from spot flows going through the InfinityPools AMM and, on top of that, liquidity that is out of range generates yield by being borrowed for leverage.

### **What does it mean for LP yields to be in line with options premiums?**

Liquidity providers generate yield from two different sources: spot trading fees and lending out liquidity. While lending out liquidity on InfinityPools is [very similar to selling covered options](broken://pages/Yj7E3z8yAQeHSSxKuUkU#market-making), providing liquidity to its spot AMM doesn't have as straightforward of an analogy (as with any other spot AMM).&#x20;

However, there are a few strategies that traders can execute to bring the InfinityPools overall yields and options premiums closer together. For example:

* If the rates on InfinityPools are below options premiums (traders are underpaying for volatility), then traders can create a strangle (going long and short simultaneously on the asset). This strategy buys up cheap volatility and pushes InfinityPools rates up.
* If the yields on InfinityPools are consistently above options premiums, then traders can provide liquidity to the protocol and hedge their exposure with options or perpetual futures.

### What is the unlock schedule for liquidity provided?

After closing a liquidity position, the provided assets and fees generated are unlocked on an exponential schedule (50% after 1 day, 75% after 2 days etc.). However, if you are worried about price risk after you close a liquidity position, you will be able to hedge it for a fee.

<figure><img src="/files/fYGrfq5tVoEnOHKsWA3o" alt=""><figcaption><p>Withdrawal process after 1 day</p></figcaption></figure>


# Glossary

## Trading

**Available balance:** The assets deposited in a trader's InfinityPools wallet (vault) that can be used to open a trading position in a given market.

**Hourly funding rate:** The percentage of notional paid every hour by traders to keep their positions open.

**Unwind price:** Price at which the trader’s margin goes to 0, causing the position to unwind when the protection period ends.

**Protection period:** Period during which the trading position cannot be unwound. When finished, starts over if the trading position is on the good side of unwind price (above for longs, below for shorts).

**Grace period**: Period after the protection period ends during which the position notional slowly unwinds (via TWAP) instead of immediately dropping to 0. Only relevant for trades with leverage less than 40x.

**Execution price:** Price at which a trader would enter or exit a trading position.

**Market impact:** The impact a trader's order has on the market's pool price.

## Liquidity provisioning

**Wallet balance:** The assets inside a trader's main wallet that can be used for liquidity provisioning.

**InfinityPools balance:** The assets inside a trader's InfinityPools wallet that can be used for liquidity provisioning.

**Price range:** The range of prices across which a liquidity provider deploys their assets. The deployed assets can be borrowed or used for spot swaps at the given prices.

**Claimed fees:** The fees generated by providing liquidity that have been withdrawn from InfinityPools.

**Unclaimed fees:** The fees generated by providing liquidity that are currently idle in InfinityPools.

**Historical 7D APR:** The total annual percentage yield paid to liquidity providers in the given market & price range over the last seven days.

**Utilization rate:** The percentage of liquidity in the given market & price range that is currently on loan.


# Introduction

## The status quo

Leverage is conventionally achieved through margin trading. The simplest instance being: the trader borrows some cash, with some margin as collateral, to buy more of an asset than could be bought with the margin alone. If the price of the asset rises, selling the asset position leaves the trader with a profit, after repaying the loan.&#x20;

<figure><img src="/files/DUnSntrVhEyVCfyrYg9j" alt=""><figcaption></figcaption></figure>

If the price of the asset falls, the asset position has to be sold (or liquidated) before its loss in value is greater than the margin, otherwise the loan will be in default. The problem is, in case the price does start falling, there is no guarantee the asset position can be sold at a sufficiently high price to cover the loan repayment. This, in turn, constrains exchanges to:

1. Limit the maximum leverage: if the threshold downwards price move is too small, it is infeasible to sell the asset position before the loan gets into default.
2. Limit the assets available for trading: long tail assets usually have much thinner liquidity and as such, even a smaller position can become hard to liquidate.
3. Impose liquidation penalties that eat into expected returns: liquidators are paid a fee that acts both as a margin of error when selling the asset position and as compensation.

<figure><img src="/files/p5Q1nxZqoPAKk3alA0Qh" alt=""><figcaption></figcaption></figure>

Even with these precautions, it is not uncommon for loans to go into default. In traditional finance, the traders are still usually liable for the additional losses (ie. a trader can lose more than what they have deposited on an exchange).

In crypto, perpetual futures offer the same P\&L to traders as margin trading through borrowing, and as such have the same limitations. Loan defaults for perpetual futures create what is commonly referred to as bad debt and the exchange's insurance fund will take the brunt of the losses until it is depleted. For both traditional finance and crypto, more severe cases of loan defaults can lead to socialized losses for all parties involved (eg. Archegos, LTCM...).

## The InfinityPools breakthrough

InfinityPools gets rid of these constraints by securing beforehand the spot liquidity needed to unwind the leverage. Instead of only borrowing cash to go long or the asset to go short, a trader instead borrows concentrated AMM liquidity.

Liquidity in an AMM is made up of two things: an asset that backs the liquidity (eg. USDC for liquidity below the market price and ETH above), and the intention to buy (or sell) an asset at a given price (where the liquidity is deployed). Borrowing liquidity therefore gives the trader the assets required to create a margin trade, but also the right to sell the AMM their entire position at a predetermined price. By "locking in" this right for the duration of the loan, and paying some interest upfront (premium), the trader essentially creates an option; we'll talk more about that in the [next section](/protocol-overview/tradfi-analogy).

Since the trader now can create a margin trade and has the option to sell their entire position at a predetermined price for the duration of the loan, they no longer need to worry about liquidations as it no longer matters how low the price drops. In addition, the trader can decide whether to use this predetermined price given by the borrowed liquidity, or any other decentralized exchange offering a higher price, to swap the asset position for cash to repay the loan. As such, no price oracle is used. With no external dependence on a liquidation bot, nor price oracle, the protocol is entirely autonomous and so permissionless.

## Example

Let’s imagine a trader wants to go long 1 ETH with 10x leverage and InfinityPools has a concentrated liquidity AMM where the current price of ETH is 1000 USDC. On InfinityPools, instead of borrowing USDC directly, a trader looking to go long would borrow concentrated spot liquidity backed by USDC.

For 10x leverage and a margin of 100 USDC, the trader would therefore borrow 900 USDC worth of liquidity centered at the price where they would hypothetically get liquidated with margin trading (same as perpetual futures). This price is 10% below the current price, at 900 USDC.

<figure><img src="/files/xAjxfqvbMKKq9sXwkiXJ" alt=""><figcaption></figcaption></figure>

The trader would then swap their margin and the assets backing the borrowing liquidity using any spot DEX or DEX aggregator of their choice. In this case since the price of ETH is 1000 USDC, and their combined margin and borrowed assets are 1000 USDC, the trader would get back 1 ETH.

<figure><img src="/files/Ab6COe1MWWp9tZbpTQyL" alt=""><figcaption></figcaption></figure>

From the InfinityPools AMM’s point of view, just as with any concentrated liquidity AMM, there are two outcomes:

If the pool price stays above 900 USDC, the liquidity has not been crossed and the AMM therefore expects 900 USDC back. Since the trader has 1 ETH and its price is greater than 900 USDC, they can just sell it and repay the liquidity loan.

<figure><img src="/files/GyQ5h05PIiDOzaFQwAgN" alt=""><figcaption></figcaption></figure>

If the pool price drops below 900 USDC, the liquidity has been crossed and the AMM therefore expects 1 ETH back (900 USDC converted into ETH at the 900 USDC price point). Since the trader already has 1 ETH, they can just use it to directly repay the liquidity loan.

<figure><img src="/files/V30oVvKVN9foSKnxYTKt" alt=""><figcaption></figcaption></figure>

Either way, the AMM is always made whole by the end of the trade and the losses are capped at the margin deposited by the trader. The closer the liquidity borrowed is to the market price, the higher the leverage enabled on InfinityPools. eg. if the trader had instead borrowed liquidity at 999 USDC, this would’ve capped the losses at 0.1% and the margin required a total position size of 1000 USDC would’ve been 1 USDC — which is 1000x leverage.

## Trade payoff function

<figure><img src="/files/v7pmlwfZL7oOGZwl0Iz6" alt=""><figcaption></figcaption></figure>

The chart above shows the payoff functions for the trader and the corresponding liquidity providers, and excludes the interest rates paid. In the case where the price of ETH drops below 900 USDC, the trader’s position remains open and the same payoff function continues to apply as long as the loan isn’t closed out.


# TradFi analogy

InfinityPools’s mechanism can be explained using traditional finance instruments such as options and margin trading. If you are not familiar with those, [feel free to skip this section](/protocol-overview/mechanism-details/swappers).


# Payoff

While InfinityPools traders feel as though they are margin trading with no liquidations, the payoff is that of a synthetic in-the-money (ITM) option. InfinityPools traders create this payoff by initiating a margin trade and buying an out-the-money (OTM) option with a strike at the margin trade’s hypothetical liquidation price. The OTM option's notional and maturity both match the margin trade’s.

Let’s imagine a trader is looking to long ETH/USD on InfinityPools with 10x leverage and the current market price of ETH is 1000 USD:

1. The trader would start by borrowing USD and buying an OTM put option with a strike price of 900 USD since 10x leverage means a hypothetical liquidation price of 10% below market price:

<figure><img src="/files/1F7fQDZBTMdc4lU6TPOP" alt=""><figcaption></figcaption></figure>

2. Swapping the borrowed USD for ETH (using any spot exchange) would then initiate the margin trade and create the desired synthetic ITM call option payoff:

<figure><img src="/files/et0mQcqZguOzULInQrRM" alt=""><figcaption></figcaption></figure>

As you can see, the synthetic ITM call option payoff is very similar to that of a regular margin trade but without liquidations. Terminating the margin trade would convert the payoff function back to the OTM one. This ability to switch back and forth at will between in/out-of-the-money allows traders to lock in profits at any time and immediately realize the value of their position in USD, at any time before loan and option maturity.

Additionally, if InfinityPools doesn't have enough liquidity for an OTM option at the given strike (green line below), it automatically combines OTM options at different strikes (red and grey lines below) to recreate the desired payoff for the lowest available premium.

<figure><img src="/files/8gNMee759rpHlFZc083U" alt=""><figcaption></figcaption></figure>

This new synthetic OTM option (purple line below) also works for the trade above as it has a strictly better payoff than the initial OTM option (green line below).

<figure><img src="/files/2crY1XfA1QGLOJ8J4RlS" alt=""><figcaption></figcaption></figure>


# Maturity profile

InfinityPools’ option and loan maturity are exponential with a half life of one day.&#x20;

<figure><img src="/files/sbOLnleAcYJl6OI7ac3V" alt=""><figcaption></figcaption></figure>

Despite this, traders have constant exposure to ETH/USD. This is achieved by continuously rolling over both the margin trade and the option as they expire.

So, why use an exponential maturity instead of a more conventional one day maturity?

1. Having an exponential maturity means that all options expire on the same schedule, no matter when they were created. This eliminates fragmentation across expiries.
2. It mitigates certain types of attacks known as MEV in crypto (similar to HFT trading strategies such as frontrunning) that would otherwise happen if the margin trading assets had to be swapped over at a predetermined time every day.
3. The math for pricing exponentially maturing margin and option trades works out incredibly well. In our simulations, InfinityPools' equations priced trades more accurately and more efficiently (cheaper computationally) than Black-Scholes.


# Loan & option styles

InfinityPools has three instruments that can all be exercised differently:

1. Fixed term loan - this instrument is similar to a European synthetic option as it cannot be exercised before it matures (that said, same as a European synthetic option, you can still lock in profits at any point).
2. Revolving loan - this instrument most resembles an American synthetic option but is more powerful as traders can get a refund on "unspent" premium. In other words, if a trader pays a premium for an hour long trade but decides to exercise after 30 minutes, they will get back 50% of their paid premium.
3. Periodic loan - this instrument is a combination of the previous two, and is the main InfinityPools trade mechanism. Periodic loans start as fixed term loans and switch over to revolving loans after a preset lock in period.


# Providing liquidity

The counterparties to the trades described above are called liquidity providers. These investors occupy a similar role to market makers in traditional options and spot markets but are more passive.&#x20;

One of the defining characteristics of InfinityPools is the fact that the options mentioned above are created from loans of spot liquidity. In other words, imagine if a trader was able to borrow limit orders on a spot orderbook (InfinityPools uses a concentrated liquidity AMM, which is conceptually similar). By borrowing these limit orders and paying a premium upfront, the trader would then reserve the right to buy or sell an asset at a given price for the duration of the loan. This is what defines an option.

A few particularities of concentrated liquidity AMMs before diving in deeper:&#x20;

* Liquidity providers have something similar to resting spot limit orders at every tick across a given price range.&#x20;
* Each of these spot limit orders is fully collateralized (a limit order to buy 1 ETH at 3000 USD will be backed with 3000 USD).
* These orders are also reversible (if a buy limit order is hit, it pops up as a sell limit order at the same price plus spread - and vice versa).&#x20;

Traders looking to buy OTM options do so by borrowing these limit orders. As a result, liquidity providers are simultaneously providing liquidity to a spot market and selling covered options when required.&#x20;

The interesting implication here is that InfinityPools liquidity providers do not have a lower bound on the length of the maturities of the covered options they are selling, but do have an upper bound (exponential with a half life of a day):

* The first insight is that liquidity providers' have the same payoff when selling very shorted dated covered options as when just providing regular spot liquidity (while getting higher yields in the former scenario). As such, liquidity providers have no need for a lower bound on the maturity of the covered options they sell. This is crucial to enabling higher levels of leverage as those trades require extremely specific maturities that would otherwise be hard to match.
* The second insight being that liquidity providers do not want to be "locked in" for long amounts of time (the exponential maturity in InfinityPools's case).&#x20;


# Premium calculation

Liquidity providers generate yield from two separate sources: the premiums from the covered options they sell and the transactions fees collected from spot trading activity in the InfinityPools AMM. The premium for selling covered options is calculated by multiplying two numbers:

1. The first number is the minimum premium that liquidity providers get paid for selling a covered option. It is the output from a calculation similar to how the Black-Scholes equation is derived. However, as mentioned above, the InfinityPools equation is both [computationally simpler](/protocol-overview/mechanism-details/loan-styles) and more price accurate than Black-Scholes.
2. The second number is called a utilization rate and is the output of a function that responds to supply and demand for leverage in the market. It allows the market to bid up the first number when there is additional demand or if there is an arbitrage opportunity.

Assuming the sum of the premiums (generated by selling covered options) and fees (generated by the spot AMM liquidity) adds up to $50 for a given duration, the payoff for a liquidity provider that deployed assets at 900 USD would look something like this:

<figure><img src="/files/MBljzgwHbAQN9gyVmIgq" alt=""><figcaption></figcaption></figure>

## I


# InfinityPools' advantages

At the core of InfinityPools's mechanism is an automated market maker. This enables capabilities that would otherwise be impossible or very hard to do with traditional options markets. Here are a few benefits that arise from these new capabilities:

* **Permissionless market listing**: any fungible asset that can be traded can have a market created for it instantaneously.
* **Higher leverage**:&#x20;
  1. Creating options out of spot liquidity allows them to be sold on a much more granular level in terms of available strikes (theoretically unlimited). The closer an option strike is to the current market price, the higher the leverage multiple it enables on InfinityPools.
  2. The ability for traders to get a refund on unspent premium makes it possible for them to provide collateral in an incremental fashion rather than all upfront. This, in turn, also enables much higher levels of leverage on InfinityPools than would otherwise be possible.
* **Reduced liquidity fragmentation**:&#x20;
  1. InfinityPools enables the usage of spot liquidity to create options and, as a result, derivatives with any payoff. Since spot liquidity is required for any options market, liquidity no longer needs to be fragmented across two different markets.
  2. Options being sold across a larger number of strikes also means that InfinityPools can more accurately recreate desired payoffs by combining options at different strikes.
  3. InfinityPools's exponential maturity eliminates fragmentation across expiries as all positions have the same maturity profile.


# Why make it decentralized?

Here are some financial reasons we decided to use a blockchain (Ethereum) as the settlement layer for InfinityPools as opposed to a more performant centralized venue:

1. By codifying the InfinityPools mechanism in smart contracts, desired outcomes are enforced. This enables a wide variety of benefits including the ability to be non custodial and eliminating counterparty risk for cryptocurrency native assets or credit risk for tokenized "real world" assets.
2. Blockchains are also fantastic coordination systems that allow exchanges to settle transactions 24/7 in a verifiable way. This means that trades can settle almost instantly rather than in the usual T+2 way and without some of the increased operational costs that are usually associated with it.
3. Finally, blockchains also allow for increased composability of protocols and assets. The InfinityPools benefits listed above make for a strong foundation upon which other teams can build innovative products.


# Mechanism details

Learn more about the details of the InfinityPools protocol.


# Swappers

## Swapper introduction

The fundamental primitive in InfinityPools is the ability to borrow pool liquidity. This gives traders the right to exclusively swap the borrowed tokens backing the liquidity for the other token in the pool at a single predetermined price. eg. if the borrowed assets are in ETH, they can be swapped for USDC at the predetermined price and vice versa. The ability to swap the borrowed tokens at a predetermined price is what guarantees there is no liquidation risk. Once liquidation risk is removed, unlimited amounts of leverage can be offered for any asset.

Leverage can be created from an arbitrary number of wide or narrow liquidity ranges that may or may not be adjacent (ie. does not have to be a narrow range concentrated around a single number like in the [original example](/protocol-overview/introduction)). Liquidity over a range (or sum of ranges) borrowed in one transaction is aggregated into a single primitive called a swapper. The tokens (eg. ETH & USDC) backing the aggregated liquidity ranges for a given swapper, are called its reserves.

## Swapper strike price

Each swapper has a single predetermined price, known as its strike price, at which an unlimited number of token swaps can be performed for free (no slippage or fees) using its underlying reserves. The strike price is at the midpoint for the liquidity used to generate leverage:

`strike price = (max token1 reserves) / (max token0 reserves)`

where token0 and token1 are the pool’s two tokens, and the max reserves occur when the pool price is respectively below or above all borrowed liquidity ranges.

In the [original example](/protocol-overview/introduction), token1 is USDC, token0 is ETH and the liquidity range borrowed is at 900 USDC. The max reserves of USDC when the pool price is above the liquidity ranges are 900 and the max reserves of ETH when the pool price is below the liquidity range is 1. Therefore, the strike price is 900/1 = 900.

The formula to calculate leverage from the strike price is:

`leverage ≈ market price / (market price - strike price)`

## Swapper reserves

A liquidity range is minted with reserves whose amounts vary along a predefined curve as swaps move the pool price within the liquidity’s range. When creating a swapper from a range (or sum of ranges), it has exactly the amount of reserves needed to recreate the originating liquidity ranges. While the swapper is lent out, it remains constrained at all times to have reserves which are sufficient to recreate the originating liquidity ranges.&#x20;

As a result, liquidity providers on InfinityPools incur no risk in lending liquidity ranges. There is no credit risk fundamentally because borrowers just gain the ability to use the liquidity, while the reserves backing it remain secured.


# Float pool

The liquidity which is offered on loan comes from a conventional concentrated liquidity pool (similar to Uniswap v3). This liquidity pool is internal to the InfinityPools protocol and called a float pool. When liquidity is not on loan, it remains in the float pool and is available for performing spot swaps.

From the perspective of users executing spot swaps, the float pool functions identically to a conventional liquidity pool. The float pool has the ability to achieve lower fee levels, while simultaneously offering higher LP yield than a standalone liquidity pool, due to the additional yield and volume coming from lending liquidity.

From the perspective of liquidity providers, the lending of swapper is a source of yield additional to providing liquidity in the float pool. These sources of yield are complementary as the float pool generates yield using only liquidity ranges through which the pool price is passing, while the liquidity ranges lent out can (and typically will be) for ranges some distance from the current price.&#x20;

| Feature                               | Float pool             | Swapper                    |
| ------------------------------------- | ---------------------- | -------------------------- |
| Who can use it to swap tokens?        | Anyone                 | Only the borrower          |
| At what price will tokens be swapped? | Pool price (+slippage) | Strike price (no slippage) |
| Where does the LP yield come from?    | Swap fees              | Interest (no swap fee)     |

Liquidity providers are therefore no longer required to hold both assets in a pool to earn yield. In fact, InfinityPools liquidity providers can even choose to systematically move their range away from the current price, aiming to only hold their preferred asset at all times. This continues to generate yield, and is similar to issuing a covered call or put option, with the added benefit of not suffering from the liquidity fragmentation across expiry dates of the options market.


# Loan maturity

## Exponential maturity

Loans of liquidity ranges (swappers) on InfinityPools mature on a continuous basis, with the same proportion of the position maturing in each instant. The amount of loan outstanding is therefore an exponential function of time. If a trader borrows 1 USDC for example, once some time t has elapsed since borrowing, the USDC still on loan will be $$2^{-t}$$ with t measured in days, which is the exponential $$e^{-λt}$$with $$λ=ln(2)$$.&#x20;

<figure><img src="/files/QnIaylplbkqEq9iKxem1" alt=""><figcaption></figcaption></figure>

## Replenishing process

InfinityPools traders have the option, and not the obligation, to replenish the holdings that have decayed at a new, current, interest rate. This replenishing process is how a trader's position size can stay constant.

<figure><img src="/files/SB5OFJzaMnIil9Cd6bpN" alt=""><figcaption><p>Replenishing process</p></figcaption></figure>

In the [original example](/protocol-overview/introduction), the trader borrows liquidity backed by 900 USDC (loan notional), redeems it and converts their borrowed assets (900 USDC) and margin (100 USDC) to get 1 ETH of long exposure (trade notional). In practice, on InfinityPools, a trader looking to go long 1 ETH would instead borrow a bit more (\~9% for InfinityPools v1, so about 980 USDC) and convert 1000 USDC to 1 ETH (out of a total of 1080 USDC).&#x20;

As the loan matures, the position will continuously swap (TWAP) the extra 80 USDC to ETH to keep the exposure constant. Then, when the loan notional gets closer to 900 USDC, the trader would "replenish" by borrowing new USDC. That way, despite the loan notional expiring, they can keep their exposure to ETH constant and replenish before the loan notional drops below the trade notional.

<figure><img src="/files/dFQIhK7lEVU8anTqVNy7" alt=""><figcaption><p>Loan vs trade notional</p></figcaption></figure>

As the loan matures, if the price hasn't moved, the trader gets back their margin but not the interest paid. To replenish their position the trader must therefore use their unlocked margin to borrow more and use a part of it to pay a new interest rate. With each replenishment, the interest rate payment eats into the margin while the position notional stays constant, thereby increasing the leverage.&#x20;

This happens repeatedly, until there is not enough margin left to pay the interest rate, at which point, the loan stops replenishing and the trade starts unwinding. Of course, if the price moves against the trader, their margin would decrease, accelerating the unwind process. Similarly, it the price moves in favor of the trader, the unrealized gains can be used to lengthen the replenishing process. The price at which the margin goes to 0, thereby stopping the replenishment is called the unwind price.  &#x20;

## Parallels with perpetual futures' maturity

This replenishing of the trader position is in fact, implicitly, how perpetual futures maintain a constant position over time. If the future did settle, this would leave a long position holder with the futures’ underlying asset.&#x20;

To recover their position, the long holder would have to sell the asset, at spot price, and buy more future, at its mark price. The difference of mark price minus spot price is exactly proportional to the funding rate which long perpetual positions pay continuously. Therefore the funding rate corresponds to the continuous settlement and forced replenishing of the position, which net out to keep the position constant over time.

In order for traders to make bets on the direction of spot price moves, perpetuals’ implicit settlement at spot is required. The forced replenishing of perpetual positions is problematic however, as it makes the P\&L of perpetual trades dependent on the perpetual market itself, unlike a proper derivative. This is the cause of dysfunction observed in perpetual markets, most crucially perpetual P\&L failing to track the spot market (not even tracking the “same” perpetual on other venues in fact), due to often double digit, and sometimes triple digit funding rate APRs.

InfinityPools solves these problems by making replenishing of the trader position entirely optional. Traders can set an interest rate tolerance that allows them to continuously exit their position while the interest rate is above their indicated threshold, and replenishes the position notional when it is below.&#x20;

For example, if a borrower doesn’t want to pay more than 10% APR on their loan, they can select 10% as the threshold interest rate tolerance. The loan will automatically unwind exponentially when the APR goes above 10% and will grow its notional back to the original level when the APR goes below 10%.

<br>


# Loan styles

The loan of swappers can be done with different term structures to enable different trader behaviors on InfinityPools. The main loan style is called a periodic loan. It is a combination of two other loan types: fixed term loans and revolving loans.


# Fixed term loan

## Term structure

The first loan type, called a fixed term loan, is used for lower levels of leverage (\~1-40x on high market cap assets). The full interest needs to be paid upfront by the borrower, is non refundable and as such, is cheaper for borrowers.

The protocol will disburse the interest paid to the liquidity range lenders according to the [maturity schedule](/protocol-overview/mechanism-details/loan-maturity). While the loan has a predetermined duration, borrowers can take profit on their trade at any point by swapping the borrowed assets back to their original token (eg. swapping ETH back to USDC in the [original example](/protocol-overview/introduction)).

## Interest rate

Supposing that the pool price follows a geometric Brownian motion with no drift (ie. which is a martingale), then the fair value interest rate on a fixed term loan can be computed as:

$$\frac{\lambda}{2qm^{q-\frac{1}{2}}-1}$$ where $$q = \sqrt{\frac{1}{4} + \frac{2\lambda}{v}}$$

per day (times 100 in percentage terms).

* m is the ‘absolute’ moneyness (the distance between the pool price and the strike price), which is the maximum of $$\frac{k}{p}$$and $$\frac{p}{k}$$where p is the pool price and k is the [strike price](/protocol-overview/mechanism-details/swappers#swapper-strike-price)
* ν is the daily variance of the price, ie. quadratic variation of the logarithm of price over one day
* λ=ln(2) as previously defined

<br>


# Revolving loan

## Term structure

The second loan type, called a revolving loan, is used for higher levels of leverage (\~40-1000x or more on high market cap assets). It is more expensive for borrowers as it offers them more optionality.

The revolving loan matures according to the [same schedule](/protocol-overview/mechanism-details/loan-maturity) as the fixed term loan. However, unlike fixed term loans, a revolving loan can be closed out anytime, in which case it effectively matures immediately. By closing out the loan, the borrower returns the liquidity range to the pool (so that the liquidity ranges are available again to lend or provide liquidity), and no longer owes further interest payments.

Revolving loan’s interest is not paid upfront, instead borrowers can post collateral incrementally to cover future interest payments. In the case the borrower closes out their loan, they will get back any unspent collateral. For example, if a borrower posts enough collateral for a 1 hour loan, but closes out their position after 30 minutes, they will get back \~50% of their collateral. This is what makes it possible to achieve higher ratios of amount borrowed to capital provided (ie. higher leverage ratios).&#x20;

In other words, the high levels of leverage generated by revolving loans come from the multiplication of two factors. The first factor comes from using the typical leverage mechanism used for fixed term loans (\~1-40x leverage). The second factor comes from the ability to pay interest incrementally.&#x20;

Using the exponential maturity function we can determine what fraction of the interest is due over a given time period. For example, the interest due for 15 minutes of the loan is 1/139 of the total due. If you then multiply the maximum leverage available normally (40x) by the amount of interest you need to provide for 15m of that loan instead of the full duration (139), you get access to extremely high leverage (5560x).&#x20;

Borrowers can pay the interest by depositing one of the two pool tokens (or a mix of both) and choosing a deadline from under 12 minutes to over 1 day. Beyond a 1 day deadline most of the total interest is already required (as the loan has a half-life of one day). Borrowers can either extend the deadline for their loan by depositing additional tokens, or the loan will be closed out automatically after the deadline is passed.

## Interest rate

Supposing again that the pool price follows a geometric Brownian motion with no drift, then the fair value interest rate on a revolving loan on a per day basis (times 100 in percentage terms) can be computed as:

$$\frac{\lambda}{(q+\frac{1}{2})m^{q-\frac{1}{2}}-(q-\frac{1}{2})m^{-q-\frac{1}{2}}-1}$$ where q, m are defined as previously.

<br>


# Periodic loan

A periodic loan is the main loan type used by InfinityPools. It is a combination of the two previous types of loan (fixed term and revolving). Periodic loans start off as fixed term loans and switch to revolving loans after a predetermined "lock in" period. In the implementation of the protocol, a periodic loan with a lock in of 0 is a revolving loan and one of infinity is a fixed term loan.

<figure><img src="/files/X2S7YS5sgkk2tLRyqLWK" alt=""><figcaption></figcaption></figure>


# Utilization rate

## Borrow rate

The effective interest rate for borrowing liquidity on InfinityPools consists of two components. The first is the fair value interest rate mentioned in the [previous section](/protocol-overview/mechanism-details/loan-styles). This fair value rate has the same expected returns for each loan type when adjusting for term structure and optionality. It is also equal to the expected returns for providing liquidity in the float pool.

As a result, it doesn't make sense for liquidity providers to lend out their assets below the fair value  rate as their expected returns would otherwise be inferior to those offered by the underlying float pool. The fair value rate is therefore considered the "floor rate" for borrowing assets.

The second component is a utilization rate that, for each liquidity bucket (also known as bin), responds to demand through a scaling factor. This scaling factor, noted s(u), is a function of the utilization ratio u for the given bucket, ie. u is the proportion of liquidity on loan vs. the total supply for a given bucket.

$$borrow\ rate\ for\ a\ given\ bucket = scaling\ factor\ s(u) × the\ floor\ rate$$

## Lend yield

As we saw above, the borrow rate is s(u) times the floor rate and u is the proportion of liquidity that is lent out. 1-u is the liquidity that is not lent out and it earns the floor rate, in expectation. Therefore the effective yield for the lender is then u × s(u) × floor rate + (1-u) × floor rate, which simplifies to:

$$lend\ yield\ for\ a\ given\ bucket = (u×s(u)+1-u) × the\ floor\ rate$$

## Optimal scaling factor

For a given bucket, suppose there exists a market interest rate r\* for which there is very high borrow demand (greater than the total supply) at rates below r\*, and negligible demand at rates above. The maximum interest which liquidity providers could earn is therefore r\* (assuming that r\* is above the floor rate), which would occur with the full supply lent out at rate r\*, therefore making the utilization ratio equal to 1.&#x20;

InfinityPools quotes rates for borrowing swappers on LPs' behalf. Ideally for LPs, the rate would be the highest which the borrowers will accept, ie. r\*. This is not possible however because the contract cannot infer r\* except by seeing its offers lifted (at which point some liquidity has already been lent below r\*). The best that LPs can hope for then is for the scaling factor to minimize this forgone interest, whereby the effective rate is always close to the optimal rate r\*.

A scaling factor s(u) is needed such that the effective rate is as close as possible to the market rate r\* (so that liquidity providers get as close as possible to the maximum theoretical yield r\*) and such that s(u) has reasonable growth as u increases (so that the effective rate is stable relative to changes in u).

The scaling factor s(u) used is $$\frac{1}{9}(\frac{1}{(1-u)^2}+8)$$.&#x20;

<figure><img src="/files/S78xQqppSAKTL7ZDfuM4" alt=""><figcaption></figcaption></figure>

The scaling factor has the property of having liquidity providers earn an effective rate at least 84% of the maximum achievable rate (ie. r\*), irrespective of the value of r\*. How close the effective interest rate gets to the maximum interest rate r\*, over a range of market rates r\*, is shown in the plot below (note the effective rate only gets closer to the maximum rate for any higher values of r\* not shown).

<figure><img src="/files/EYIAz21QpYtZYgPeuXQu" alt=""><figcaption></figcaption></figure>


# Rate Router

InfinityPools traders that interact with the team provided website or API will have access to an off-chain component called the rate router that sources liquidity for trades in a “peer to pool” manner. This router eliminates almost all liquidity fragmentation, gives traders the best available interest rates for their trades and [replenishes their position](/protocol-overview/mechanism-details/loan-maturity#replenishing-process).

The rate router makes liquidity fragmentation a non issue thanks to the following protocol features:

1. Liquidity ranges that enable higher levels of leverage (eg. 1000x) can also be used for all levels of leverage below it (1-999x leverage).
2. Traders can combine separate liquidity ranges to create a given leverage multiple. For example, if the market price of ETH is 1000 USDC and a trader is looking to go 10x long, they can borrow liquidity centered at 900 USDC or they can borrow liquidity centered at 850 USDC and some centered at 950 USDC in the right proportions.

All of this is abstracted away when using the rate router. When a trader places an order with a given leverage multiple, it searches and combines different liquidity ranges on the trader’s behalf to give them the best interest rates possible. You can think of it a bit like Uniswap’s price router but for InfinityPools interest rates.


# New use cases

## Infinite structured products

Liquidity providers on InfinityPools can structure their liquidity positions in such a way that their payoffs match those of more traditional structured products such as covered calls or cash secured puts. The advantages of providing capital to an InfinityPools structured product rather than one constructed via traditional options are:&#x20;

* **Any asset**: They are available for all assets, including those with no existing perp, options or spot markets.
* **Any payoff**: Permissionless and flexible payoff structures with the option to withdraw capital exponentially at any time.
* **No fees**: No fee is paid to market makers for rolling over positions.

## More powerful flash loans

Flash loans currently offer a leverage ratio of 1111x (corresponding to a one time interest payment of 0.09%) but only last a single transaction (essentially for zero time). Swappers are more powerful for two reasons:

* **More time**: a swapper can offer 1000x leverage over multiple blocks instead of a single transaction.
* **Returned tokens**: A swapper’s reserve tokens returned can be any mixture of the pool’s two tokens, so long as they are interchanged in the proportion given by the strike price.

## Multi-block arbitrage

With InfinityPools, arbitrageurs are able to borrow large amounts of assets for multiple blocks. This means they can execute arbitrages between DEXs with two legs separated in time (as is typically the case in off-chain arbitraging across exchanges), rather than being limited to buying and selling simultaneously in a single transaction with a flash loan.\
\
Such leveraged market making across DEXs outside the confines of a single block is also advantageous as these trades are much harder for miners to steal for themselves (significantly reduces MEV). Here is an example breakdown:

1. Take out loan of ETH, for a strike close to the market price
2. Swap ETH for USDC on DEX A
3. Later: Swap USDC for ETH of DEX B (can even have DEX A = DEX B at a better price than in previous step)
4. Return the loan


# Security

## Deployed contracts on Base

* **InfinityPoolsFactory**: [0x86342D7bBe93cB640A6c57d4781f04d93a695f08](https://basescan.org/address/0x86342D7bBe93cB640A6c57d4781f04d93a695f08#code)
* **InfinityPoolsPeripheryProxy**: [0xF8FAD01B2902fF57460552C920233682c7c011a7](https://basescan.org/address/0xF8FAD01B2902fF57460552C920233682c7c011a7#code)
* **InfinityPoolsQuoter**: [0xC9d8a51bE17b79EB8FD22F87F6851c243855663C](https://basescan.org/address/0xC9d8a51bE17b79EB8FD22F87F6851c243855663C#code)
* **InfinityPoolsSwapForwarder**: [0x99a9C21053AcccF6961f7f12cFF0D9D155d4ebE7](https://basescan.org/address/0x99a9C21053AcccF6961f7f12cFF0D9D155d4ebE7#code)
* **UniswapV2SwapForwarder**: [0xdc9be7d212536e8E23B0074678D0625499e61021](https://basescan.org/address/0xdc9be7d212536e8E23B0074678D0625499e61021#code)
* **GeneralSwapForwarder**: [0x567a06C6E4F77fCC64CF53183E0328a7f84A4354](https://basescan.org/address/0x567a06C6E4F77fCC64CF53183E0328a7f84A4354#code)

## Audits

1. **ABDK Audit**: [Link](https://github.com/abdk-consulting/audits/blob/main/lemmalabs/ABDK_LemmaLabs_InfinityPools_v_2_0.pdf)
2. **Cantina Audit Competition**: [Link](https://drive.google.com/file/d/1VsHVjXFc5YnFLWOi_iOUi9Tvr4i3B09m/view?usp=sharing)

## Bug Bounty

A fully-fledged bug bounty program is coming soon. Till then, please report any critical bugs you find here: <security@infinitypools.finance>


# Terms of Service

InfinityPools is a decentralized exchange protocol that enables the borrowing and swapping of spot assets. There is currently only a single version of the InfinityPools Protocol; it is made of free, public, open-source or source-available software including a set of smart contracts that are deployed on the Ethereum blockchain. Use of the InfinityPools Protocol involves various risks, including, but not limited to, the total loss of assets due to a smart contract exploit. Before using the InfinityPools Protocol, users should review all relevant documentation to make sure they understand how the InfinityPools Protocol works. Users are responsible for doing their own diligence and understanding the fees and risks of the protocol.

INFINITYPOOLS PROTOCOL IS PROVIDED ”AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. The Lemma Labs team developed much of the initial code for the InfinityPools protocol, it does not provide, own, or control the InfinityPools protocol, which is run by smart contracts deployed on the Ethereum blockchain. Upgrades and modifications to the protocol will increasingly be managed in a community-driven way. In using the InfinityPools Protocol, you agree that no developer or entity involved in creating the InfinityPools protocol will be liable for any claims or damages whatsoever associated with use, inability to use, or interaction with other users of the InfinityPools protocol, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.


