Skip to main content

Litepaper

Abstract

Decentralized finance has emerged over the years as the prevailing use-case of smart contract technology by offering a more efficient and transparent environment for the development of financial applications. As Defi grew over time, developers took advantage of the composability offered to them by smart contracts, turning the decentralized stablecoin space into fertile ground for financial innovation. However, decentralized stablecoins need to attract liquidity at scale in order to become viable and in order for them to achieve this the DeFi space needs to develop the right mechanisms for attracting and maintaining liquidity. The presented protocol develops a yield-optimized liquidity foundation on top of decentralised exchanges in order to offer optimized yields to liquidity providers from the integration of swap activity and optimized lending market capital allocation that can be offered by the use of our ERC-4626 vaults. Each component of our base liquidity pools is connected to its respective vault generating optimized lending market yield in the backend. This symbiosis maximizes yield and paves the way for the creation of a liquidity layer for decentralized stablecoins.

Dynamo solution

Introduction

Asset lending constitutes a relatively low risk activity for decentralised finance (DeFi) users that are interested in putting their portfolio assets to productive use with a multitude of lending venues being available to facilitate decentralised lending activities. Platforms such as Aave, Compound, and Fraxlend allow their users to generate yield on their capital while keeping custody of their assets. Decentralised lending has facilitated a large part of DeFi's growth with the lending pool model becoming the dominant implementation in the space leading to the dominance of utilisation based interest rate models. Thus, in the presence of a surplus of available capital, interest rates on lending protocols decrease. The existence of multiple DeFi protocols leads to interest rate imbalances that come as a result of different utilisation rates in different lending markets.

Dynamo Finance aims to optimise lending yields by developing a decentralised solution that utilises the underlying capital in a multitude of lending venues in order to extract the highest possible interest rate out of each supported asset. Our ERC-4626 vaults react in real time to interest rate fluctuations across DeFi venues by rebalancing their allocations in a manner that maximises yield between different whitelisted lending platforms. Our vaults allows anyone to participate in this rebalancing process and encourage the decentralisation of the weight rebalancing process by incentivising the process with part of the yield that the respective vaults generate from a rebalancing proposal. Our infrastructure is designed in a manner that aims to maximise utilisation by the broader DeFi space allowing anyone to build on top of it.

Dynamo vaults can facilitate a wide array of use cases with the optimisation of liquidity provision in stable swap pools being just one example of its capabilities. The upcoming integration of our vaults with decentralised exchanges will act as a proof of concept by allowing liquidity providers to take advantage of our base pools in order to optimise their liquidity. This can accelerate the development of liquidity for decentralised stablecoins and other assets by allowing liquidity providers to generate an optimised lending yield out of their idle liquidity. We show explicitly in an example study how idle liquid can be unlocked to increase annual percentage yields (APY) for liquidity providers. This strategy will enable us to offer highly competitive APYs that even outperform current state-of-the-art liquidity pools like Curve Finance's 3pool.

Swap invariants for liquidity pools

The concept of an automated market maker (AMM) was first discussed by Vitalik Buterin, later generalized by Alan Lu, and finally proven viable for market making by the well-established Uniswap automated market maker. AMMs are based on invariants that describe how assets should be priced upon swap events within liquidity pools.

Uniswap's constant product invariant describes liquidity as uniformly distributed along the

qP×qL=Kq_P\times q_L = K

reserve curve, where qPq_P and qLq_L are the respective reserves of two assets PP and LL, and KK is the invariant. Let us take this reserve curve as a basis for an example to show how a swapping event would look like. Imagine we have a liquidity pool that is composed of two assets each holding 100 coins (A and B). The invariant is calculated as follows

qP×qL=(100)×(100)=10,000.q_P\times q_L = (100)\times (100) = 10,000.

The reserve curve determines how much B a user gets for a certain amount of A

(qBp)×(qA+l)=qP×qL,(q_{B} - p) \times (q_{A} + l) = q_P\times q_L,

and for an example amount of 50 A

p=qBqP×qLqA+l=10010,000100+5033.3,p = q_{B} - \frac{q_P\times q_L}{q_{A} + l} = 100 - \frac{10,000}{100 + 50} \approx 33.\overline{3},

we calculate that the user obtains 33.3\overline{3} B in exchange. Balancer introduced a multi-dimensional reserve curve that defines a cost function for the exchange of any pair of tokens held in a Balancer Pool (BP). The price reserve is defined as

K=tBtWt,K = \prod\limits_t\,B_t^{W_t},

where tt ranges over the tokens in the BP, BtB_t is the balance of the tokens in the BP, and WtW_t is the normalized weight of the tokens such that the sum of all weights equals unity. Each pair of tokens (in = ii and out = oo) has a spot price (SP) defined entirely by their weights (WiW_i and WoW_o) and balances (BiB_i and BoB_o)

SPio=Bi/WiBo/Wo.SP_i^o = \frac{B_i/W_i}{B_o/W_o}.

Swap fees (x) are taken into account by adjusting the given definition slightly

SPio(x)=SPio1x.SP_i^o(x) = \frac{SP_i^o}{1 - x}.

