decentralized finance education

Perpetual Protocol – Next Level In Decentralized Trading

So what is Perpetual Protocol all about? What are some of the improvements that come with the recently launched version 2 of the protocol? How does it make use of Uniswap V3? And what are perpetual futures in the first place? You’ll find answers to these questions in this article. 

Intro 

Perpetual Protocol is a DeFi project with the main goal of creating the best, most accessible and most secure decentralized exchange for perpetual futures. 

Perpetual Protocol was founded in 2019 by a small team of startup founders and software engineers. Initially called “Strike”, the project pivoted to perpetual futures and changed its name in the summer of 2020. 

The first version of the protocol was launched on the xDai network in December 2020. Version 2 of the protocol named Curie after the famous scientist and a Noble Prize winner – Marie Curie, launched on Optimism on the 31st of November 2021.   

The design of Perpetual Protocol that we’re going to explain later is extremely interesting as it leverages the DeFi “money legos” ethos to both build upon other already existing DeFi projects as well as provide building blocks for other protocols in the future. 

Perpetual Protocol is one of the projects that focus on derivatives in DeFi. If you need a recap on what derivatives are and an overview of other protocols in this space I highly recommend reading my other article first. 

Before we dive deeper into the design of Perpetual, let’s fully understand the main derivative product that the protocol offers to trade – perpetual futures. 

Perpetual Futures 

Perpetual futures are one of the most popular trading products in the cryptocurrency space. Initially offered by well-known centralized platforms such as Bitmex, Binance or Bybit they are now also making their way into DeFi. 

Similarly to other derivatives, perpetual futures allow for gaining exposure to a price of a particular financial instrument without holding the underlying asset. This can be useful for multiple purposes including price speculation, hedging or arbitrage. 

In contrast to standard future contracts, perpetual futures don’t expire and they don’t have the settlement date, hence they can be held and traded for an indefinite amount of time.

Not having the settlement date can be quite beneficial for traders as they don’t have to deal with multiple contracts with different settlement dates. In standard futures, the settlement date is quite important as it allows the price of future contracts to converge with the actual price of their underlying asset as the settlement date approaches. 

To make sure the price of perpetual contracts doesn’t diverge too much from the price of their underlying assets, perpetual contracts use a funding rate. The funding rate is paid periodically and provides incentives to one side of the market – either market participants with open long positions (longs) or open short positions (shorts).

In general, when the price of the perpetual contract is trading above the price of its underlying asset, the funding rate becomes positive and longs pay shorts. The opposite holds when the price of the perpetual contract is below the spot price. In this case, shorts pay longs. 

This allows the price of the perpetual contract for a specific asset to converge with the price of its underlying. On top of the funding rate, price speculators and arbitrageurs also help with making sure the prices between different derivatives or spot exchanges don’t diverge too much. 

Perpetual futures also provide an easy way for shorting a particular asset where market participants can benefit from the price of that asset decreasing over time.

They also facilitate easy access to leverage which allows for controlling a bigger position than it would’ve been otherwise possible using the same amount of capital. This can be useful in certain scenarios but it can also be quite dangerous as undercollateralized positions can be liquidated when the market moves against the trader’s position. 

In general, derivatives markets help with the price discovery of different assets as they provide a place where all market participants can meet and easily trade, usually in big sizes. For certain financial instruments, derivatives markets can even become their primary markets for price discovery. 

I hope this gives a good basic overview of what perpetual contracts are. Time to dive into a protocol that provides easy access to these financial products – Perpetual Protocol.

Perpetual Protocol 

Perpetual Protocol allows for trading different perpetual contracts of the most popular cryptocurrencies like Bitcoin or Ethereum with multiple other coins that will be added to the protocol in the future. 

In contrast to centralized exchanges offering similar products, Perpetual Protocol doesn’t hold custody over users’ funds, so users are always in full control of their assets. On top of this, it allows its users to trade in a permissionless and fully transparent manner. 

At the moment, Perpetual makes use of the USDC stablecoin as its primary collateral. This can be expanded into other types of collateral in the future. 

Having USDC used across the platform also means that all trades are settled in USDC. This means that if a user speculates on the price of Ether and, let’s say, doubles their money they’ll end up with more USDC in their account after closing their position.

The V1 of the protocol was initially deployed on Ethereum Layer 1, but after experiencing problems with slow execution and high transaction fees, the protocol was released on xDai at the end of 2020. 

V2 

V2 iterated on the initial design and introduced a new model for managing positions and executing trades that makes use of Uniswap V3 and its concentrated liquidity. 

And, by the way, if you need a recap on how Uniswap V3 works you can check my other article here. 

At the centre of the Perpetual Protocol design lies the clearinghouse smart contract. Clearinghouse is responsible for minting and burning virtual tokens called v-tokens that are held by the contract on behalf of the user. 

When a user deposits USDC to the exchange, the clearinghouse contract mints v-tokens using the max available leverage. This doesn’t mean the user has to use the maximum leverage when opening a position and it only gives the users the opportunity to do so by issuing the maximum number of tokens that the user may or may not use.

