# DJED/SHEN Example

There already are some resources to learn about the DJED algorithmic, crypto-backed stablecoin system:

In order to show (and see myself) how different movements of the ADA price and operations in the DJED system play out, I am constructing a toy example in the following. (I do not consider the different kinds of fees – see https://medium.com/cotinetwork/everything-you-need-to-know-about-djeds-fees-413ac2c6a55f – in this example.)

The operations that are possible – minting and burning DJED (the stablecoin) and SHEN (the reservecoin) – are shown in this graphic from the FAQ:

In our example, we start at an exchange rate of 0.5 USD/ADA or 2 ADA/USD – close to the current exchange rate. This means that people could mint DJED for 2 ADA/DJED, but this is not allowed at the beginning, since the reserve is empty and after minting the DJED we would be way below the minimal reserve ratio of 400% (exactly at 100%).

First, some people have to mint SHEN and put enough ADA into the reserve. (This would also be disallowed, because the reserve ratio would be ∞ after that, but in the paper – and hopefully in the implementation – there is an exception that minting SHEN is also allowed below a certain number of DJED in circulation to allow bootstrapping the system.) The initial price of SHEN is set to 1 ADA/SHEN. So, some of our example people buy/mint 600 SHEN for 600 ADA (worth 300 USD currently).

After that, some other example people can buy/mint 100 DJED for 200 ADA (worth 100 USD). After this we have 800 ADA (worth 400 USD) in the reserve. For the 100 DJED in circulation at the current exchange rate of 2 ADA/DJED, 200 ADA (worth 100 USD) are needed as liabilities. The reserve ratio is 800 ADA/200 ADA=400%. The remaining 600 ADA (worth 300 USD) in the reserve are equity divided among the 600 SHEN in circulation leading to 1 ADA/SHEN (worth 0.5 USD/SHEN).

If ADA now goes up to 0.71 USD/ADA, we have 1.4 ADA/USD. At this exchange rate, only 140 ADA (worth 100 USD) are needed as liabilities for the 100 DJED. The reserve ratio goes up to 800 ADA/140 ADA=571% (only because of the changed exchange rate without any transactions done). And now there are 660 ADA (worth 471 USD) left as equity for the 600 SHEN in circulation. So, the rate for SHEN goes to 1.1 ADA/SHEN (worth 0.79 USD/SHEN).

If you expect ADA to go up, holding SHEN will give you an additional boost. You will get more ADA back in addition to the ADA being worth more USD.

For our example, a few more people buy/mint 200 SHEN at this price, paying 220 ADA into the reserve. The reserve then has 1020 ADA (worth 729 USD), with still 140 ADA needed as liabilities and, hence, a reserve ratio of 1020 ADA/140 ADA=729% (getting close to the 800% maximum). The equity is now 880 ADA (worth 629 USD) for 800 SHEN in circulation, leading to the SHEN rate staying at 1.1 ADA/SHEN (worth 0.79 USD/SHEN).

If people buy/mint 400 additional DJED, they have to put 80 ADA into the reserve at the current exchange rate. We then have 1100 ADA (worth 5500 USD) in the reserve, 100 ADA (worth 500 USD) are needed as liabilities for the now 500 DJED, reserve ratio is at 1100%. 1000 ADA are still equity for 800 SHEN in circulation and the SHEN side of things stays at 1.25 ADA/SHEN (worth 6.25 USD/SHEN).

If SHEN holders now decide to sell/burn 560 SHEN, getting 700 ADA (worth 3500 USD) for it, there are 400 ADA (worth 2000 USD) left in the reserve. The reserve ratio goes down to the minimum of 400 ADA/100 ADA=400%. Equity is 300 ADA for 240 SHEN, which again lets the SHEN rate stay at 1.25 ADA/SHEN.

Interestingly, if ADA now loses only a bit of value, we go below the 400% minimum reserve ratio and buying/minting DJED and selling/burning SHEN is not allowed anymore. Even if SHEN holders are not allowed to sell, we can still calculate the value of the SHEN at falling ADA price:

So, because of the trades done at the peak of the exchange rate, the SHEN rates that our example SHEN holders had on the way up are reached at much higher ADA rates on the way down. They will be in the loss zone quite fast.

Below 1.25 USD/ADA (which are 25% of the value it had, when we last had 400% reserve ratio), the system will start to depeg. DJED holders will not be able to get the full equivalent of 1 USD in ADA for 1 DJED, anymore.

There are several ways to regain the peg:

• The ADA exchange rate simply goes up again.
• DJED holders sell/burn DJED despite the depeg.

For the last point: The SHEN rate never really goes to zero. The minimal price for SHEN is a protocol parameter that will be set to 0.001 ADA/SHEN according to https://medium.com/cotinetwork/everything-you-need-to-know-about-djeds-fees-413ac2c6a55f. So, people get SHEN really cheap, but not for nothing, in this depeg scenario. This will, however, distribute the equity also to these new SHEN holders on the way up again, which makes it still tougher for our old SHEN holders from the first way up.

I’m quite curious, how this will play out in reality through a real bull-bear-cycle.

12 Likes

Thanks alot for your research and good explanation with understandable examples. Often the research papers are much too abstract and complicated for a large number of people.

Indeed. Much will depend on how good the Ada/Djed traders are at pulling profits out of the Djed contract. Shen holders are passively taking the other side of this trade.

As a late follow-up, COTI’s moderators and fans and also Shahaf himself in a Cardano over Coffee Twitter Space (https://twitter.com/coc_space/status/1612819068821864450) today state that the depeg scenario is extremely unlikely, because a 75% price drop of ADA would have to happen in a very short time.

I don’t get this argument. If we are at the top of a bull market and ADA starts to drop, the incentive is to buy DJED (securing profits is one of the reasons to even have a stable coin) and sell SHEN (taking the profits, before SHEN holders are not allowed to sell anymore and also as seen in my toy example above, SHEN value is quite sensitive to dropping ADA value). Both of these contribute to bringing the reserve ratio down – in addition to the falling ADA price bringing it down anyway.

And these incentives do not change much as long as ADA keeps dropping, but both are forbidden once we are below 400% reserve ratio.

Once we reached the depeg situation, it doesn’t change much anymore. Selling DJED gets the share of the reserves and buying SHEN costs the minimum price. DJED holders might have an incentive to wait for people buying SHEN, so that there is more in the reserve, they are closer to peg again. And buying SHEN is partly incentivised by getting them for the minimal price.

But none of this incentivises to act quickly and keep the system from depegging. They might strike deals with large liquidity providers to buy SHEN and save it, but that’s outside of the system. The system will as far as I can see easily go into depeg even if the 75% drop in value compared to last 400% reserve ratio situation happens quite slowly.

And we have just seen a 90% drop in a couple of months.

Am I wrong somewhere?

To be fair at this point it would be probably better just ask Tether if they would like to launch USDT on Cardano. First i thought DJED is going to be a decentralized stablecoin but well, this is definitly not the case anymore.

Why do you think so? On that front, I am kind of appeased after the testnet launch. Their frontend will be geofenced, but it seems to be possible to interact with the contract directly.

I think I was wrong there, by the way, if we are in a depeg scenario people selling DJED get exactly their share of the reserve and the depegged price (reserve R divided by number of DJED in circulation N_DJED) does not change at all.

Im not sure but my personal gut is telling me to stay away from anything that COTI is launching. This doesnt mean they are bad or what ever, but i dont really have a good feeling about their projects.

1 Like

Please no. That company seems to be just another crypto land mine like Terra or FTT.
YouTube Video explaining some of this with some background at 14 minute mark.

That’s because you keep thinking it’s an argument.
“Very short time” is used to imply “Very unlikely” scenario. Yet in reality it just means “We didn’t include that in our failure model analysis”.
The fact is that depeg is possible even with 400% reserve ratio intact since price of DJED will be controlled by open market and not USD redemption. You can easily have scenarios where network is slow due to over capacity, some fud news drops, everyone tries to get out but can’t due to network slow down. then they start placing orders at a loss just to get out. So many possible scenarios like that.

However, I am going to get some DJED and support it and test it out. This first iteration may or may not work, but I do think they need to keep working on algorithmic stables. Although, for usability and market adaption I have higher hopes for \$USDA since that looks like the most stable option so far.

1 Like

Just to be clear: price of DJED depends solely on USD/ADA exchange rates givem to the system by an oracle (as long as reserve ratio is over 100%).

Network congestion might also hinder that oracle, but that’s not the depeg scenario I was thinking/talking about.

1 Like

Fully understand that you are talking about the protocol state where it holds less then 100% of USD value to cover outstanding DJED.

I was trying to point out that their response of :

is nonsensical since there are many ways such drops can happen.

They couldn’t conclude that from historical ADA values, since ADA has been trading with large enough average volume for analysis for only about 2.5 years (that’s not enough for any serious analysis). And if they used data from other top 50 crypto they would have to conclude that such event happens about 10 to 20 times per year (with short time span, they happen a LOT more often when counting drops in months instead of week/days).

So, they can’t offer that as an counter argument saying it’s “unlikely” since they can’t derive that from any existing data.

When looking at issuing and burning in protocol itself, yes.

Reference was to DJED being traded on an exchange/DEX where they can also depeg regardless of the protocol.

Price of ADA is set on open market and once DJED is released into exchanges and DEXs it’s value will be set by open market. You will be able to sell your DJED for premium or loss (assuming there are buyers). There can easily be a decoupling from protocol issued values that would lead to further drain of ADA from the protocol. What this part is saying is basically there are scenarios that would act out as if ADA did drop 75% with out it actually happening.

YES!
You keep thinking that everyone is rational and logical about their actions

1 Like

Offtopic: Thanks, great video. I wasn’t aware of their history. True or not, it’s something to think about.

1 Like

Tried to bring up the topic in COTI’s AMA today:

Me:

In a recent Cardano over Coffee, you, @shahafbg, implied that depeg of Djed is nearly impossible, since a drop of 75% to 87.5% in value would have to happen in a very short time.
Your reasoning seems to be that people will burn/sell DJED and/or mint/buy SHEN if the time is long enough and prevent the depeg by it.
What is your reason to believe that there are incentives for people doing that – despite the reason for even having a stable coin is to hold it until the bottom is reached and the incentives for buying SHEN are also the largest at the bottom?
What preparations do you have for a depeg of Djed during the crash after the next bull market?
https://t.me/COTInetwork/794057

Shahaf:

If Djed holders are concerned about a depeg, then they won’t stay until the bottom as you’ve suggested, but actually burn their Djed for ADA. As Shen holders are not able to burn under 4X, there will be enough ADA liquidity to make the Djed holders whole
https://t.me/COTInetwork/794069

Me:

So, you are saying DJED as a stable coin is only a hedge against small fluctuations, but in a drop as we have seen it in the last 1.5 years people should better sell their DJED and go into real fiat?
https://t.me/COTInetwork/794097

Shahaf:

that’s exactly not what I have said. I said that even with a HUGE drop you could still remain stable with Djed. There hasn’t been ANY scenarion in Cardano’s past where price dropped enough to depeg Djed. I never mentioned fiat, either.
https://t.me/COTInetwork/794100

Me:

ADA has dropped 90% from ATH right now.
https://t.me/COTInetwork/794105

Some other user:

But not suddenly
https://t.me/COTInetwork/794106

Me:

It doesn’t have to be suddenly.
https://t.me/COTInetwork/794108

Other User:

Me:

What makes you think so?
https://t.me/COTInetwork/794113

One of the COTI Telegram moderators:

It was clearly said by Shahaf in a recent Cardano over Coffee. And was mentioned even before
https://t.me/COTInetwork/794116

Shahaf:

and because it’s isnt suddenly, then the peg remains. You can watch SigmaUSD on Ergo, btw. Ergo dropped by more than 90% and the peg remained.
When the price drop isn’t not sudden, there’s enough time for all Djed and Shen holders, current and new, to reformulate their positions around the new ADA price
https://t.me/COTInetwork/794117

Me:

“Shahaf said so.” is not an a[r]gument. Why should DJED holders sell during a drop – even over months? Hedging against a drop is the very reason to hold a stable. Why should people buy SHEN during a drop? It only becomes cheaper.
https://t.me/COTInetwork/794121

And that was it. As chaotic Telegram AMAs are, it went to other (also somehow disturbing) topics.

I still don’t get what “reformulate their positions around the new ADA price” should mean that would prevent a depeg other than moving out of DJED (during a drop, which is a situation to stay in a stable coin) or moving into SHEN (during a drop, which lets its price also drop).

But the reference to SigmaUSD is interesting:

https://bdkent.github.io/sigmausd-history/

It actually didn’t come close to depeg. (It was below 400% for extended periods of time, which is kind of disappointing for a stable coin, if you can’t buy it, when you need it, but that’s another point.)

Does anybody have more insights into Ergo/SigmaUSD? Does it have enough volume to serve as a reference? What stabilised it during the latest bear market?

https://coinmarketcap.com/currencies/ergo/

3 Likes

I have used the DJED/SHEN simulator of @nemo83

to recreate my toy example:

Collateral and SHEN price a little higher due to the fees.

The SHEN here were bought at 0.5 USD/ADA, 1 ADA/SHEN, 0.5 USD/SHEN.

Again, SHEN price a little higher, but also liabilities a little higher due to the rather aggressive rounding in my manual example, leading to exactly the reserve ratio I had above.

With fees regarded, the SHEN price does not stay the same, but rises with every trade.

The SHEN here were bought at 0.71 USD/ADA, 1.1056 ADA/SHEN, 0.7850 USD/SHEN.

Differences to the manual calculation without fees grow, but we are still definitely in the same range of numbers.

With fees, our example system starts to depeg at 1.23 USD/ADA, still in the same range as in the manual example without fees.

1 Like

Great work here. To me when the collateral goes down because of the price of ada, people will hopefully ape in and restore the collateralization % by buying “cheap \$shen” and at the same time enjoy high yields because of the small \$shen supply.

I’m saying this because even now at launch, I would “rush to buy \$shen” as soon as possible to start building yields.

my 2 cents.

Possibly. But we can also see that SHEN become much cheaper during the drop. I would probably wait to “buy the dip”. At least until a plateau is reached.

Now, of course! We are hopefully close to the bottom of a bear market. It makes total sense to buy into SHEN right now to me, too!

1 Like