Introducing Primex V2: A New Era for the Protocol

primex.finance
primex.finance
Published in
12 min readMar 8, 2024

--

Currently, Primex operates as a spot margin trading protocol. As a result, Lenders can access high APYs on the funds they supply in Buckets, while Traders can amplify their positions by utilizing borrowed funds to trade with leverage.

With Primex V1, users finally have the chance to trade using borrowed assets without overcollateralizing their entire margin debt. Moreover, the whole community can benefit from decentralized trade execution, where centralized order books are replaced with a network of Keepers.

While the Primex V1 mainnet Beta rolled out on October 19, 2023, it is only among the first steps in the protocol’s journey. After the launch of Primex V2, the protocol will evolve into a full-fledged DeFi-native prime brokerage that will facilitate leveraged operations beyond spot margin trading, which will introduce new features and use cases.

This article sheds light on Primex V2 and the protocol’s transformation into a DeFi prime brokerage, touching on the following key points:

  • Primex V1, its features, use cases, and benefits for users
  • Primex V2 and the new functionality it introduces after its launch

Primex V1: Spot Margin Trading With Decentralized Execution

In the V1 version, Primex Finance operates as a non-custodial protocol that facilitates spot margin trading on DEXs with decentralized trade execution. This is the current state of the protocol, where Primex serves one primary use case: to enable leveraged trades on the spot market for Traders while enabling Lenders to earn interest backed directly by margin trading fees.

Market Challenges

Primex V1 addresses multiple market challenges, including:

  • The fragmentation of the digital asset market: On-chain activity is isolated on different blockchains, while DEXs and off-chain platforms offer a segregated trading experience on CEXs. This hinders the efficiency of liquidity utilization in the crypto and DeFi markets.
  • The overcollateralization of DeFi lending protocols: To borrow via a DeFi lending protocol, a borrower must deposit more value as collateral than what he can borrow from lenders. While this overcollateralization mechanism protects lenders’ funds from insolvent or non-paying borrowers, it is not a good fit for margin traders who use leverage that’s multiple times higher than their initial deposit to amplify their positions.
  • Centralized trade execution: While trade execution remains centralized on CEXs, even the DEXs with margin trading capabilities rely on centralized backends like order books to execute trades. This could increase counterparty- and price manipulation-related risks for traders.
  • Limited selection of assets and asset pairs available for leverage: Existing CEXs and DEXs offer margin trading through crypto derivatives, which are complex financial instruments and are subject to stricter regulations than spot assets. Consequently, leveraged trading is only available for a limited variety of assets and asset pairs on their platforms.
  • Accessibility: Due to financial regulations on digital asset derivatives, leveraged crypto trades are not available in some countries and regions or are restricted to a certain group of the population (e.g., accredited investors, institutional clients).

The Primex Solution

The last section summarized some of the most important market challenges traders face in the crypto space. Now, let’s see how Primex tackles them.

First, the protocol is designed to work on top of multiple DEXs instead of competing with these platforms for liquidity. Moreover, Primex is a multichain protocol that currently operates on three EVM chains (Polygon, Arbitrum, and Ethereum), with plans to support more networks in the future. By aggregating liquidity across numerous DEXs and blockchains, Primex offers an enhanced trading experience for users.

At the same time, loans aren’t overcollateralized on Primex. Consequently, Traders can borrow more than their initial deposit, enabling them to amplify their trades with leverage. As a result, liquidity usage is more efficient on Primex, making the protocol a suitable choice for leveraged operations.

To safeguard Lenders’ funds, Primex employs Credit Buckets, smart contract-powered liquidity pools designed exclusively for leveraged operations. As the use of borrowed capital is restricted to leveraged trades, dishonest and malicious Traders can’t exploit the protocol and cause financial losses to Lenders by withdrawing borrowed funds to external wallets without repaying their loans. Furthermore, individual Buckets have their own risk profile and trading rules, which are enforced by smart contracts.

