How does the decentralized derivatives protocol Primitive work?

Primitive
2021-12-11 10:35:51
Collection
Primitive is a scalable and efficient on-chain derivative tool solution without oracles.

Source: Primitive

Compiled by: Sun yuxi, W3.Hitchhiker

Introduction to Primitive

Today, we are excited to introduce the Replicating Market Maker ("RMM-01"), a spot trading and derivatives protocol.

While the derivatives market in traditional finance is enormous, DeFi derivatives have yet to develop to a comparable scale. Part of the reason is their reliance on oracle systems and high collateral requirements.

Oracles are one of the biggest sources of vulnerabilities in smart contracts and can also be the largest centralized vectors, which is why we seek an architecture that can exclude them.

Primitive is a scalable and efficient on-chain derivatives tool that is oracle-free, reflecting our belief that the future of decentralized finance should not depend on expensive (and often fragile) oracles.

The protocol is set to launch in December 2021 on Ethereum L1 mainnet, Arbitrum L2, and Optimism L2.

Here are the features included at launch:

  • Centralized homogeneous liquidity
  • Liquidity pool tokens replicating covered call options

The protocol can be used for the following purposes:

  • Earning fees as a liquidity provider
  • Swapping between tokens in the underlying liquidity pool
  • Building structured products using composable liquidity pool tokens
  • Creating liquidity pools for any token trading pair

Out of the box, Primitive is the foundational infrastructure for oracle-free DeFi and future on-chain derivatives.

Continue reading to learn about "derivative tokens" and how liquidity pools as AMMs concentrate liquidity.

Derivative Tokens

Every liquidity provider of popular automated market makers implicitly or explicitly holds an underlying derivative: Liquidity Pool Token ("LPT").

Primitive is not an AMM for trading derivatives, but LPT is the derivative. This specific niche in the derivatives market has seen some early growth but has yet to be in the spotlight. For example, there are some protocols utilizing LPTs as derivatives: Onboarding Uniswap V2 LPTs, Aave AMM Markets Released, Balancer as a portfolio manager, and the idea of "pool 2."

As an AMM, Primitive's primary use is to hold financially useful LPTs to enter this market. This differentiates the protocol from other AMMs, which may have arbitrary LPTs but not the most direct value.

Using RMM LPTs, almost any derivative return can be provided or created. For example, in decentralized lending markets like Fuse, these LPTs can be shorted, expanding the potential range of derivative returns to include both call and put options, allowing us to imagine almost any derivative return. Structured product and liquidity strategy protocols, such as Ribbon and Charm, can use a basket of LPTs to create novel products for any token on any EVM chain. Binary options can be created by selling the rights of LPTs. A basket of these binary options can be used to replicate an infinite number of tools.

Spot Trading

All liquidity supporting these LPT derivatives is effectively used for spot trading of the tokens, just like any other AMM. Better yet, centralized liquidity curves make these swap rates competitive within the DEX ecosystem, capturing more trading volume and generating fees for liquidity providers.

Liquidity providers face price risk of the underlying assets and are not neutral. While swap fees compensate for the risk, as a Primitive LP, it is almost akin to a covered call option. Due to this complexity, positions will be managed more actively to optimize assets, ideally delegating most users to vault products like Yearn and Charm.

Tokenization

The liquidity within RMM itself is not tokenized, allowing higher-level smart contracts to make decisions autonomously. This permits the use of any token standard: ERC-20, ERC-721, ERC-1155, etc.

Primitive's manager contract uses the ERC-1155 standard to tokenize liquidity. This comes with several important features:

  • All metadata of the liquidity pools is consolidated in one place, i.e., token URI
  • Each token's ID matches the pool's ID
  • Multiple LPTs can be transferred in bulk for more efficient product structuring
  • By using one smart contract for all pool tokens instead of one for each pool, on-chain state bloat is reduced
  • On-chain images built from metadata for easy viewing in any wallet!

Cheap Liquidity Management

Core smart contracts can hold internal balances allowing liquidity to move in and out of pools without incurring gas costs for transferring tokens. These token transfer costs typically account for one-third of the total fuel costs for providing liquidity to AMMs. Now, liquidity can move in and out of pools with lower friction (for the same pair).

TWAP Oracles------Spot and Implied Volatility

The reserve state of these pools is a valuable on-chain resource that can be weaponized into TWAP oracles. This is achieved by leveraging the accumulated reserves of a pool and observing it over a selected time frame.

While this oracle is aimed at spot prices, the accumulated liquidity of a pool can also be used to create a TWAP oracle for volatility. Mapping the most liquid pools to their respective volatility curves can provide astonishing insights into the implied volatility of token trading pairs.

While ideally, there would be no need for oracles in the world of RMM.

Audits and Bug Bounties

Several professional smart contract security firms have been involved in reviewing the core and peripheral contracts of the protocol:

  • Audit by ChainSecurity lasted over 8 audit weeks
  • Audit by ABDK lasted over 4 audit weeks
  • Audit by Dedaub lasted over 4 audit weeks
  • Ongoing review by Sherlock since August

While we believe that such a serious audit scope is the absolute minimum security measure in DeFi, the complexity of the protocol and ecosystem means that a completely error-free codebase can never be guaranteed.

Therefore, anyone who discovers a critical vulnerability in the smart contract will be offered a public bug bounty of $250,000 through Immunefi.

ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
ChainCatcher Building the Web3 world with innovators