We have designed the DFX AMM to optimize for the forex use case and it is not meant to be a generalized AMM. This new AMM is uniquely built for low volatility trading of currency pairs.
New and unique features for our design!
We leverage an oracle powered by ChainLink to provide external FX price feeds into the pricing engine.
We back test our currency pairs to use historical FX data to set and optimize the price range to maximize capital efficiency and lower slippage.
Each currency is paired with USDC. USDC is treated as a bridge currency in the DFX AMM between all the other stablecoins. This allows it to maintain the most liquid pools to facilitate swaps without fragmenting liquidity.
The oracle design is very powerful. The oracle does not dictate the price, but rather provides a reference point for the bonding curve. This will help shift the optimal range of capital along the bonding curve WITHOUT user intervention.
By using back tested historical data, we are able to set the most ideal range for the capital in the pool to be utilized. Every currency pair is different and each one has their own unique characteristics. They all have a long history of data that we can leverage to help inform the bonding curve how to behave. We will be working with special models to help set and tune the bonding curve for each currency, but the community will be able to tune and adjust it thereafter to ensure the bonding curve stays relevant as the market moves. This is slated to launch with v1.
Audit: Trail of Bits
DFX engaged Trail of Bits to audit the DFX smart contracts beginning April 12, 2021 and receiving final review on May 3, 2021. The three week engagement resulted in 16 total issues, where 2 were considered high--severity. We’ll start by addressing those two first.
We’ll start by addressing those two first.
The CurveMath.calculate Trade function uses an equality check. The concern is that a future version of Solidity can change the order the semantics around this equality check such that it produces a different result.
The contract converts raw values to numeraire values for arithmetic. There may be a scenario where raw values are used instead of numeraire values resulting in disproportionate tokens received.
Both fixes were quite simple. As the equality check has been defined more implicitly and the raw values are converted to numeraire values prior to doing any arithmetic operations.