In contrast with CEXs and DEXs with margin trading capabilities, Primex doesn’t rely on order books or other centralized backends to execute trades. Instead, a network of Keeper bots is responsible for liquidating Traders’ unprofitable positions that fall below the maintenance margin and executing automated trades (e.g., Limit, Stop Loss, and Take Profit orders). This makes trade execution completely decentralized on Primex, eliminating risks related to counterparties and price manipulation.

Whether Traders swap assets without leverage, create Spot 1X orders, or use borrowed funds for margin trades, their trades on the protocol are executed on the spot market in spot market assets via the protocol. As it doesn’t employ any crypto derivatives, leveraged trading is more accessible on Primex. At the same time, it makes it much faster and easier to introduce new assets and asset pairs for margin trading on the protocol through the launch of new Buckets.

Primex V1’s Advantages for Traders

Here’s a list of the advantages Primex V1 offers for Traders:

  • Access to the entire on-chain spot market: Unlike derivatives exchanges, where trades are confined to an isolated internal order book, Primex Traders engage with spot liquidity and can tap into all the liquidity available across multiple DEXs to secure the best prices.
  • Fast asset listing: By working with spot liquidity, Primex users can trade any token available on any integrated DEX without the necessity of waiting until the token is added to a specific derivatives exchange. This approach allows margin trading to be available for a vast variety of tokens, including those that are recently listed.
  • Token arbitrage and cross-DEX trading: Token arbitrage across multiple blocks allows traders to access long-term, undercollateralized debts, as opposed to the transient opportunities presented by one-transaction flash loans. By exploiting arbitrage opportunities that arise in different blocks, Traders can profit. By engaging with multiple DEXs, a Trader can open a position on one or several DEXs, maintain that position for a period of time, and then close it on another DEX that offers a more favorable price.
  • Decentralized trade execution: Besides being a non-custodial protocol, trade execution is completely decentralized on Primex. Order books and centralized backends are replaced by a network of Keepers who are in charge of liquidations and the execution of automated orders. As a result, Traders face no counterparty or price manipulation risks on Primex.
  • CEX-like trader tooling and interfaces: Unlike on most DEXs and AMMs, Traders enjoy a CEX-like trading experience on Primex with access to advanced trader tooling and interfaces. Examples of such include cross-margining and conditional orders.

Primex V1’s Advantages for Lenders

On Primex, Lenders can enjoy the following advantages via the protocol’s V1 version:

  • Interest backed by margin trading fees: On Primex, Lenders’ yield is fully backed by the borrowing fees Traders pay. This provides an economically viable way to finance Lenders’ interest payments. At the same time, Lenders have the chance to take advantage of increased Trader demand for specific Buckets (as Lenders’ APY grows with higher Bucket utilization rates).
  • Risk diversification and portfolio management: Each Credit Bucket has its own trading rules and risk parameters. Lenders can choose the ones that best fit their risk appetite and lend their assets across multiple Buckets to diversify their portfolios and manage their risks more efficiently.
  • Optimized liquidity usage: Loans on Primex are not overcollateralized, allowing Traders to borrow more funds than their initial deposit. While Lenders’ funds are protected by Credit Buckets’ smart contracts, this optimizes liquidity usage in the protocol, which translates into higher APYs for Lenders. Moreover, undercollateralized borrowing for margin trading can increase Traders’ profits, making them ready to pay higher fees to Lenders.

Primex V2— From Leveraged Trading to Universal Leveraged Portfolio

