Revisiting CDP Contracts: CUB Stable Coin Savanna (SAV)

in LeoFinance2 months ago


I've already done a ton of posts on how we can make HBD the most superior stable coin in the entire cryptoverse. However, because of HF25, I've somehow had even more time to think about this and streamline the ideas.

Also, it's blatantly obvious to me that it's extremely likely that the Hive ecosystem will not employ these ideas until we test them with another set of tokens. The LEO/CUB ecosystem would be perfect, but khal legit has like a dozen other projects going on... so the only way it's going to happen is for time to pass or for me to do it myself.

I have been trying to get back into the coding game. It's been a long long time. A lot of my code still has references to Steem and the API I'm using is still dsteem (which seems broken now). I've been playing around with dHive and it seems to be working so that's good.

It's so daunting to think of all the technologies I need to learn before I become a full-stack developer.

  • Hive API (Condenser/Graphene)
  • Javascript
  • Node.JS
  • React
  • Browser extensions
  • Github or other version control sites
  • Python

To be fair I don't need to know Python, but Python is one of my favorite languages and I haven't used it in over a decade (QQ). Also if I wanted to learn how to be a Hive blockchain developer I'd need to learn that codebase and take a huge refresher course in C++ which is arguably more complicated than any of the above technologies. It's easy to see why the bar for being a blockchain developer is so high.


In any case...

Like I said I've been thinking more about CDP contracts. While my ultimate goal would be get this idea employed on Hive itself, I honestly feel like every DeFi token is going to do something similar to this in the future. Every DeFi token will have it's own algorithmic stable coin. Why? Because it only makes sense that they would.

By having a stable-coin pegged directly to the DeFi token in question, anyone who holds that stable coin can still support the main network without taking nearly as much risk. Stable coins must be collateralized by significantly more than 100% of the value of the stable coin. Decentralized Finance will absolutely not allow fractional reserve banking to undermine this foundation.

This means that if you were to hold say $1M worth of stable coins pegged to CUB, it's quite likely that AT LEAST $2M worth of CUB is being locked in a contract to give that CUB its stable value. Meaning that when users buy the stable coin, it forces other users to lock the volatile asset, taking them off the market and pushing the price up. Buying stable coins will moon the main token... pretty weird right?


So how does it work?

The most important piece of a Collateralized Debt Position is the collateral itself. My previous game theory regarding this variable was quite limited. I figured there would only be one asset allowed to act as collateral. On MakerDAO, so far only ETH is allowed as collateral (last time I checked anyway).

However it's become much more obvious to me that it wouldn't be that much harder to allow an entire basket of collateralized assets to exist. All the collateral in the basket would be added up to create a total, and that total would then be used to determine the limits on how much you could borrow from the network.

The first two candidates for the collateral basket are obvious. The volatile defi token and the stable coin itself. In the context of the Leofinance network this would be CUB and whatever we call the stable coin. For now we'll call the stable coin... Savanna... because savannas are flat :D


Now I know what's you're thinking...

What's the point of allowing the stable coin to be in the basket... if all you can do is mint even less stable coins with it? That sounds like a flaw that could destabilize the network. That might be the case if this collateral basket could only mint the stable coin Savanna.

I've come to realize that it makes just as much sense to allow the main DeFi token to also be minted from the collateral basket. This means you could fill your basket with Savanna (SAV) and then pull CUB out of the basket with the minting process. You could then sell that CUB back into SAV and put that back in the basket. This would allow anyone to permissionlessly short CUB.

Why do we want to allow people to short our own network? Well, for starters, this is functionality that no other defi network even has yet. It would be pretty revolutionary and create a full-fledged decentralized futures markets with both longs and shorts to match.

On top of that fundamental gain, we want to allow users to short the network so that if the price of CUB is bubbled we can print more on demand for the users trying to buy at the jacked up prices. Shorting the network in this way allows CUB to be printed instantly and owed back at a later date. This is a much superior way of shorting the market than the way it's done in the legacy economy, where the security must be borrowed from someone that already owns it... rather than just being printed out of thin air using collateral.



CUB spikes to $10 from $3. Surely this price is bubbled and now you want to short the market a bit. You mint CUB out of your CDP contract (THE DEN) and dump it on the market at the jacked-up $10 price. This helps suppress the already overheated price and drive it back down to a fair market value. One of two things can happen.

  • CUB keeps spiking up and your SAV collateral might get liquidated to pay back the debt at a loss.
  • CUB price falls and you can purchase it back at a cheaper price with your SAV to pay off the loan and turn a profit.

What about longing the market?

This is how networks like MakerDAO already operate. Instead of locking stable-coins in the CPD you lock CUB in the CDP instead and mint stable-coins with that collateral. If you then buy CUB with those stable coins you are effectively longing CUB price.

40% long-term capital gains tax

