WorkflowCredmark Logo

Credmark’s DEX Pricing Model

Token Selection for Rings 1 and 2

Kunlun Yang

2023/02/28

In a previous post, “Credmark’s DEX Pricing Model | The DEX Pricing Problem” we referred to tokens in Ring 1 and Ring 2 of the pricing strategy. This post describes how we selected the tokens to be included in these baskets.

Introduction

To recap the core ideas from the previous post:

  1. Our prices are derived entirely from DEX activity; no price data from off-chain sources is used.
  2. Derived data is weighted by DEX pool liquidity.
  3. Our model builds up prices using three conceptual rings:
    1. Stablecoins form Ring 1. We acknowledge the peg to the USD but don’t assume it will always hold.
    2. Ring 2 is the native token (ETH in the case of Ethereum), priced against Ring 1.
    3. Ring 3 consists of all other tokens, priced against both Ring 2 and Ring 1.

The composition of rings 1-3 tokens are illustrated in the figure below. In this blog, we will discuss how we selected the tokens for Ring 1 and Ring 2.

Figure 1: Ring 1, 2, and 3 tokens in Credmark’s pricing model

TL;DR

Ring 1 is made up of only stablecoins that’s linked to the fiat dollar value.

Ring 1 stablecoins are selected using the following criteria:

  1. Over-collateralized or fully-fiat-backed.
  2. Sufficiently large liquidity between them to offset the depegging of the minority of the stablecoins in the pool.

Among the rest of tokens, we choose those tokens with the largest connections to the other tokens to be in Ring 2. Ring 2 tokens are selected using the following criteria:

  1. They can be priced using only Ring 1.
  2. They are used as a liquidity source for other tokens.

Selection for Ring 1 Stablecoins

In previous blog post, we had the liquidity-weighted pricing formula as following

If we only have two stablecoins in Ring 1, we can only determine the relative value between the two. For example::

For two stablecoins Ta and Tb, there is a pool with 1000 Ta and 1 Tb.

Apply (1), Price of Ta = 0.001 * 1000 = 1, Price of Tb = 1000 * 1 = 1000. However, it could also be the case that Ta = 0.001 and Tb = 1.

In Ring 1 we need at least three stablecoins and they must meet the following criteria:

  1. The majority of the stablecoins in the pool are pegged to their fiat twin. Slight deviation from the 1:1 ratio is permissible.
  2. All stablecoins have sufficiently large liquidity to offset any depegged stablecoins in the pool.

Let’s consider the case when Token 0 is depegged and we need to price token n.

The numerator in (1) can be split for the term for Token 0

and the term for other tokens

In order for Token 0 to have no material impact, the term for Token 0

needs to be insignificant relative to the term for other tokens

Let’s try some real numbers. The table below shows three pools for three tokens, Ta, Tb, and Tc, with Tc depegged.

Table 1: Example liquidity.

To calculate the price of Tb, we take the input of ratio and liquidity from pool no. 1 and 2.

The price of Tb = (1*1000+1000*0.01)/(1000+0.01) = 1.009989. Tb is overpriced by 1%.

When the liquidity for Tb in pool no.2 further decrease to 0.001, the price of Tb = (1*1000+1000*0.001)/(1000+0.001) = 1.000998999. Tb is overpriced by 0.1%.

In reality, traders will continue swapping Tc for Tb until the liquidity of Tb is close to zero, so the input from pool no. 2 becomes insignificant to the price of Tb. The price of Tb = (1*1000+1000*0)/(1000+0) = 1.0.

Note that if the majority depeg, our pricing algorithm will fail. When depegged event happens to the stablecoins in Ring 1, we will remove the depegged to keep the assumptions valid.

To keep our selection of the Ring 1 stablecoins stable, as we have learnt many lessons from the market (e.g. Luna/UST), we only chose those over-collateralized or fully-fiat-backed stablecoins.

For Ethereum mainnet, DAI/USDC/USDT are selected.

Mutual Liquidity of Ring 1 Stablecoins

In the figure below, we plotted the 1-tick liquidity (available amount to move price 0.01%) for DAI/USDC/USDT in Uniswap V2/V3 and Sushiswap pools.

  • USDC and DAI have the larger liquidity, much more than USDT. The 1-tick liquidity has grown to 250-300 million USD for USDC and DAI. This vast amount of liquidity is the bedrock for our price equation to work.
  • When the USDC (orange) has higher liquidity than DAI (blue), the liquidity of USDT (green) increases. This means that USDC forms liquid pools with both DAI and USDT while DAI’s liquidity is mostly with USDC. There is not much liquidity between USDT and DAI.