Primex Portfolio will extend the functionality of Primex V1, facilitating a vast array of possibilities for utilizing borrowed liquidity. The key differences and ideas include:

  • Instead of individual Positions, the central element of the protocol is now a Portfolio that is a combination of Positions.
  • A Position can represent any type of value or even debt, expressed as fungible assets (e.g., cryptocurrencies, lending LP tokens, etc.) or non-fungible assets (e.g., Uniswap V3 LP position NFTs, etc.).
  • Collectively, the Positions within a Portfolio have an estimated liquidation value, which must be recalculated each time the price of an individual or underlying asset changes using supported Oracles.
  • In the Portfolio, there’s no need to distinguish whether a Position was provided by the user as initial collateral or if it is the result of a trading operation or a subsequent Portfolio update. What ultimately matters is the Portfolio’s current value and its liquidation value. This approach allows for simultaneous expansion in supporting different asset classes and protocols, both as collateral types and new leverage use cases.
  • A Portfolio may contain debts to multiple Buckets, which are represented as several Debt Positions, each with a negative value. This contrasts with other Positions that hold positive values.
  • Traders have the opportunity to borrow not just ERC20 tokens but various kinds of assets (such as lending LP tokens, Uniswap V3 LP positions, etc.) from specialized Buckets that accommodate the corresponding assets. This makes the Portfolio a combination of owned and borrowed assets of arbitrary types.

The value of each Position must be adjusted using a multiplicative coefficient that reflects the level of trust in that particular asset class. When combined with debt positions, the total value should exceed a specific critical threshold to ensure the portfolio is not subject to liquidation, thus maintaining its additive health.

An important consideration relates to a special type of position that can be liquidated individually outside of the protocol, known as Liquidatable Positions. These include derivatives, futures or options protocols, where the initial value is transferred from Primex to an external protocol to form collateral within that protocol. Such Positions must be tracked additionally because they may collapse and stop acting as part of the portfolio collateral. Allowing them is an important feature to support advanced financial instruments in the Portfolio and, at the least, allows for shorting a broader range of assets than those available in Buckets.

An extension of a position is referred to as a “Looped Position,” which initially represents valuable tokens that are relocked or restaked into another protocol in exchange for different tokens. An example of this would be a cryptocurrency deposited into a lending protocol in return for LP (liquidity provider) tokens. If these LP tokens are then transferred elsewhere to earn additional interest or locked as collateral, all the actions must be reversed in order to unlock the original position’s full value.

If, in the example, the lending position is used as collateral to borrow other tokens, the position becomes liquidatable. It’s important to note that all the steps in a Looped Position must be recorded and used to calculate its total value and/or to liquidate the position, not just the final step. This is because some capacity of the collateral is used for overcollateralization with each step.

A simple example of a Looped Position would be a spot margin position whose value is transferred into a lending or staking protocol.

The Portfolio architecture is ready for cross margining since the health factor is calculated for the entire Portfolio. This enables the opportunities to create delta-neutral portfolios and scenarios whereby a DEX LP position can be offset by an opposing spot margin position. As a result, potential liquidations can be avoided, unlike with portfolios composed across various protocols, which are not synchronized and require manual rebalancing between short and long positions.

The cross-margin value calculation cannot be applied to Liquidatable Positions that are still eligible for individual liquidation in an external protocol. These positions are monitored so that their contribution to the health factor diminishes to zero as they near the point of liquidation.

Primex leverage can be applied to the following use cases:

  • Liquidity provision on spot and derivatives DEXs
  • Lending (Aave, Compound)
  • Liquid staking (Lido, Rocket Pool)
  • Using trading position funds in yield-generating protocols
  • Liquidity for options protocols
  • Looping strategies

Leveraged Liquidity Provision

The first new leverage use case to be implemented is leveraged liquidity provision on Uniswap v3. Here, a Trader borrows liquidity from a Bucket, optionally swaps a portion of it for another token, and subsequently places the token(s) into a Uniswap v3 pool as a liquidity provider. The Trader can configure the LP parameters in the same manner as on the Uniswap interface. As collateral for the debt, the Uniswap LP NFT is held in Primex’s contracts. Liquidity providers will get the opportunity to amplify their profits using borrowed funds from Lenders.

When the Trader decides to close the position, the liquidity is removed from the pool and swapped back for the borrowed asset, and the debt, along with the associated interest, is repaid. The Trader then receives the remainder of the tokens. If the value of the position falls to a critical level relative to the debt, the decentralized Keeper infrastructure liquidates the position.

