Mirrored assets price mechanism

Mirrored assets (mAssets) price in liquidity pools

Mirrored assets (mAssets) are available for trading in either the Ethereum or Terra blockchains, by the means of automated liquidity protocols such as Uniswap (Ethereum) and Terraswap (Terra).

Both Uniswap and Terraswap protocols are powered by a market making algorithm often referred to as the constant product formula. This formula, expressed as x * y = k, states that trades must not change the product (k) of a pair’s reserve balances (x and y).

Token pairs trading on Uniswap and Terraswap act as automated market makers, ready to accept one token for the other as long as the “constant product” formula is preserved.

This mechanism guarantees that the liquidity of a given pair in a Uniswap or Terraswap pool remains constant, while balances of the underlying tokens can fluctuate.

As a result, each trade in a pool has a direct influence over the price quoted for the pair.

Example 1 (NB: this example does not take spread and trading fees into account for the sake of simplicity)

Alice would like to purchase mTSLA from the mTSLA / UST pair listed on Terraswap.
The Terraswap pool currently quotes 1 mTSLA for 700 UST and the pool liquidity is sitting at 1,000,000$

Given the above information, we can deduce the underlying tokens balance:

  • Value of each total token balance should be equal : 1,000,000 / 2 = 500,000$
  • UST quantity in the pool: 500,000$ / 1$ = 500,000 UST
  • mTSLA quantity in the pool: 500,000$ / 700$ = 714.29 mTSLA Alice purchases 100 mTSLA in exchange of 70,000 UST.

As a direct result, the Terraswap pool now contains the following balances:

  • UST quantity in the pool: 500,000 + 70,000 = 570,000 UST
  • mTSLA quantity in the pool: 714.29 - 100 = 614.29 mTSLA

Since the pool liquidity remains unchanged, we can now recalculate the price at which mTSLA is quoting in the pool following Alice’s trade:

  • Value of each total token balance remains 1,000,000 / 2 = 500,000$
  • UST value : 500,000$ for 570,000 UST = 1.14$ per UST
  • mTSLA value : 500,000$ for 614.29 mTSLA = 813.95$ per mTSLA
  • New quote 813.95$ / 1.14$ = 714 UST per mTSLA

We can therefore see that a purchase of 100 mTSLA in the Terraswap pool has moved the mTSLA price 2% up from 700 UST to 714 UST.

The above example illustrates how the purchase of an mAsset in a pool mechanically triggers a price increase, and inversely, how the action of selling the mAsset in the pool drives the price of this asset down after the trade is executed.

Using the same logic, we can also infer that the extent of a price increase/decrease following a trade in the pool, is directly driven by the size of the trade relative to the pool liquidity.

Example 2 (NB: this example does not take spread and trading fees into account for the sake of simplicity)

Alice decides to purchase 50 mTSLA instead of 100 from the mTSLA / UST pair listed on Terraswap.

The Terraswap pool quotes 1 mTSLA for 700 UST and the pool liquidity is sitting at 1,000,000$ as per our initial example and therefore the token balances pre-trade are as calculated before:

  • UST quantity in the pool: 500,000 UST
  • mTSLA quantity in the pool: 714.29 mTSLA

Alice purchases 50 mTSLA in exchange of 35,000 UST
As a direct result, the Terraswap pool now contains the following balances:

  • UST quantity in the pool: 500,000 + 35,000 = 535,000 UST
  • mTSLA quantity in the pool: 714.29 - 50 = 664.29 mTSLA

We can now recalculate the price at which mTSLA is quoting in the pool following Alice’s trade:

  • Value of each total token balance remains 1,000,000 / 2 = 500,000$
  • UST value : 500,000$ for 535,000 UST = 1.07$ per UST
  • mTSLA value : 500,000$ for 664.29 mTSLA = 752.68$ per mTSLA
  • New quote 752.68$ / 1.07$ = 703.44 UST per mTSLA

We can therefore see that a purchase of 50 mTSLA in the Terraswap pool has moved the mTSLA price 0.5% up from 700 UST to 703.44 UST and conclude that this trade for 50 mTSLA had less impact on the price of the mAsset than the purchase of 100 mTSLA in example 1

Example 3 (NB: this example does not take spread and trading fees into account for the sake of simplicity)

Alice decides to purchase 100 mTSLA from the mTSLA / UST pair listed on Terraswap.

The Terraswap pool quotes 1 mTSLA for 700 UST but the pool liquidity is different this time, sitting at 2,000,000$

The token balances pre-trade are as calculated before:

  • Value of each total token balance should be equal : 2,000,000 / 2 = 1,000,000$
  • UST quantity in the pool: 1,000,000$ / 1$ = 1,000,000 UST
  • mTSLA quantity in the pool: 1,000,000$ / 700$ = 1428.578 mTSLA