By now everyone has heard that Biden tanked the market a bit by announcing he wants to institute higher taxes on the rich ($1M+/year). With crypto and DEFI we can largely avoid these taxes altogether. Rather than selling our CUB and incurring a capital gains tax, we can put the CUB into one of these CDPs and give ourselves a loan with it.

Because the CUB in this scenario was not sold, it can't be taxed. In addition, because the Savanna stable coins that we minted were a loan, that ALSO can't be taxed. Pretty sick loophole, amirite?

It's become quite clear to me that this is EXACTLY what all the corporations are going to be doing with their Bitcoin. They aren't ever going to sell their Bitcoin and pay these ridiculous taxes... NO! They will simply put the Bitcoin up as collateral and borrow whatever they need with it. Considering BTC is doubling in value every year there will never be any reason to sell it: ever. We can simply borrow even more the next year when BTC goes up; paying back the loan becomes highly optional when the collateral keeps doubling.


Interest rates

In the past I've gone on record as saying how absolutely foolish interest rates are for these defi loans. You're going to try and charge me interest on my own money? I don't even know where to start when explaining how asinine that entire concept is.

MakerDAO really got greedy with their interest rates, and it's a complete conflict of interest. This is because the governance token Maker forces CDP holders (ETH) to pay interest in the form of buying and burning Maker coins. So of course Maker holders are going to want to jack up interest rates as high as possible to boost the value of their own token. This is exploitative and corporate, just like MakerDAO itself that's owned by only a handful of big corporate investors during a private sale.

The interest rate is meant to stabilize the value of DAI. When too many CDPs are longing the price of Ethereum (minting DAI and dumping it for more ETH) this causes the value of DAI to drop to around 98 cents. The rational for interest rates is that DAI is "supposed to be pegged to $1" so they need to raise it in order to maintain the peg.

However, I hope it's obvious to my readers that algorithmic stable coins like DAI aren't "supposed to be" pegged to $1. They are supposed to be stable, and if the value of DAI is consistently stable around 98 cents they aren't doing it any favors by increasing interest rates. In fact they are ironically making their own stable-coin less stable by doing that. In addition, They are only pushing people away from the network and incentivizing them to create less exploitative systems elsewhere to compete.

MakerDAO interest rates got as high 10% at one point. Can you imagine that? Being forced to pay 10% interest on collateral that you own? So 100% ridiculous. 150% percent even, because that's the minimum percent required to mint DAI coins.

But then Uniswap came along and changed the entire game. Uniswap actually gave DAI a reason to exist with automated market making. Hundreds of millions of DAI were minted just to match the other side of the Liquidity Pool equation. Uniswap created massive value for tons of different projects including DAI. This pushed the price of DAI up and forced MakerDAO to remove the exploitative interest rates.

The moral of this story is that we don't need interest rates to drive prices up, we need actual demand to hold the token. Actual usage is the best way to give a coin value. I thought that would be obvious to MakerDAO but I guess greed clouded their judgement. We can do better.


In the context of CUB and made-up stable-coin Savanna, there doesn't NEED to be an interest rate, but I realized there is a solution that might be the best of both worlds.

