Down the DeFi Rabbit Hole
The wonderworld of Decentralized Finance
“A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution”
Probably you can recognize this as the first line of the abstract of Bitcoin Whitepaper. Cryptocurrency was born as a way to EXCHANGE value between peers, but surprisingly enough, today the stronger storytelling on Bitcoin is not really about exchange of value but about STORE of value, Digital Gold VS Fiat. Inspiring examples of this narrative can be found in PlanB’s Stock-to-Flow and more upstream into ‘The Bitcoin Standard’ from Saifedean Ammous. There are several reasons for this shift in storytelling — describing all of those is out of the scope of this post — and one of those relies on the fact that people in the crypto space are not eager to spend crypto, simply because they expect that the value of bitcoin or, if not maximalist, other cryptocurrencies will increase in the long run.
I know, you’re here for the technology, changing the world and f**k the banks… but assuming that most of the participants in the cryptospace are so idealist, is nothing but naive…
I guess you heard the story about the guy that in 2009 was paid 10.000 BTC for two Domino’s Pizzas… If you expect that something will appreciate over time it would be very irrational to spend it instead of hodling hoping for future appreciation. So, how can such a form of money succeed as exchange of value when people that hodls it have huge incentives not to spend it?? You don’t need to know about Gresham’s Law to understand that bad money (in our case Fiat money) will drive away good money (bitcoin or other cryptocurrencies) right?
So what? Should we abandon the idea of using crypto for exchanging value, boosting mass adoption, until the capitalization of bitcoin is so high that the price will stabilize — if that will ever happen -?
Well… not necessarily, infact we have something called Stablecoins. At the beginning was the Tether Dollar… USDT, launched in 2014, up to the date of writing the most widespread stablecoin on the market. Basically USD without the hassle of the banking system. With USDT we can perform uncensorable transactions and hold value without relying on an intermediary. But there’s a catch, such a stable coin (together with others) relies on the external backing of Fiat USDs. The theory is the following: for each Tether Dollar out there, the issuer of the Tether Dollar tokens is storing a Fiat USD in his bank account. The stability of the value of Tether Dollar relies on the Trust on a third party…
But wait a minute, isn’t cryptocurrencies about eliminating trusted third parties? Tether Dollar is useful as clearly demonstrated by his adoption — 4th crypto for capitalization at the time of writing — but relying on a trusted third party is not what cryptocurrencies were created for.
Can we build a stable coin, a crypto asset that you’ll not regret spending, without relying on a trusted third party? Maker Dao demonstrated that the answer is yes, we can build algorithmic stable coins and that’s only the beginning!
It’s worth mentioning that Maker Dao is not the first successful attempt to create an algorithmic stable coin, first trial in 2014 was from Dan Larimer with BitUSD on BitShares. BitUSD it’s stable, it’s still up and running but it never reached the scale of Maker Dao that today has a capitalization of over 90 Mln.
DAI is based on CDPs, Collateralized Debt Position, everybody can mint new DAIs by locking up on a smart contract a collateral position in ETH with a minimal peg ratio of 150%. The ratio guarantees that each DAI is backed by enough ETH even if the exchange rate ETH/USD suddenly declines to 2/3.
For example, let’s say that the exchange rate ETH/USD is 100$, if you want to mint 100$ worth of DAI (100 DAI) you’ll need to lockup in a CDP smart contract 1,5 ETH (150$ worth of ETH). Now you can take your freshly minted DAIs — ERC-20 tokens — and sell those for other crypto, spend it for goods and services or whatever… If you want to free up your locked ETH you will have to pay back the 100 DAIs plus a stability fee. This process will destroy the DAIs you use to settle the position while freeing up your ETH collateral.
Now the interesting question is, how comes that the DAI is valuable and stable? Unfortunately the answer is not so straightforward…
But let’s give it a try: on a very high level, DAI is valuable because is backed by a collateral equal to a minimum of 150% of his nominal value. Such a minimum pegging is granted by an automatic liquidation of CDPs that goes beyond the 150% critical value. Coming back to the former example of 150 $ worth of ETH to create 100 DAIs, in the case the value of ETH goes down — meaning that the locked up ETH value in terms of dollars is less than 150 $ — and so the pegging ratio becomes less then 150%, the CDP will be immediately auctioned, auctioneers will buy the collateral (ETH) with DAIs (that will be destroyed) at a discount over the market price. Considered this liquidation risk, CDP owners usually overcollateralize and currently the peg ratio is over 300%.
The stability of DAI at 1$ on the other side depends on supply and demand equilibrium: if the market values DAI more than 1$ than the CDP creators will be incentivized to create more DAIs and sell those on the market increasing supply thus depressing price. If the market values the DAI less than 1 $ than the CDP owners will be incentivized to buy DAIs on the market and destroy those in order to free up their collateral. This will create scarcity increasing the value of DAI.
Finally there’s the Emergency Shutdown that is designed as the last resort to directly enforce the target price to holders of DAI and CDP, it’s used to protect Maker against attacks to his infrastructure such as market irrationality, hacking or security breaches. It allows DAI holders to redeem their tokens for $1 of collateral. The triggering process is currently controlled by an Emergency Oracle chosen by Maker voters and will directly controlled by Maker voters (holders of MKR token) in the multi-collateral DAI…
As you might have guessed the system is horribly complex, so much that many have sentenced DAI is not going to be stable nor scalable. But just like in the bumblebee story that is not supposed to fly, Maker DAI ignores fluid dynamics and stays stable while steadily growing his capitalization.
Now that we solved the creation of a stable coin not dependent on the deposit of Fiat money in the bank account of some trusted third party, what is our next step in decentralizing the financial stack?
Trading the time value of crypto assets, allowing participants to lease, borrow and short crypto assets in a decentralized fashion without relying on a trusted third party such as an exchange.
As brilliantly stated by Compound founders, interest rates fill the gap between people with surplus assets they don’t use, and people that have no assets but has a productive investment or use case for those. Trading the time value of assets benefits both parties creating a non zero sum wealth.This is what protocols like Compound, Oasis, ETHLand and many others are making possible for the participants in the crypto community.
How does it work? I’ll take the example of Compound since it’s the lending Dapp that currently manages more value. Traditionally in money markets, lenders are required to post, manage and supervise loan offers with a defined interest rate and duration waiting for their bids to be matched from a borrower. Such a framework creates friction requiring active participation of actors to adapt their bid and offers to market dynamics, locks up funds of the single lenders and does not maximize the liquidity in the market.
The solution implemented by Compound in based on pools of assets with algorithmically derived interest rates based on supply and demand for the asset.
Lenders and borrowers directly interact with the protocol without having to negotiate between each other terms such as maturity, interest rates or collateral.
Basically lenders transfer assets in the liquidity pool and start immediately to earn compounded interests at the current rate — algorithmically established by the system — while borrowers have to lockup a collateral and can immediately start borrowing assets.
Borrowers has to maintain their collateralization factor below the critical level — depending on volatility of the asset — in order to avoid liquidation.
Lenders can withdraw liquidity at will — assuming not every asset in the pool is borrowed — with no maturity constrains, while interest rates are automatically adjusted by the protocol according to a mathematical formula weighting supply and demand in order to maximize liquidity.
Of course the protocol cannot grant liquidity but it relies on interest rate adjustments in order to incentivize it. If there’s an high demand of an asset, landing offer will be stimulated by high interest rates which in turn will depress borrowing request.
Currently on Compound the APR on DAI’s lending is roughtly 5% and the platform manages 125 Mln $ in crypto assets earning interests. Not bad for a decentralized protocol…
Another bumblebee is flying!
But what about the decentralized exchanges? DEXes are around since few years now and allow users to exchange tokens in a trustless fashion, without relying on a trusted third party to hold their tokens and private keys. Despite the important role in the DeFi landscape, up to now Decentralized Exchanges suffered of two major flaws that discouraged adoption: usability and liquidity. Even if you’re Nerd enough to use those you’ll probably not find enough liquidity to execute your trades without disrupting the price against you.
But here comes Uniswap, with such an intuitive UX that even your grandma could execute a trade…
But that’s not all… the most remarkable aspect of the platform is not the UX but it’s liquidity and the way is generated. Have you ever heard about market makers? Those highly specialized guys in the financial industry that earn money by providing liquidity filling exchange’s both sides of the book? Well here’s the news, Uniswap deployed a decentralized platform that solves the liquidity issue by allowing anyone to earn** from market making.
Unlike other exchanges Uniswap has no book, there are no market makers but liquidity providers. Anybody can provide liquidity to Uniswap by delivering an equal value of ETH and ERC-20 tokens to one of the Uniswap exchange markets — smart contracts -. In return, the contributors are given tokens (‘pool tokens’ ERC-20) from the exchange smart contract that they can use at any time to withdraw their portion of liquidity. Each time an exchange is performed on the platform a 0.3% fee is accrued to each participant to the pool according to it’s share of the pool. Participants to the pool can withdraw at any moment their assets + accrued fees but the mix of assets they’ll receive depends on the direction the market moved..
The idea of such a system was initially inspired by some posts from Vitalik, basically the exchange rate of the assets is not determined by price feeds of an off-chain oracle but by the proportion of the two exchanged assets in the pool. The formula that describes this market making system is very simple: X * Y = K where X and Y are the quantity of the two exchanged assets while K is a constant. Such a formula describes the curve where the price will move.
Referring to the above graph, let’s say that token A is DAI and that token B is ETH, if somebody spends DAI to buy ETH he will increase the quantity of DAI and decrease the quantity ETH in the pool. The result will be a decrease of the price of DAI in terms of ETH since we’re moving downwards in the curve. Finally the exchange rate between the two assets will automatically align to the market rate since arbitragers will quickly exploit any price difference with other exchanges.
**Looks cool, but is it also profitable for liquidity providers? Well it depends… the short answer is: in the long run yes, while in the short run it depends on how fast the market moves, the better and longer answer you can find it here and here.
I guess this can be enough as a first dive in the DeFi space, but this does not mean we’re at the bottom of the rabbit hole, there’s much much more down there: decentralized Insurances for smart contracts failure as Nexus Mutual, leveraged exchanges as DyDx, synthetic assets trading platforms as Synthetix or blasfemy… WBTC bitcoin on the Ethereum Network… and that’s not all!
So stay tuned, move fast and break things!