Introduction
Last updated
Last updated
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.
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:
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.
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.
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.
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...).
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.
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.
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.
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.
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.
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.
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.
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.