An algorithmic, crypto-backed stablecoin, run by a smart contract that acts like an autonomous bank. Developed by IOG and Emurgo and issued by COTI.
The Djed stablecoin protocol is a “(Central-)Bank-Like” smart contract that buys and sells stablecoins and reservecoins within set boundaries to keep the price of its stablecoin pegged to a target price. Djed is designed to be resilient to sudden spikes or drops in the market value of the asset used to back the stablecoin and the algorithms that underpin the Djed protocol have been formally verified.
Djed requires an oracle input for its smart contract to inform it of the price of the asset it is pegged to.
Djed is designed to have no insolvency (so it should always be able to pay out for all the stablecoins issued) and the code also contains measures to prevent bank runs (where a large amount of depositors, specifically reserve providers, withdraw all their funds at the same time).
There are two versions of Djed. A minimal Djed, described as a “simple and intuitive” stablecoin, and an extended Djed that is said to have greater stability benefits and incentives to maintain the reserve ratio at an “optimal level”.
How Does Djed Work?
The Djed protocol issues stablecoins in return for a particular asset. The protocol also allows other to contribute to its reserves, issuing reservecoins in return for their assets. By having access to surplus reserves the protocol protects its stablecoins from price instability in the underlying asset, providing greater assurance as to the security of the stablecoin. A reserve ratio parameter turns on and off the buy and sell functions of the contract to further prevent it from from loosing its peg and collateralized status during times of high price instability in the underlying asset.
Here were going to run through the different aspects of the protocol to explain how users can interact with it to buy and sell the stablecoin and to provide equity, i.e. reserves, to the protocol by purchasing reservecoins, receiving fees as a reward for doing so.
Djed runs using two coins:
Stablecoins - Purchased by people looking to use the stablecoin for its purpose of having a guaranteed stable value.
Reservecoins - Purchased by depositors who provide extra reserves to the protocol to back the stablecoin and profit from doing so.
4 Ways to Interact
Each of these are a transaction and incur a small fee protocol fee on top of the applicable network fee.
Purchasing Stablecoin - To purchase stablecoins a user sends an accepted asset, e.g. ADA, to the protocol and receives stablecoins that equal its current value in return. When the user sends their assets to the contract it mints the stablecoins and sends them to the user whilst the assets are added to the contract’s reserves.
Selling Stablecoins - To sell their stablecoins a user sends them to the contract and the contract then burns them and sends the user the equivalent value of the underlying asset, e.g. ADA.
Purchasing Reservecoins - Users send an accepted asset to the protocol and reservecoins are then minted and sent to the depositor.
Selling Reservecoins - Users send reservecoins to the contract, which then burns their reservecoins and returns assets to the user that are equal to the value of their reservecoins.
Purpose of Reservecoins
Users supply assets to the contract to obtain stablecoins, but the value of these assets will fluctuate. This means that it is highly probably that, at some point, there won’t be enough value in these assets to guarantee the value of the stablecoin. The stablecoin will then lose its peg and no longer be able to offer value security for users.
Reservecoins allow people to contribute assets to the protocol without the minting of stablecoins. These assets are then used as extra reserves by the protocol that can be used to back the stablecoin in times of high volatility. This allows for greater price assurance and increased user confidence in the stablecoin.
There is a minimum price for the reservecoins so that there is always a minimum price parameter for the protocol.
The second, and ancillary, function of the reservecoin is to decentralize the protocol and to allow users to profit from it. Much like with providing liquidity to a DEX’s liquidity pool the user’s reservecoins accumulate fees paid to the protocol. When a user returns their reservecoins to the protocol they receive their assets back plus a pro-rata amount of the protocol’s fees.
Reserves = Equity + Liability
The protocol’s reserves are split into two parts, equity and liability. The liability portion is the quantity of the assets that are needed to back up the price of the stablecoin at any given time. Any additional reserves are then catalogued as equity.
The majority of the liabilities are the assets that the users deposited for stablecoins whilst the equity is the assets that were used to purchase reservecoins. As the price of the underlying asset fluctuates the assets are moved between the liability and equity parts of the protocol’s reserves to ensure that there are always enough assets locked up as liabilities to cover the value of the issued stablecoins.
The equity portion of the reserves is not allowed to drop below zero. If it does there is a serious chance that the issued stablecoins will no longer backed by the underlying asset and will deviate from its peg. To prevent the equity from dropping to zero there are certain parameters programmed into the contract.
Reserve Ratio: A Protocol Parameter
A reserve ratio is programed into the smart contract. This is a parameter than turns off certain functions of the protocol when it is hit. The reserve ratio is the quantity of the reserve that is counted as liabilities, e.g. if half of the reserves are deemed liabilities used to back the issued stablecoin that the reserve ratio is 50%. Liabilities are not allowed to make up more than a certain percentage (defined by the implementor of the contract) of the reserves.
When the reserve ratio hits its minimum level then the contract will prevent the removal of funds from the contract by not allowing users to buy new stablecoins or burn reservecoins. This helps to prevent the protocol from being manipulated to unpeg the stablecoin by only allowing users to either withdraw the underlying asset for their stablecoins, or to add more liquidity to its reserves.
The reserve ratio is also used to prevent over saturation of the contract. This is done by setting a maximum reserve ratio. When this is reached the contract stops selling reservecoins until the ratio drops back below this threshold. This is in place to help keep an adequate level of incentives for holders of the reservecoins. If this measure wasn’t in place the contract could keep selling reservecoins, and each sale of a reservecoin would dilute the returns of each reservecoin holder reducing their returns and thus the incentive for contributing to the protocol.
In The Case of Too Few Assets
If there are not enough reserves to account for the total value of all the stablecoins issued then the value of the stablecoin will drop. Those who then choose to return their stablecoins back to the protocol will be issued assets based on the reduced value. This means that each stablecoin holder receives the same value for their coin. This is to help prevent a mass panic and rush to try and return stablecoins to the protocol in the event that this happens.