Rebasing in DyneDollar
Who is DyneDollar?
Stablecoins are the backbone of the DeFi ecosystem, providing stability amidst volatility. Despite their utility, many decentralized stablecoins have experienced market volatility and price crashes, posing significant challenges.
DyneDollar stands as a beacon of stability amidst these challenges, offering an AI-backed decentralized algorithmic stablecoin that dynamically adapts to market changes. Inspired by the DAI project but taking it a step further, DyneDollar leverages a unique rebasing mechanism to maintain its peg, eliminating the need for backing by specific assets.
By constantly adjusting to market conditions, DyneDollar is designed to be resilient to unexpected events like those that have rattled other stablecoin projects. Building on lessons learned from the past, DyneDollar offers users the benefits of decentralized stablecoins without the usual risks.
Developed on Ethereum’s robust platform, DyneDollar marks a new chapter in DeFi, blending innovative technology with stability and security. Trust DyneDollar as we redefine the future of finance.
In this short article, we focus on the rebasing mechanism in DyneDollar as well as some of its technical features; for further understanding of the DyneDollar project, please read the following article:
https://medium.com/@drashouri90/introducing-bc144fcf9620
DyneDollar Rebasing
The rebase function is a key part of the DyneDollar smart contract’s functionality, allowing it to adjust token balances in response to changes in market conditions. It’s designed to maintain the token’s price stability by increasing or decreasing the token supply.
The DyneDollar rebasing mechanism updates users’ wallet balances every day. However, it is important to understand that it does not mint or burn tokens in the traditional sense. Instead, it adjusts the scaling factor, which in turn affects the balances and supply.
During a rebase, the DyneDollar contract calculates the supply adjustment and updates the scaling factor accordingly. The actual token balances in the smart contract remain unchanged, but the adjusted balances (the ones users see) are updated based on the new scaling factor. This way, DyneDollar can achieve an elastic supply without directly minting or burning tokens.
Note: DyneDollar does not mint or burn tokens during a rebase!
Note that, DyneDollar does not mint or burn tokens daily but updates a scaling factor that affects users’ wallet balances. This mechanism allows DyneDollar to have an elastic supply that can adjust according to market conditions.
Users will see a change in the number of tokens they have after a rebase, as the adjusted balance reflects the change in the scaling factor. Let’s go through a simple example to illustrate how this works.
Suppose you have 1,000 Dyne tokens in your wallet. The total supply of Dyne is 10,000,000 tokens, and the current scaling factor is 1. Your adjusted balance is equal to your actual balance multiplied by the scaling factor, which is:
Adjusted Balance = Actual Balance * Scaling Factor
In this case, your adjusted balance is 1,000 * 1 = 1,000 Dyne.
Now, let’s say the DyneDollar contract performs a rebase, and the total supply needs to increase by 10%. The new scaling factor would be calculated as follows:
New Scaling Factor = Old Scaling Factor * (1 + Supply Adjustment Percentage)
New Scaling Factor = 1 * (1 + 0.1) = 1.1
Your new adjusted balance would be:
New Adjusted Balance = Actual Balance * New Scaling Factor
New Adjusted Balance = 1,000 * 1.1 = 1,100 Dyne
After the rebase, you will see 1,100 Dyne tokens in your wallet (e.g., MetaMask), which reflects the updated scaling factor. It is essential to understand that the actual token balance in the smart contract remains unchanged, but the adjusted balance (the one users see) is updated based on the new scaling factor.
In summary, the DyneDollar rebase mechanism affects the number of tokens users see in their wallets by updating a scaling factor, which in turn adjusts the displayed balances.
Deviation Threshold:
In DyneDollar, “deviation threshold” is 5% by default, but it can get updated based on market conditions. This means that the rebase mechanism will only be triggered if the price deviation between the current market price and the target price is greater than 5%. If the price deviation is within this range, no rebase will occur.
The deviation threshold helps to ensure that DyneDollar rebases only when there is a significant deviation from the target price, providing a stable price range for the token. It also prevents unnecessary rebases due to minor price fluctuations in the market.
Dynamic Deviation Threshold:
Making the deviation threshold dynamic could improve the quality of DyneDollar if implemented correctly. A dynamic deviation threshold could allow the system to better adapt to different market conditions and price volatility.
However, introducing a dynamic deviation threshold also adds complexity to the system, which could make it harder to analyze, understand, and predict its behavior. When designing such a mechanism, it is crucial to carefully consider the potential effects on the stability and usability of the token and ensure that malicious actors cannot exploit the mechanism.
In summary, a dynamic deviation threshold could be a valuable addition to the DyneDollar system. Still, it should be carefully designed and tested to ensure it achieves its intended purpose without introducing new risks or issues.
Decentralized Secure Oracles in DyneDollar
Here are some popular and well-established decentralized oracle systems that we used for providing stable price feeds:
- Chainlink: It is the most widely used oracle in the DeFi space. Chainlink provides reliable price feeds for various assets and has partnerships with many major blockchain projects.
- Band Protocol: Band Protocol is a cross-chain data oracle platform that aggregates and connects real-world data and APIs to smart contracts.
- Tellor: Tellor is a decentralized oracle that provides an on-chain data bank where queries are made and responded to via a Proof-of-Work protocol.
- Uniswap: Uniswap’s TWAP (Time-Weighted Average Price) can be used as a decentralized price oracle. It provides the average price of an asset over a specific interval.
- Compound’s Open Price Feed: An on-chain price oracle that is secured by Compound’s community of validators.
We use a combination of these solutions due to their pros and cons. For instance, Chainlink is widely used and has strong security, but it also has costs associated with requesting data. On the other hand, Uniswap’s TWAP is free and easy to use, but large trades may manipulate it. Thus, we excluded Uniswap’s TWAP from our final solution.
Crash / Spiral Death Protection in DyneDollar
There exist several mechanisms that protect DyneDollar from crashes or a “death spiral”:
1- Price Bands / Thresholds: One possible way to avoid extreme volatility is to place limits or “bands” around the rebase mechanism. For example, DyneDollar limits the maximum amount of rebase in a single adjustment to avoid very large changes in the supply.
2- Liquidity Provision: Encourage users to provide liquidity to the DyneDollar trading pairs. This can be achieved through liquidity mining or other incentivization schemes. The more liquidity available, the more stable the price will generally be, as large trades will have less impact on the overall price.
3- Stabilization Fund: Create a stabilization fund or reserve that can be used to buy back and burn tokens if the price falls below a certain threshold. This would help to maintain price stability and boost investor confidence.
4-Time-Locked Rebases: Implementing a mechanism where the effects of rebases are spread out over a certain time period rather than occurring all at once could help prevent sudden drastic price changes.
5-Governance: Implement a governance mechanism that allows for protocol changes based on community vote. This allows for the possibility of adjusting parameters in response to market conditions or implementing new strategies to address a crash or death spiral scenario.
Extra Security Layer to Protect DyneDollar Against Crashes!
DyneDollar comprises a few additional protections against market crashes or other unforeseen events.
- Circuit Breaker: This is a mechanism that can halt trading or rebasing if certain conditions are met. For example, if the price of DyneDollar changes by more than a certain percentage within a short period of time, the contract might halt trading or rebasing to protect against possible manipulation or extreme market volatility. This is similar to what traditional stock exchanges do during periods of high volatility.
Price Floor: A price floor mechanism could prevent the token’s price from falling below a certain value. This could help prevent a ‘death spiral’ scenario, where the price decreases due to negative feedback.
Rebase Smoothing: You could spread the rebase over several periods rather than adjusting the supply simultaneously. This helps avoid extreme changes in token supply and makes the price more stable.
Collateralization: we consider introducing a collateralization system, where users need to lock up a certain amount of another asset (e.g., ETH or a stablecoin) to mint DyneDollar. This could help maintain a floor price for the token, as users could always redeem their collateral by burning DyneDollar.