First of all, MakerDAO doesn't even have separate variables for required-collateral-to-mint tokens vs required-collateral-to-liquidate tokens. They are both the same number: 150% collateral is required for both. If you go below 150% you'll get liquidated by the network, but if you mint tokens you can play with fire all the way down to that level (even though that's a really bad idea).

This mistake alone is an obvious example as to why DAI has such a hard time stabilizing price. They never change the percent collateral required to mint tokens. Obviously increasing the collateral required to mint stable tokens will increase it's value, while lowering it will lower it. It's a direct correlation. If it takes $3 worth of CUB to mint 1 SAV but SAV starts trading for $1.05, the network can just lower it so $2 worth of CUB can mint 1 SAV to bring the price down. It's not rocket science, and MakerDAO has never modified this number because they aren't equipped to do so (because it's linked to liquidation percent.

tug o war.jpg

So in the case of DAI, interest is exploitative because the governance token has nothing to do with it. Maker forces ETH holders to pay them interest on assets that they are more than 100% collateralizing with their own money. It makes no logical sense. However, I've realized we should not throw the baby out with the bathwater. This connection between defi token holders and stable-coin holders should not be severed.

When ETH CDP holders get charged interest on MakerDAO that goes into Maker's pockets, when in reality that money should be going into the pockets of DAI holders to incentivize holding. This is a symbiotic relationship.

More DAI holders mean more locked ETH that can't be dumped on the market. So even though ETH holders are taking a hit with interest rates it would be worth it for them to do so because it boosts the ETH token price (rather than Maker token price). At the end of the day Maker is an extremely flawed system because it can't mint or control what ETH does, which is the collateral that they require. On Hive/HBD or CUB/SAV we'd have full control of all of these mechanics.


Positive vs Negative interest rates.

What I've come to realize is that we can also reverse the interest rates negative and force stable-coin holders to pay defi token holders. This is a great mechanic that can work in both direction, and of course MakerDAO is sucking rocks and not realizing how to utilize their own system. They are instead drawing from the playbook of central-banking 101 like short-sighted fools.

Interest dichotomy.

The ultimate question we have to ask ourselves is this:

Who do we want to protect?
  • Stable coin holders.
  • Defi token holders.

If we want to protect stable-coin holders, we have to implement certain variables in such a way that punish CDP holders to keep the stable-coin afloat during the bad times like a black-swan event. If we want to protect the collateral providers that means we'll be more willing to let the stable-token be less stable than it could have been otherwise and drop below $1.

It's quite clear what a network like Hive has chosen.

With the 10% haircut in play and our stable coin trading as low as 60 cents for months at a time, it's quite clear we want the stable-coin holders to pay the price of volatility... which is obviously pretty ridiculous. MakerDAO does the opposite (perhaps to a fault) and if bad debt exists on their network they will print out Maker coins to pay back the bad debt.


The global scale of it all.

Again, I can see where this is going, and I think it's pretty obvious that EVERY defi token is going to have it's own stable coin. There will be hundreds of options to choose from (as crazy as that sounds). I can even imagine many of these stable coins linking up and joining forces in order to increase liquidity so users can actually enter and exit the market in mass. Should be interesting to see how that turns out 5-10 years down the road.

To Recap:

How can we manipulate the value of an algorithmic stable coin?

  • Increase/decrease required collateral percent.
  • Increase/decrease interest rates (even go negative).

How can we protect stable-coin holders?

  • Increase liquidation_percent to avoid bad debt.

How can we protect CDP holders?

  • Reduce liquidation_percent to avoid liquidations.
  • Increase demand to hold the stable-coin.
  • Increase demand to hold the defi token.

Example #1: stable coin too high

The stable-coin is trading at $1.05. There is too much demand for the stable asset. The network can vote to make it easier to mint coins by lowering the collateral required to mint stable-coin, or it can push interest rates into the favor of the CDP holders (less interest rates for CDP holders or even negative interest rates forcing stable-coin holders to pay).

It's much easier to lower a ballooned price of the stable-coin than it is to boost it back up to the peg. Printing stable-coins on demand lowers the price instantly. How do we do the reverse?

Example #2: stable-coin too low.

We can raise the collateral percent required the mint new stable-coins, but that might not do anything. The damage may already be too great and the coins in existence could be enough to keep the purchasing power low.

We could raise liquidation percent, this would liquify assets at the bottom of the meat-grinder and lower stable-coin supply, boosting the price but possibly pissing off CPD holders.

We could increase yield or interest rates for anyone holding the stable-coin (SAV). This is probably the correct answer. Because the SAV stable coins exist in the Den as collateral, they are already yield farming automatically. Increasing this yield or forcing CUB CPD owners to foot the bill and increase interest rates would push the price up.

Again, we have a lot more options than DAI and MakerDAO because MakerDAO has zero inflation and no farm or yield. It's amazing to me how shortsighted and anti-inflation these people are because of Bitcoin's deflationary tokenomics.

I have also brought up the ability to create decentralized credit scores and have those scores come with special benefits. Those who do what the network recommends would get higher scores, and the benefits of those scores could be applied to other defi applications. In this case the network would ask people to stabilize the stable coin and buy more, and those who helped accomplish this goal with get bonus points on their score.



CUB having its own stable coin would be a huge fundamental gain. We already have MILLIONS of dollars locked in our farming contracts. The biggest farming pool is CUB/BUSD. We are theoretically giving free value to Binance rather than scooping that value for ourselves.

If we had a stable coin we could scrap BUSD and make our main farming pool CUB/SAV. Millions of dollars would then pour into our own stable coin, and as I've already explained, for each 1 SAV purchased it basically needs to be backed by x2 or x3 the collateral value with CUB itself. So the price of CUB would moon due to millions of dollars of CUB needing to be locked in smart-contract CDP (THE DEN) to mint the SAV in the first place.


There's a very interesting choice to be made here in terms of governance. Should CUB govern itself, or should it be ruled over by a parent token? Allowing CUB to govern itself seems correct, but then we get into situations where it is a conflict of interest to allow CUB holders to decide interest rates.

Seeing as LEOfi 2nd layer governance tokens are on the way, it might make a lot more sense to grant an outside parent token governance powers to maintain more stability and fairness. Certainly something to think about... cryptocurrency imperialism... lol.

Conclusion (TL:DR)

So what makes this post unique from my several other posts about CDP smart contracts? First and foremost: I realized we should be using a basket of collateral assets instead of just one. Combined with the ability to mint stable-coins (going long) or Defi tokens (going short) this creates a superior decentralized futures market, something that zero defi networks currently have (surprisingly). Think about how early in the game we are because it wouldn't be possible to achieve these world-firsts if that wasn't the case.

The other big epiphany I had was to allow interest rates to be utilized, but in a completely different way. Too much demand for stable assets would force them to pay interest to the CDP holders (negative interest) while too little demand would spark CDP holders to pay interest to stable-holders. This idea is a work-in-progress as actual implementation needs a bit more detail. In all likelihood we would simply modify yield in the den up/down for SAV coin.

Again, all collateral is held in a basket, and for all intents and purposes, this basket (on CUB) would essentially be all the money inside the DEN. So not only would users be able to give themselves loans with their collateral, but also that collateral is generating a really good interest rate from Den farming. These mechanics greatly incentivize holding all the assets in question and create a superior system when compared to MakerDAO (that has zero inflation). This is why inflation is the killer dapp and nobody seems to realize it yet.

This post was supposed to be short.
What an abysmal failure.

Posted Using LeoFinance Beta


This could be a great idea to increase the value of $CUB I really like the way you stated. I hope $CUB team will look into it.

Concept of having own stable coin and adding a farm pool with it really amazing it could drive the value of native token to the moon

I don't even know where to begin commenting on this one... What an epic!

In the end I hope this theory on improving HBD and possibly using the CUB token ecosystem to test some of them don't just stay theoretical.

We need to make things happen!

Posted Using LeoFinance Beta

Some of it I understand, some of the article is way over my head. I did enjoy reading it and adding to my decentralized finance (Defi) knowledge.

The older I get the more I realize how dumb I am. Oh, to be 16 years old again and know everything, self-deprecation all mine.

Posted Using LeoFinance Beta

This means that if you were to hold say $1M worth of stable coins pegged to CUB, it's quite likely that AT LEAST $2M worth of CUB is being locked in a contract to give that CUB its stable value.

Fantastic increasing the value of cub and have a most stable coin ever 👏👏

Posted Using LeoFinance Beta

Thought provoking and well written Sir!

Posted Using LeoFinance Beta

Since I started with my online business, I earn $80 every 60minutes. It sounds unbelievable but you won’t forgive yourself if you don't check it out. Learn more about it here---------->>

It was a really long post and it took a while to go through it.

I like the idea but it also seems like it would be a ton of work. You need a system to keep track of the collateral value of all assets and compare the value loaned out and their current positions. Since its always changing in near real-time, I expect there to be quite a bit of burden on the network.

If you do manage to get it working, let us know. It seems like a really interesting way of creating a stable coin and maintaining its value.

Posted Using LeoFinance Beta

This is a lot to digest
we are grownups so it is time
to define where we want the community to go.
I think we are all in.

Posted Using LeoFinance Beta

I'm looking forward to it

Your post was promoted by @jfang003


I am definitely in favor of such a lending platform here on Hive. I wrote a fictional article about a Makerdao clone on Hive a few months ago, which featured a lending platform called Honeypot and a token called Honey. It was a bit corny, but the gist was very similar to this but a lot less technical in the economic theory and coding, and more focused on the trading aspects of the lending platform. I must admit I like this post better, as the lending platform you propose has evolved to a multi collateral version and one that realizes the clear conflict of interest from the MakerDao Maker token owners controlling interest rates that generate money which goes into there pocket. They no longer modify interest to stabilize the peg, they do it to make money. Even in a decentralized platform, you have to carefully incentivize the behavior you want to see.

Bitcoin Maximalist anti-inflation

You do make an interesting point I hadn't considered, the lingering ideologic restriction against token inflation of Bitcoin Maximalist influenced people who created the MakerDao limiting their ability to see the utility of inflation in all its versions. Bitcoin arose as the answer to the inflationary asset USD, so I understand the tightness of their point of view.


Savanah is a nice Lion natural environment name, I won't be surprised if the creator of your proposed lending platform picks that one up, and the SAV is also a natural choice.

I hope the idea of using borrowed code and a DAO grant resonates with you, as you have enough influence to have a reasonable shot at funding. The Hive Dev job bird would be a good place to start looking for employees.

There would be some trust involved, but but perhaps a CErtik audit could detect any exploits, and using borrowed code would help also.

Good Luck!

Posted Using LeoFinance Beta

First of all, thank you for listing a "Starter pack" tools to build something on hive (as I already know most of them lol, but when I saw them I felt like I knew nothing haha).

Regarding SAV or the stable coin idea for CUBDEFI, it is really interesting one. let's raise this idea to them to take it into consideration.

It's been kinda a long time since they posted more updates regarding their projects. Personally, I am looking forward for more stuff especially regarding CUB (because I just invested some in it 2 days ago lol)