Alice purchases 100 mTSLA in exchange of 70,000 UST
As a direct result, the Terraswap pool now contains the following balances:

  • UST quantity in the pool: 1,000,000 + 70,000 = 1,070,000 UST
  • mTSLA quantity in the pool: 1428.57 - 100 = 1328.57 mTSLA

We can now recalculate the price at which mTSLA is quoting in the pool following Alice’s trade:

  • Value of each total token balance remains 2,000,000 / 2 = 1,000,000$
  • UST value : 1,000,000$ for 1,070,000 UST = 1.07$ per UST
  • mTSLA value : 1,000,000$ for 1328.57 mTSLA = 752.68$ per mTSLA
  • New quote 752.68$ / 1.07$ = 703.44 UST per mTSLA

We can therefore see that a purchase of 100 mTSLA in the Terraswap pool with a higher liquidity has moved the mTSLA price 0.5% up from 700 UST to 703.44 UST.

This trade for 100 mTSLA had less impact on the price of the mAsset than the purchase of 100 mTSLA in example 1 since the pool liquidity was higher.

Mirrored asset (mAsset) price in the Mirror minting interface

Purchasing mAssets in Uniswap or Terraswap pools is not the only method available on Mirror to acquire mAssets: the “Mint” page of the Mirror interface allows you to mint new tokens of any mAsset.

Basically , a minter is a user willing to enter into a collateralized debt position (CDP) in order to obtain newly minted tokens of an mAsset.

CDPs can accept collateral in either UST or mAssets, and must maintain at all times a collateral ratio above the mAsset’s minimum set by governance, in order to avoid liquidation.

In order to mint new tokens of a mAsset, a user will need to provide the following :

  • Collateral: the value locked as a debt against the minted mAssets (collateral can be provided as UST or mAssets)

  • Collateral ratio: ratio of the collateral value against the minted value

  • Minted: the quantity of mAsset tokens that will be minted against the CDP position according to the collateral and collateral ratio provided. The minted quantity will be calculated according to the real-time market price relayed by the oracle feeder.

Example 4

Alice would like to obtain 100$ of mTSLA by locking up 200 UST as a collateral (in order to maintain a 200% collateral ratio, safe from the liquidation threshold at 150%).

At the time of this example, the TSLA stock quotes at 700$ on the S&P 500.

In the Terra mint function, Alice enters 200% as the collateral ratio, 200 UST as a collateral value, and selects mTSLA as the asset to be minted.

The mint function automatically calculates that Alice would get 100/700 = 0.1428 mTSLA after executing the transaction

It is important to note that prices quoted in the mint interface of the Mirror protocol are kept up- to-date by oracle feeders that are tasked with periodically fetching exchange rates from reputable sources.

Each mAsset has its own dedicated feeder, which can be reassigned through governance and the price quoted by the Oracle feeder is mainly used for determining how much collateral should be locked in a CDP position, and does not affect the mAsset’s trading price on Uniswap/Terraswap.

Prices are only considered valid for 60 seconds. If no new prices are published after the data has expired, Mirror will disable CDP operations like mint, burn, deposit and withdraw until the price feed resumes.

This means that the price feed is halted when real-world markets for the asset are closed. The market hour used to track the price of mAssets is based on Nasdaq trading hours. This does not affect the ability to trade on the asset’s Uniswap or Terraswap pool.

Example 5

Alice connects to Mirror on wednesday at 23:50 PM (UTC-6) at a time where markets are closed.

She can see an indication that the mint function is not available, and by consulting the Nasdaq trading hours , understands that the mint function will re-open on Thursday at 04:00 AM (UTC-6) , at the opening time of the pre-market trading session.

Arbitrage strategies (non-exhaustive list)

Because the relative price of the two paired assets in a pool can only be changed through trading, divergences between the pool price and external prices (such as reported by the oracle feeders) create arbitrage opportunities.

An arbitrage can be described as the opportunity to buy an asset at a low price then immediately selling it on a different market for a higher price in order to extract a profit.

This incentive mechanism is at the core of the Mirror protocol and ensures that prices quoted in the pool always trend toward the market-clearing price as reported by the oracle feeder, ultimately ensuring the strength of the peg between the mirrored asset prices and their respective non-synthetic versions.

Mirrored asset (mAsset) pool price trading at a premium vs Oracle price

This scenario describes the incentives offered in the Mirror protocol for users to take a profit while ensuring the prices of mAssets in pools trends down towards the oracle prices.

Example 6 (NB: this example does not take spread, trading and CDP redemption fees into account for the sake of simplicity)

Bob has been observing the mTSLA / UST pair on Terraswap and noticed the mTSLA price jumped from 700 UST to 714 UST after Alice trade (as described in example 1).

Bob also sees that the TSLA stock is currently quoting at 700$ on the S&P500 and identifies that there exists an arbitrage opportunity between the price at which he can mint new mTSLAs and the price at which he can sell these newly minted mTSLAs in the Terraswap pool.