We have included USDT in Ring 1 tokens for two reasons:

  1. We need at least three tokens.
  2. USDT has closely pegged to USD despite FUD surrounding Tether, USDT’s issuer. Since Q3 2022, Tether has become more transparent about the assets backing the token.

How Liquidity changes for Depegged Stablecoins

The collapse of TerraClassicUSD (UST) in May 2022 was a monumental event for algorithmic stablecoins. Thanks to this event we can validate our equations.

V2-style pools

At block 15314735 (2022-08-10), we found two pools with UST-WETH as shown in table 2 below. The liquidity of WETH is tiny in both pools. The liquidity of UST in 0x9a0c… is larger but its price is lower than that other pool. It could be in the aftermath of an oversized dump of UST to the pool from a trade

Table 2: UST pools on V2-style pools on block 15314735

V3-style pools

Liquidity is usually not distributed uniformly in V3 pools. The price in the concentrated-liquidity pool would move to the boundary of the concentrated liquidity’s range, where LP’s supplied liquidity on the more valuable token is exhausted .

We found USDC-UST, and UST-WETH pools in V3 with different fees, as shown in table 3 below.

In general, these pools report a higher price for UST but with zero liquidity as the pool’s tick has moved to the tick spacing boundary. In our liquidity-weighted pricing formula, the product of ratio and liquidity becomes zero, resulting in no impact to the price of USDC and WETH.

Selection for Ring 2 Tokens

The selection for Ring 2 tokens is much easier than Ring 1. Ring 2 is a “connection” between the Ring 1 tokens and the Ring 3 tokens. Ring 2 tokens is directly priced by Ring 1 stablecoins and it forms trading pools with other tokens.

For Ethereum mainnet, ETH is the obvious choice for Ring 2 because it can be priced with stablecoins only, and it has been often chosen by DeFi protocols to form trading pairs to their issued tokens. This has been illustrated in Figure 1 earlier.

Ring 2 currently only has a single token, but this could change. We recently found that some tokens (e.g. BTC2x-FLI) are only priced against WBTC. There is a case for including WBTS in Ring 2.

When Ring 2 contains more than 1 token, it will have to be extended into what we are calling Ring 2+. This implementation works as follows:

  • First, we use WETH-DAI/USDC/USDT pools to determine the price of WETH.
  • Second, we use WBTC-DAI/USDC/USDT/WETH pools to determine the price of WBTC.
  • Third, Ring 1 and 2 tokens are used to price tokens in “Ring 3”, e.g. token X is priced from pools of X-DAI/USDC/USDT/WETH/WBTC.

In summary, we expand the allowed number of tokens in Ring 2 from 1 to multiple with a new name, Ring 2+. The price of the tokens in Ring 2+ are determined one-by-one, in the order of liquidity dependencies. The first token in Ring2+ needs to be priced using only the Ring 1 stablecoins. The other Ring 2+ token can be priced using the Ring 1 stablecoins and the other Ring 2+ tokens. With more Ring 2+ tokens, we expand the number of tokens which can be priced as long as they form liquidity pool(s) with any Ring 2+ tokens. This idea is illustrated in the figure 2 below. Because there is only one token known to be priced with WBTC pricing, we have not yet implemented this idea.

Figure 2: Ring 1, 2+, and 3 tokens as an possible update to Credmark’s pricing model


Summary

We discussed how we selected the tokens for Rings 1 and 2 in order to make our DEX-based pricing algorithm work.

We also discussed how Ring 1 was resilient in the face of a depegging event.

The pricing models with 400+ tokens’ prices is as part of our token API offering

The source code of the model is part of our open source repository of models


About Credmark

Credmark runs a financial modeling platform powered by reliable on-chain data. We curate and manages DeFi data making it available via API and the Snowflake Marketplace around the globe and across industries.

Our community of quants, developers, and modelers actively build models for the DeFi community by leveraging our data API and tools. Join the growing community and together we will advance the next-generation financial system.

copy to clipboard

Sign up for our newsletter for the latest product updates, partnerships, and more.

Ready to get started?

Sign up for our free Token API

Get the latest news

Footer

Credmark logo
DiscordDiscord iconTwitterTelegramTelegram iconYoutubeYouTube iconGitHub

© 2023 Credmark Labs, Inc. All rights reserved.

Products

  • All Products
  • Token API
  • Portfolio API
  • DeFi API
  • Raw Data

Documentation

  • Token API Reference
  • Portfolio API Reference
  • DeFi API Reference
  • Transformation Reference
  • Framework Reference

Resources

  • FAQ
  • Blog
  • Reports
  • Media

About

  • Careers
  • About us
  • Community

Support

  • Status
  • Contact us