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). 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.

This right to swap at a predetermined price via the swapper should not be confused with the more common type of swap that happens at market price (the one used to enter in the long position in the original example or step 2. in the diagram above). The swap at market price can be executed using any decentralized exchange or aggregator.

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, 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 1000 and the max reserves of ETH when the pool price is below the liquidity range is 1.11. Therefore, the strike price is 1000/1.11 = 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.

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.

Last updated