Bob connects to Mirror and locks up 14,000 UST as a collateral in return for minting 10 mTSLAs (valued at 10 x 700 = 7,000 UST based on the oracle feeder), subsequently maintaining a 200% collateral ratio against the value of his 10 minted mTSLAs.

Bob heads to Mirror and swaps (sells) 10 mTSLA in exchange for 714 x 10 = 7,140 UST

The trade Bob just performed had a direct impact on the mTSLA price in the pool. Following the calculations outlined in example 1, we can infer the new mTSLA price in the pool after Bob’s trade:

  • UST quantity in the pool: 570,000 - 7,140 = 562,860 UST
  • mTSLA quantity in the pool: 614.29 + 10 = 624.29 mTSLA

Since the pool liquidity remains unchanged, we can now recalculate the price at which mTSLA is quoting in the pool following Bob’s trade:

  • Value of each total token balance remains 1,000,000 / 2 = 500,000$
  • UST value : 500,000$ for 562,860 UST = 1.125$ per UST
  • mTSLA value : 500,000$ for 624.29 mTSLA = 800.90$ per mTSLA
  • New quote 800.90$ / 1.125$ = 711.9 UST per mTSLA

We can see that Bob’s sale of 10 mTSLA in the Terraswap pool has moved the mTSLA price 0.3% down from 714 UST to 711.9 UST, while Bob’s arbitrage has netted him an unrealized gain of 140 UST (7,140 - 7,000).

Following Bob’s arbitrage, the pool still quotes mTSLA at a higher price than the oracle feeder’s price, meaning that the arbitrage opportunity still exists for other users to take advantage of, until the pool price eventually reaches the market-clearing price.

Once the pool price has sufficiently trended down towards the market-clearing price after several users have seized the same arbitrage opportunity, the pool price now reports a price of 701 UST per mTSLA.

Bob decides then to repurchase 10 mTSLA from the pool, this time for 10 x 701 = 7010 UST and heads to Mirror in order to redeem (burn) 10 mTSLA in exchange for the return of his 14,000 UST locked as a collateral.

Bob’s arbitrage profit eventually nets at 7,140 - 7,010 = 130 UST , roughly 0.9% of the collateral value he had to lock.

Oracle feeder reports a higher mAsset price than the pool

This scenario describes the incentives offered in the Mirror protocol for users to take a profit while ensuring the prices of mAssets in pools trends up towards the oracle prices.

Example 7 (NB: this example does not take spread and trading fees into account for the sake of simplicity)

In this example, Nachodon has been observing the mTSLA / UST pair on Terraswap and noticed the mTSLA price decreased from 714 UST to 690 UST after Bob and several users acted upon the kind of arbitrage opportunity as described in example 6.

Nachodon decides to purchase 10 mTSLA in exchange for 10 x 690 = 6,900 UST in the Terraswap pool.

Subsequently after this trade, the pool price readjust at a higher price than 690$, and assuming the liquidity of the pool is sufficient enough for the price to trend towards the oracle feeder’s price but not yet reach that price, this arbitrage opportunity remains open for other users to take advantage of.

Once the pool price has eventually reaches the market-clearing price of 700$, Nachodon can sell his 10 mTSLA in the pool in exchange for 7,000 UST, effectively clearing a net profit of 100 UST .

Mirrored asset (mAsset) price disparity in-between different pools

This scenario describes the incentives offered in the Mirror protocol for users to take a profit while ensuring the prices of mAssets trend to parity in-between the ethereum and terra pools.

Example 8 (NB: this example does not take spread and trading fees into account for the sake of simplicity)

Aayush has been observing the mTSLA / UST pair on Terraswap and noticed the mTSLA price quotes at 701 UST in the Terraswap pool , while the same asset quotes at 710 in the Uniswap pool.

Ayush decides to purchase 10 mTSLA in the Terraswap pool in exchange for 10 x 701 = 7,010 UST , and uses the shuttle to send his 10 mTSLA over to his ethereum wallet.

He then sells his 10 mTSLA in exchange for 10 x 710 = 7,100 UST effectively clearing a profit of 7,100 - 7,010 = 90 UST

Conclusion

In this excerpt, we have explained the pricing mechanisms reigning over the Mirror protocol, from how token balances and liquidity in pools are the primary drivers of the price quoted in said pool, to how the oracle feeders of each mAsset dictates the price at which new tokens can be minted.

In the last section we also detailed how the Mirror protocol is engineered to ensure prices of the mAssets in the pools of every blockchain always trend toward the market-clearing price.

Please do not hesitate to provide feedback and questions on the above !

9 Likes

Thanks a lot for this detailed write-up! This should help out the less fintech folks a great deal. (myself included)

4 Likes