Skip to content

Latest commit

 

History

History
41 lines (22 loc) · 2.68 KB

architecture.md

File metadata and controls

41 lines (22 loc) · 2.68 KB

Architecture

The image below shows the architecture of stable asset.

There are two components in the architecture:

  • Stable Asset, which is the asset module that handles minting/burning tokens as well minter metadata;
  • Stable Swap, which is a Curve's style swap among a basket of assets with the same peg.

How users interact with Stable Swap are already discussed in the Stable Asset Algorithm. There are some additional implementation details as shown in the image.

Fee Collection

The stable swap pool can define mint/redeem/swap fee as pool income. All fees are collected in stable asset, for example

  • Mint fee is collected after stable asset is minted;
  • Redeem fee is collected before stable asset is redeemed;
  • Swap fee is collected after token is swapped. The D value increases as a result which represent s the stable asset to mint as fee.

Fees are generated as a result of mint/redeem/swap operations, so they are collected as part of the operation process. All fees are collected by fee recipient, and how the fees are handled are out of the scope of stable asset.

Yield Collection

There are two sources of yields generated in the pool: yield generated by underlying asset and yield generated by parameter A change.

Yield from Underlying Assets

The underlying asset can be yield assets too, such as yDAI, yUSDC, yUSDT in Curve's y pool. In this case, the yield asset is calculated as the amount of underlying asset. For example, if yDAI is used as the underlying asset, the amount of DAI it represents is used to compute the value of the pool.

However, as yDAI exchange rate increases due to yield collected, the total value of the stable asset pool increases as well. In such case, new stable asset is minted and transferred to yield recipient.

Yield from Parameter A Change

As mentioned in Algorithm, the value of parameter A can be adjusted to provide more liquidity according to the new price.

The current stable asset supports increasing parameter A value only. When A increases, the stable asset pool provides additional liquidity on the equal price range, and the total value of the pool increases as well. Therefore, the increased pool value is minted as stable asset and transferred to yield recipient.

In either case, the yield is generated in between transactions. Therefore, after the previous mint/redeem/swap is done, the total pool value are recorded on chain and checked in the next transaction. Any increase in total pool value is treated as pool yield. Therefore, the yield is minted in stable asset and transferred to yield recipient. How the yield is handled is outside of the scope of stable asset.