DeFi (decentralized finance) is an umbrella term for a variety of financial applications built on top of blockchains. The main ethos is the removal of trusted intermediaries in financial transactions. Banks, exchanges, and insurance companies are three such trusted intermediaries in the crosshairs of the decentralized finance movement. The disruptive potential of the technology has got many excited. So let’s take a look at what all the fuss is about.
How does DeFi work?
Most DeFi products today are built on top of the Ethereum blockchain and use the ERC-20 standard. So, in order to use these products, you’ll need an Ethereum wallet and some ETH as each transaction on Ethereum costs ETH (known as the “gas fee”).
Two of the most popular categories of DeFi are borrowing/lending and Decentralized Exchanges (DeX) platforms. Both categories have the concept of liquidity pools and yield underpinning them. Liquidity pools on the surface seem quite complicated, but it’s basically a pot of tokens that are used by different DeFi protocols.
The liquidity pools are created by a process of “Yield farming” or “liquidity mining”. This is a way for token holders to generate a return on their crypto holdings by locking them into specific DeFi Protocols (see “what are smart contracts?” below). In yield farming, liquidity providers (LPs for short) add funds to liquidity pools and get rewarded with a yield.
Each platform has its own set of rules for rewarding liquidity providers. Usually, rewards come in the form of an “annual percentage yield” or APY on the tokens you provide which are generated from trading and lending fees. In exchange for depositing tokens, you receive “LP tokens” equal to your percentage share in the pool. Some platforms also issue a “governance token” to liquidity providers as an extra incentive. For example COMP token on Compound, CRV for Curve and UNI for Uniswap.
To illustrate, let’s look at an example of yield farming with Uniswap and go through the normal steps you would take to set it up.
In this case, we’re acting as Liquidity Provider and depositing a pair of tokens into a Uniswap Pool. On the other side, any Trader that wants to trade in this pair can do so using the pool’s liquidity and paying a 0.03% fee.
- First, go to the Uniswap app
- Find a pool that you want to provide liquidity to using the Uniswap Interface. In this example, we have ibETH (Interest Bearing ETH) and ALPHA (Alpha Finance Lab) tokens and want to provide liquidity to the ibETH-ALPHA Pool in Uniswap.
- Information about the pool can be viewed such as total liquidity, volume and fees.
- Select the amount of liquidity you want to add. Equivalent values of each underlying token must be added when using Uniswap.
- When the liquidity is deposited into the pool, unique ERC-20 tokens known as liquidity tokens or LP tokens are minted and sent to your Ethereum address. They’ll show up in the address as UNI-V2 tokens and represent your share of the overall pool. If there are 1000 LP tokens in total and you have 100, then you have a 10% share of the pool. These LP tokens can be redeemed for the underlying assets at any time.
- Uniswap applies a 0.30% fee to trades, which is added to the pool reserves and over time the pie grows and with it your piece of the pie.
- When you decide to redeem your share, you are essentially burning the LP tokens in exchange for the share of the underlying assets in the pool. S0 in exchange for the 10 LP tokens we receive our share of ibETH and ALPHA remaining in the pool.
The token prices for traders using Uniswap is determined by the amount of each token in a pool. The Uniswap smart contract maintains a constant using the following function: x*y=k, with x and y being a pair of tokens such as ALPHA and ibETH product of a pair’s reserve balances.
When a trader wants to swap ibETh for ALPHA, they are essentially removing ALPHA token and adding ibETH to the pool. To maintain the constant K, the balances held by the smart contract are adjusted during the execution of the trade, therefore changing the price. Arbitrage trading is then relied on to ensure pricing of the Uniswap pool is in line with exchanges.
What are Smart Contracts?
Put simply, a smart contract is a self-executing contract. The terms of the agreement between buyer and seller are written into lines of code and enforced by this code when certain parameters are reached. DeFi platforms use smart contracts to remove the need for a trusted intermediary.
For example, we can view the Uni contract 0x1f9840a85d5af5bf1d1762f925bdaddc4201f984 using etherscan. You can even see the lines of code in the contract, which is written in the smart contract programming language Solidity.
What is a DeX?
Traditional exchanges such as Coinbase, Kraken and Binance are centralised and operate under the principal of an order book where there is a list of buyers and sellers in the market and the exchange matches them up. A decentralised exchange or DeX on the other hand, is a peer-to-peer (p2p) exchange that allows direct cryptocurrency transactions without the need for a centralized exchange or orderbook. Uniswap is one of the first and most well-known examples of a DeX.
Popular DeFi Products
- Uniswap is the first and most popular DEX founded by Hayden Adams. A liquidity provider pledges liquidly in the form of a pair of ERC-20 tokens. Essentially becoming a market maker. In Uniswap the deposited token pair needs to be of equivalent value.
- There is a 0.3% fee for swapping tokens. This fee is split by liquidity providers proportional to their contribution to liquidity reserves.
- Unique tokens known as liquidity tokens are minted and sent to the provider’s address. They also issue a governance token, called UNI. Changes to the protocol are voted on by owners of a native cryptocurrency and governance token called UNI.
- Uniswap v2 is implemented in the more widely-used Solidity code whereas v1 was implemented in Vyper ( contract programming language similar to Python). The next version, Uniswap V3, is planned is planned to be released in May 2021.
- Curve is one of the largest automated market makers (AMM) on Ethereum.
- The curve smart contracts were audited by Trail of Bits
- The platform focuses on stablecoin ( USDT, USDC) swaps.
- When you deposit one stable coin as liquidity, it then gets split between each token in the pool.
- Curve issues a governance token, called CRV.
- Curve fees are dependent on volume so the daily APRs can often be higher on days with high volume.
- Average Liquidity provider profit is currently 2.57% APY:
- The Curve whitepaper is here.
- SushiSwap is a DeX that developed as a fork of Uniswap in 2020
- The creator of Sushiswap is the anonymous Chef Nomi
- When SushiSwap DEXs launched they drained over 1 billion dollars of liquidity from Uniswap turning SushiSwap into the largest DEX overnight.
- SushiSwap issues a governance token, called Sushi (SUSHI). When you provide liquidity to a SushiSwap pool, you earn SUSHI in addition to the LP tokens.
- More information on SushiSwap can be found here.
Alpha Finance Lab
- Alpha Finance Lab is an ecosystem of cross-chain DeFi products. They have multiple DeFi products available which interact with different underlying Liquidity Pools such as Curve, Uniswap and Compound.
- What’s unique about Alpha Finance is the leveraged liquidity service provided by Alpha Homoro. Yield farmers can get up to 2.5x leverage with their yield farming positions.
- LPs can lend many assets such as ETH, USDT, USDC, DAI.
- ALPHA is the native utility token of the platform.
- Compound is a borrowing and lending DeFi platform founded in 2017 by Compound Labs
- When users supply assets, they receive cTokens from Compound in return. These are ERC20 tokens that are redeemable for their underlying assets in the pool at any time.
- cTokens are redeemable at an exchange rate (relative to the underlying asset) that increases over time.
- The compound white paper is here.
- Cover is a DeFI insurance protocol that provides peer to peer coverage for smart contract risk.
- Users stake collateral (a token) and 2 tokens are minted with the two tokens adding up to 1 unit of collateral.
- The tokens minted are referred to as “CLAIM” and “NOCLAIM” coverage tokens. CLAIM is redeemable in the event of a hack, while NOCLAIM is also redeemable in the event of no incident occurring.
- Cover Protocol announced the official launch of Credit Default Swaps (CDS) in March 2021.
- More information on Cover is here.
- Balancer is an automated market maker (AMM), developed on the Ethereum blockchain in March 2020.
- According to their documentation; “Balancer turns the concept of an index fund on its head: instead of paying fees to portfolio managers to rebalance your portfolio, you collect fees from traders, who rebalance your portfolio by following arbitrage opportunities.”
- By providing liquidity to Blancer Pools, users are rewarded with BAL tokens.
- The Balancer white paper can be found here.
- The Based Money protocol is a DeFi “game of chicken” according to their website.
- Bitcoin has a stable supply, but the price is volatile. For BASED, the supply is volatile targeting a stable price. Every 24 hours, the Protocol adjusts the supply of tokens to target the value of 1 BASED to 1 sUSD.
- More information on the Based Money system can be found here.
DeFi risks and mitigations
Below are some examples of the risks you can encounter using DeFi products and also some potential suggestions on how you can mitigate this risk.
1. Impermanent loss
A particular risk with volatile cryptocurrencies. It happens when the market price of your deposited assets (ETH for example) changes compared to when you deposited them. Stablecoins, due to their lesser volatility provide a smaller risk of impermanent loss for liquidity providers (LPs).
2. Smart contract vulnerability
A badly written contract or a mistake in the code can lead to the complete loss of funds. For example, the famous DAO (Decentralized Autonomous Organization) hack resultign in millions of Ether stolen.
3. Unreliable pricing oracles.
Some smart contracts use external systems known as oracles to provide information such as pricing. An oracle failure can impact the pricing.
4. Governance and changes to the protocol
As an investor, you’re exposed to the risk that changes are made to the protocol which can impact returns.
5. Regulatory risks
All crypto assets have the potential to be negatively affected by regional regulations or laws. Due to the type of DeFi projects emerging ( i.e. lending, borrowing, exchanging), it has a higher risk of being targeted by regulators.
It goes without saying, you should always do your own research (DYOR) and be comfortable before investing in anything. The DeFi space is quite new and it can seem quite complicated so make sure you do enough research so you understand how the systems operate.
2. Smart contract security audit and formal verification.
Look for DeFi platforms that are audited. For example, the Uniswap audit included the formal verification of the core smart contracts
3. Insurance & Cover
Insurance exists to protect against failure of smart contracts. The Cover Protocol allows DeFi users to buy protection against smart contract risk.
DeFi democratises market-making, effectively allowing anyone that holds a token to act as a liquidity provider and generate yield. It also allows anyone that holds a token to use services like savings, loans, exchanging and insurance without the need for a central truster intermediary.
DeFi is already beginning to disrupt traditional finance and looks set to grow further as products become more user friendly, fueling more adoption. Regulations are coming down the road which will likely target the DeFI space in particular. It remains to be seen the impact these regulations will have on the decentralised finance movement. One thing is clear, it’s coming to a head soon.