Furthermore, a stablecoin reserve curve has been implemented to allow for swaps between assets that are pegged with each other. Most common examples are US Dollar tracked stablecoins (e.g., DAI, Tether, and USDC), and assets that track the price of Bitcoin (e.g., wBTC, renBTC, and sBTC). Spot prices are determined by the BP balances, the amplification parameter AA, and the amount of tokens that are being swapped. Ideally, it would make sense to simply allow for 1-to-1 swaps between assets, which would be a constant sum reserve curve. However, once an asset loses its peg and its value diverges, it would make sense to enforce trade rules for uncorrelated assets, which would be a constant product reserve curve as discussed above. Balancer therefore uses the amplification parameter to define to which degree the reserve curve approximates the constant product curve (A=0A = 0), or the constant sum curve (AA \rightarrow \infty).

AnniBi+K=AKnn+Kn+1nniBi,A\,n^n\,\sum\limits_i\,B_i + K = A\,K\,n^n + \frac{K^{n+1}}{n^n\, \prod\limits_i\,B_i},

where nn is the number of tokens, BiB_i is the balance of token ii, and AA is the amplification parameter. In order to solve the equation from above, either for BiB_i or KK, we need to define it in a form like F(B,K)=0F(\textbf{B},K)=0. Then the invariant (KK) is solved iteratively using the Newton-Raphson method. The idea is to start with an initial guess, approximate the function by its tangent line, and finally compute the intercept of this tangent line. This intercept will typically be a better approximation to the original function's root than the first guess, and the method is iterated until convergence is reached. If the tangent line to the curve F(B,K)F(\textbf{B}, K) at K=KnK=K_n intercepts at Kn+1K_{n+1} then the slope is

F(B,Kn)=F(B,Kn)0KnKn+1Kn+1=KnF(B,Kn)FK(B,Kn).F'(\textbf{B}, K_n) = \frac{F(\textbf{B}, K_n) - 0}{K_n - K_{n+1}} \quad \rightarrow \quad K_{n+1} = K_n - \frac{F(\textbf{B}, K_n)}{F_K'(\textbf{B}, K_n)}.

The algorithm for swaps first solves F(B,K)=0F(\textbf{B}, K)=0 equation against KK, then against BjB_j given BiB_i which is increased by the amount of coin ii that is traded in.

Bi,k+1=Bi,kF(Bi,k,,K)FBi(Bi,k,,K)B_{i, k+1} = B_{i,k} - \frac{F(B_{i,k},\dots,K)}{F_{B_i}'(B_{i,k},\dots,K)}

Dynamo Finance vaults

DeFi users want to productively invest their assets in various lending platforms such as Aave or Compound. All those platforms support lending markets for the largest stablecoins and various other highly liquid assets. Unfortunately, the nature of lending protocols makes the returns on lent assets inversely proportional to the availability of capital in the respective lending pools. Thus, in the presence of a surplus of available capital interest rates on lending protocols decrease. The existence of multiple DeFi protocols leads to interest rate imbalances that come as a result of different utilisation rates in different lending markets (see figure below for one example showing annual percentage yield (APY) fluctuations for DAI on Compound (CDAI) and Aave (ADAI)).

DAI-interest

Yearn Finance was the first DeFi protocol to take advantage of such discrepancies by providing automatic capital migration to the protocol with the highest returns at the time.

In this paper, we describe the design of Dynamo Finance vaults, which tackle the problem of low organic stable swap yields by developing a modular liquidity management stack comprised of a yield aggregator and a liquidity network bootstrapped on top of decentralised exchanges. By integrating these two components, we develop an optimized stable swap offering that can provide sustainable yields at scale to attract and retain large amounts of stablecoin liquidity.

Our yield strategy aggregates lending markets such as Aave, Compound, and Fraxlend to extract the highest possible yield out of each supported asset by reacting in real-time to interest rate fluctuations. We achieve this by rebalancing our exposure between our whitelisted lending markets to capture the added value that can be generated through active capital management. Below we exemplify this setup for a base pool consisting of DAI/GHO/FRAX.

How Dynamo works

In the case of assets with protocol derived yield sources such as LUSD, Dynamo vaults can optimize returns by tapping into the associated yield flows and auto-compound the additional rewards they generate on behalf of our users. The ability to integrate our ERC-4626 vaults with any smart contract that lets us perform atomic transactions opens up the possibility of deploying liquidity to other partner protocols to generate the best possible returns beyond lending markets.

Our ERC-4626 vault represents the liquidity allocations by weights contributing liquidity into the underlying registered adapters by following a strategy in a manner that ensures an optimised return on the allocated capital. It is important that the weights within the vault can be adjusted in a permissionless manner. The advantage of this design is that there is no need for the existence of whitelisted accounts that are constantly aware of the current returns by opening the vault rebalancing process to every user of the protocol.

Additional lending protocols can easily be added to a vault in the future by deploying a suitable lending protocol adapter and we do not need to redeploy our vaults for that purpose. Each vault is therefore a pool of capital that represents a particular asset that is deposited into the vault by its users. The asset is allocated dynamically across the registered lending markets for the generation of yield.

Dynamo base pools

We use a boosted pool that includes multiple linear pools to create a boosted stable liquidity pool. The linear pools shift 90% of the linear pool liquidity into asset specific ERC-4626 vaults, which distribute the liquidity within the registered lending markets according to the active strategy. The remaining liquidity (10%) is earmarked for swaps within the boosted pool. A liquidity provider can thus provide one of the assets in the pool and receive the Dynamo liquidity pool token as a receipt. Below we exemplify this setup for a boosted 3pool consisting of DAI/GHO/FRAX (dUSD as receipt token), where the DAI vault is shown in detail for clarity.

Base pool architecture