As an example, if the user decides to deposit 1000 USDC, the protocol would issue 10,000 v-tokens, in this case, vUSD. 

To create a particular position, the user can select the product they want to trade and use v-tokens to enter the position. 

For example, if the user wants to go long on BTC, they can instruct the clearninghouse to trade their vUSD tokens for v-BTC. In this case, the protocol would use a Uniswap V3 vUSD-vBTC pool.

As mentioned earlier, depending on the leverage ratio that the user selects, they can be using either some or all of their vUSD tokens. 

Whenever the user decides to close their BTC position they can trade their vBTC tokens back to vUSD, securing their profit or loss depending on what happened to the Bitcoin price since they opened the position. 

On top of being used by the traders, the clearinghouse contract is used by makers. 

In Perpetual, makers are market participants that provide liquidity to the perpetual futures exchange. By doing so, makers make money by accruing trading fees whenever someone trades against the pool where they provide liquidity. Makers can also use leverage when providing liquidity. 

Due to the Uniswap V3 design, providing liquidity is a bit more tricky than on other AMMs. In particular, makers have to decide in which price range they want to provide liquidity. They also only accrue fees from trades that go through the range where their liquidity is present. 

Makers, similarly to traders, can use USDC to interact with the perpetual futures exchange. When makers decide to provide liquidity in certain assets they deposit USDC to the clearinghouse contract that in turn mints vTokens and automatically adds liquidity to the selected Uniswap V3 pool. 

As an example, if a maker decides to provide liquidity in the BTC-USDC market, their USDC is used to mint a correct ratio of vUSD and vBTC that are in turn added to the vUSD-vBTC Uniswap V3 pool. 

As makers are exposed to the price of the underlying tokens in a liquidity pool they can be impacted by impermanent loss, hence they have to be careful with the ranges they provide liquidity in and in general they should have sustainable strategies for providing liquidity. 

To make providing liquidity on Uniswap V3 easier, Perpetual works with protocols such as Popsicle Finance, Visor and others.

What is interesting is that Perpetual Protocol builds on top of Uniswap V3, leveraging the previously mentioned “money legos” ethos in a completely permissionless way. 

When it comes to the margin model, Perpetual Protocol uses cross margin, which means that the user’s funds are kept in one pool and all of their positions use this pool as collateral. 

This makes managing collateral easier since the user doesn’t need to add or remove margin for each position, but has to be used with caution as in this mode one position can affect other positions. If the user has several highly leveraged positions, one position that goes against the user can cause others to be at risk and face possible liquidations.

The users also have a way of using isolated margin mode by creating separate wallets for each of their positions. 

Layer 2

The V2 of the protocol has just recently launched on Optimism – an optimistic rollup Ethereum Layer 2 scaling solution. 

Launching on rollups allows Perpetual Protocol to scale and achieve both low transaction fees and high transaction throughput. This is extremely important for running a successful perpetual futures exchange. The benefits of rollups should be more and more obvious with time as the existing solutions mature and become cheaper and cheaper.  

V1 will remain on xDai. V2 can also launch on xDai if Uniswap v3 also launches there.

Perpetual is also planning on launching on Arbitrum in the near future. 

If you’d like to learn more about rollups you can check out my article about this topic here. Rollups and other L2 solutions will benefit a lot of DeFi protocols including Perpetual. 

V2 of Perpetual is not only limited to the initial launch. In fact, during the full V2 rollout, the protocol is planning on bringing additional features. Some of them include limit and stop orders, staking, multi-collateral, liquidity mining and even permissionless market creation. 

When it comes to the latter, anyone will be able to create a perpetual market for any assets as long as there is a price feed for them via either Uniswap v3 TWAP or Chainlink oracles – both of them supported in V2.

Also, in future updates, the protocol will no longer be limited to crypto and it will expand to markets such as forex, commodities and stocks.

Summary

Perpetual Protocol is clearly one of the most interesting protocols focusing on derivatives in DeFi. 

It looks like the team learned a few important lessons from the first version of the protocol and came up with a new, improved design that should make the perpetual futures exchange more sustainable and more appealing to both the traders and liquidity providers.

Perpetual Protocol is a great example of a project that massively benefits from launching on an Ethereum Layer 2 solution such as Optimism or Arbitrum.

It shows that there will be a set of protocols that are better off launching directly on Layer 2 without even deploying on Layer 1. It will be amazing to see other protocols following this approach and trying new designs that couldn’t previously work due to the limitations of Layer 1 Ethereum. 

It will also be interesting to see Perpetual Protocol gaining traction and convincing more and more people to use trading products outside of the well-known centralized exchanges. 

If you’d like to try Perpetual Protocol you can check out my link here

And always remember to make sure you fully understand how a trading product you’re interacting with works before using it and remember to always trade with funds that you’re willing to lose. 

So what do you think about Perpetual Protocol? What are some of your favourite DeFi protocols in derivatives category? 

If you enjoyed reading this article you can also check out Finematics on Youtube and Twitter.