LogoLogo
๐Ÿ“ App๐ŸŒณ Medium๐Ÿ’ฌ Discord๐Ÿฆ Twitter
  • Overview
    • ๐Ÿ“Angle Documentation Portal
    • โš’๏ธDevelopers
    • ๐Ÿ“–Whitepapers
    • ๐Ÿ–ผ๏ธStablecoins
    • โš ๏ธRisks
  • Transmuter
    • โš—๏ธTransmuter Overview
    • ๐Ÿ’ฑMint and Burn
    • ๐ŸชƒRedeem
    • ๐Ÿ”Other aspects
      • ๐Ÿ“„Collateral Management and Whitelist
      • ๐Ÿ‘”Implementation Details
  • Borrowing Module
    • ๐Ÿ”ญBorrowing Module Overview
    • ๐ŸฆVaults
      • ๐Ÿ’ตFees and revenue
      • ๐ŸŽณLiquidations
      • ๐Ÿ—ก๏ธVaults Settlement
    • ๐Ÿ“šGlossary
  • Savings
    • ๐Ÿ’ธAngle Savings System
  • Side Modules
    • ๐ŸŒ‰Angle Cross-Chain Setup
    • โš™๏ธAlgorithmic Market Operations
    • โšก๏ธ Flash Loans
  • Governance
    • ๐Ÿ—ณ๏ธAngle DAO
    • ๐Ÿš€ANGLE Token
    • ๐Ÿ’‚Angle Guardian
  • USER GUIDES
    • ๐Ÿ‘ŸFirst steps and settings
    • ๐Ÿ›’Buy Angle stablecoins
    • ๐Ÿ”„Swap crypto to Angle stablecoins
    • ๐Ÿ’ฐEarn yield on your stablecoins
      • ๐Ÿ’ตEarn a Dollar yield
      • ๐Ÿ’ถEarn a Euro yield
      • ๐Ÿ”™Withdraw funds
    • ๐ŸŒ‰Bridge Angle stablecoins
    • ๐ŸฆBorrow EURA
    • ๐ŸฆBorrow USDA
  • Resources
    • ๐Ÿ”Audits
    • ๐Ÿ›Bug Bounty
    • ๐Ÿ“ŠAngle Analytics
    • ๐Ÿ”—Quick Links
    • ๐Ÿ“’Glossary
  • Merkl
    • ๐ŸฅจMerkl Docs
Powered by GitBook
On this page
  • ๐ŸŒŒ Reactive Fees & Path Independence
  • โ›ฝ๏ธ Gas optimizations
  • ๐Ÿ’Ž Diamond proxy pattern
  • ๐Ÿงพ Smart accounting

Was this helpful?

  1. Transmuter
  2. Other aspects

Implementation Details

Implementation details for Transmuter

๐ŸŒŒ Reactive Fees & Path Independence

Fees for a specific action (mint or burn) are defined by the values they should take at certain exposures.

For instance, the system may be set such at exposure 0% for EURB\texttt{EUR}_BEURBโ€‹ after a mint, mint fees must be f=0.1%f=0.1\%f=0.1%, at 30% f=0.3%f=0.3\%f=0.3%, at 32% f=0.34%f=0.34\%f=0.34% and at 40% f=100%f=100\%f=100%.

The Transmuter system is implemented such that in the same block (and putting gas cost considerations aside), splitting an order in multiple sub orders involving the same asset gives exactly the same output as making one single order. On top of that, it also enables people to specify when minting or burning whether they want to get an exact amount of tokens in output or to bring an exact amount of tokens in input, with both methods being purely equivalent.

โ›ฝ๏ธ Gas optimizations

๐Ÿ’Ž Diamond proxy pattern

The Transmuter system works with external oracles to price the reserve assets. To avoid exploits, fees for each asset should be set with the oracle deviation thresholds of all other assets in mind.

Because the burn and redemption operations imply reading into the oracles of all the assets in the system, gas costs scale linearly with the amount of assets accepted in the system. Transmuter is implemented as a single contract relying on a diamond proxy pattern so the logic associated to the oracle for each asset can all be taken into account in the same contract thus reducing gas costs for calling oracles for each asset.

Beyond this, the diamond proxy pattern opens some composability and flexibility in how the system is implemented. Transmuter can read into several oracles (like UniswapV3 TWAPs or Chainlink) for a single asset, and take the value that is most at its advantage.

In fact, any oracle type can be supported provided that the values given for both the target price and for the current price are both non manipulable.

๐Ÿงพ Smart accounting

To track the exposure to each asset in the backing and compute the value of the adaptive fees, the system needs to store the amount of stablecoins that have been issued from each of the assets in the backing.

During a redemption, stablecoins are burnt for a portion of each asset. If there are NNN assets, then it means that NNN values in storage must be updated. To avoid the multiplication of storage updates, Transmuter relies on a normalizer\texttt{normalizer}normalizer variable.

If xix_ixiโ€‹ stablecoins are issued from asset iii, then Transmuter tracks the amount of stablecoins issued from iii by keeping in storage: ri=xinormalizerr_i=\frac{x_i}{\texttt{normalizer}}riโ€‹=normalizerxiโ€‹โ€‹.

If someone redeems yyy stablecoins out of the YYY that had been issued by the system, the normalizer\texttt{normalizer}normalizer variable becomes: normalizerร—(1โˆ’yY)\texttt{normalizer}\times(1-\frac{y}{Y})normalizerร—(1โˆ’Yyโ€‹)

After the normalizer\texttt{normalizer}normalizer update, the amount of stablecoins issued from asset iii becomes:

xinormalizerร—normalizerร—(1โˆ’yY)=xi(1โˆ’yY)\frac{x_i}{\texttt{normalizer}} \times \texttt{normalizer}\times(1-\frac{y}{Y}) = x_i (1-\frac{y}{Y})normalizerxiโ€‹โ€‹ร—normalizerร—(1โˆ’Yyโ€‹)=xiโ€‹(1โˆ’Yyโ€‹)
PreviousCollateral Management and WhitelistNextBorrowing Module Overview

Last updated 1 year ago

Was this helpful?

๐Ÿ”
๐Ÿ‘”