Combining Leveraged LP Positions With Spot Margin Positions to Build Hedged Strategies

Traders will have the ability to craft well-balanced portfolios by merging leveraged LP positions with spot margin trading positions. This approach allows them to hedge their risks within a single protocol and eliminates the necessity to rebalance positions across multiple protocols.

For instance, a Trader can supply liquidity to the WETH/USDC pool and simultaneously open a counteracting spot margin position in the WETH/USDC pair. Traders can create and manage these positions through a single, unified interface.

By doing so, the profits from one position can offset the losses from the other, thus mitigating the risk of liquidation. Establishing such a delta-neutral strategy allows the Trader to earn interest from the leveraged liquidity provider (LP) position, which can offset the borrowing costs. This approach is anticipated to yield greater profits than a conventional, non-leveraged LP position with an equivalent investment.

Here is an example of how a properly configured hedging spot margin position can significantly improve the liquidation price of a leveraged LP position, thereby mitigating its losses more effectively. The graph shows the dependency of Portfolio health on the current price.

Here is an example of the profitability of a leveraged LP position hedged with a spot margin position vs. a non-leveraged LP position with the same deposit size. The graph shows that, although the portfolio’s profitability is initially lower for a short period, it quickly surpasses that of a simple LP position of the same size, thereby demonstrating the rationale behind such a structure.

Flash Loans

Flash loan functionality will be added to Credit Buckets, enabling borrowers to take out loans without collateral, with the requirement that the funds should be repaid within the same transaction. Thus, it is impossible to default on a flash loan. In case the borrower is unable to repay their debt to the protocol, the entire transaction will be reverted, which also includes the loan itself.

Due to the required technical knowledge to execute them, flash loans are mostly used by experienced users with developer skills. To create a flash loan, the user must build and deploy a smart contract for requesting the loan. After the contract executes the instructed steps, the loan and its respective interest and fees will be repaid to the protocol within the same transaction.

As the loan must be repaid within the same transaction, it is mostly utilized for quick transactions to take advantage of a quick trade, such as an arbitrage opportunity or the closure of a collateralized debt position.

Universal Leveraged Interaction With any Protocol

Primex is designed to act as a universal tool for leveraging a wide range of tokens and protocols. It views any external protocol as an opportunity to exchange one asset for another, ensuring the acquired asset is of sufficient value to repay the debt. For example, in a spot margin trade, a Trader uses borrowed capital to purchase an ERC20 token via a decentralized exchange (DEX). In contrast, the capital is converted into an LP NFT for a liquidity provider (LP) position in a DEX working with concentrated liquidity. In both scenarios, the received asset acts as an abstract item possessing some value.

Primex aims to remove the constraints that limit Borrowers to interacting with only pre-integrated protocols. This is achieved by allowing users to specify the contracts they wish to engage with, thereby granting them the freedom to utilize any protocol of their choice within their trading strategy. This concept mirrors that of flash loans, where the focus is not on the specifics of how the liquidity is utilized but rather on ensuring the repayment of the debt plus any applicable fees. The primary requirement for Primex is the retrieval of an adequate amount of the anticipated token to settle the loan.

A New Era for Primex

Primex V2 takes the protocol to the next level by extending its use cases with additional leveraged operations. As part of Primex’s natural evolution, the V2 version will take the protocol to its newest era, in which it will transform it from a spot margin trading protocol into a full-fledged DeFi-native prime brokerage.

As a result, Primex will be able to support new asset types via Portfolios and fulfill user demands more efficiently.

Primex V2 is expected to launch later this year. Stay tuned, and be sure to follow Primex’s social channels to stay in the loop with the latest updates!

In the meantime, don’t forget to participate in the Primex Referral Program and the Ambassador Program. By doing so, you can earn a portion of the generated protocol revenue as a referrer, receive Early Primex NFTs as a referee, and take advantage of exclusive perks and prizes as an ambassador.

--

--