Deep Dive into DeFi (Part 2)

Jan 26, 2022  •  Written by  Dennis Le and Derek

Ocular is a crypto fund based in Singapore managed by Openspace Ventures, one of the top VCs in the region. We invest in crypto VC and HF funds as well as crypto projects globally. The Ocular team comprises crypto enthusiasts with venture capital and data science backgrounds.

We started this newsletter to share our knowledge of the latest blockchain technologies, including infrastructure protocols, DeFi, NFTs, and other dApps which are going to reinvent how things work in web2.0.

We aim to post every one to two weeks. We hope you will enjoy this newsletter and provide us with valuable feedback. Do sign up below to receive the latest updates directly in your inbox!

Disclaimer: All write-ups in this substack channel are Ocular Ventures’ own opinions, and should not be misconstrued as investment advice or recommendations. Ocular Ventures does not hold positions in the projects discussed in this channel, unless otherwise stated. This content is intended for informational purposes only.

Hi everyone,

It has been a few weeks since our last post. Hope everyone had a good Christmas / New Year holiday and is geared up for 2022. As you may know, the market has retreated significantly from its all-time highs in early-Nov 2021. Perhaps this is the much-needed cooldown that inspires crypto enthusiasts to reflect where we are in the market cycle and where we should go from here.

Our theses of various subsectors within the crypto market remain the same and we continue to be bullish about the long-term future of blockchain / web3.0 applications. In this piece, we will continue our discussion of Decentralized Finance (DeFi) that we started last month. Our discussion will revolve around DeFi’s current use cases, trends and existing shortcomings.

Recap

In the first piece of the DeFi Series, we discussed the history of Fintech, our expectations of where Fintech is heading, and how DeFi is converging with the latest Fintech trend. In short, while Fintech 1.0 was mostly about implementing software to modernize banking infrastructure; Fintech 2.0 runs deeper into the tech stack, unbundling the existing banking infrastructure into various ‘As-a-service’ layers and allowing non-banking actors to rebundle and offer various financial services. Fintech 3.0 runs even deeper, breaking down banking infra layers into primitives, making them composable and open-source and allowing for much faster, cheaper and better rebundling. With similar characteristics, we argued that DeFi could already fulfil the promises of Fintech 3.0.

As described earlier, the DeFi stack consists of 6 layers - each of which is permissionless, open-source, composable, interoperable, and interchangeable (as long as they are sitting on the same chain). For a team to build an application, they don’t need to reinvent the wheel. They just have to pick and choose the required Lego bricks and plug them together. This reduces the cost to build, time to market, and cost to operate, which collectively improves user experience and promotes financial inclusion.

To illustrate how the DeFi stack comes together, we will map it against the example of UniSwap, a DEX.

The DeFi stack can be illustrated through another example - this time, we take a look at Aave, the lending and borrowing platform.

Major DeFi Use Cases

The use cases of DeFi can be broken down into a few categories:

Decentralized Exchanges (DEXs)

Decentralized exchanges, or DEXs, are digital asset trading platforms that allow users to buy, sell and exchange their crypto assets without having to go through an intermediary or custodian.

Unlike centralized exchanges (CEXs), users of DEXs are not required to comply with KYC requirements and do not need to give up their personal data. In addition, users retain complete control over their assets at all times, as they hold custody over their private keys instead of having to entrust them to a third party. DEXs are also lauded for being more secure, as it shelters users from the risk of hacking and theft on CEXs, as well as the possibility of CEXs shutting down or pulling an exit scam.

There are various types of DEXs. Some of the earlier ones such as 0x, EtherDelta and StellarTerm rely on the traditional order book model where buyers are matched with sellers. While it is a model that is familiar to many investors and allows for greater transparency on the bid-ask spread, it runs the risk of price manipulation and it will be difficult to execute trades for illiquid markets.

Since 2020, a popular model known as Automated Market Makers (AMMs) has emerged, where the price of the crypto asset is determined algorithmically based on how much liquidity there is and how much the user wants to buy. The exact mathematical formula varies across AMMs, but a classic example will be x * y = k, where x is the amount of one token in the liquidity pool, and y is the amount of the other. In this formula, k is a fixed constant, meaning the pool’s total liquidity always has to remain the same. In addition, instead of having to rely on a counterparty to make a trade, users can interact directly with the liquidity pool through a smart contract and execute their trades. AMMs include Uniswap, SushiSwap and Balancer.

While AMMs have several advantages, many have realised that there are a few issues with the model. This includes high slippage for large orders especially for trading pairs with a smaller liquidity pool and impermanent loss for liquidity providers, which happens when the price ratio of deposited tokens changes after it is deposited in the pool, and users may have been better off holding on to the tokens instead of adding them to a pool.

To address the above concerns, some DEXs have adopted a hybrid model to tap on the advantages of both AMMs and on-chain order books. This allows for uninterrupted trading as market orders will be matched with the AMM as well as order book prices to find the best price for processing. Notable examples of DEXs that use the hybrid model include Raydium and OneSwap.

Due to the proliferation of DEXs, there are now also aggregators that combine and connect the liquidity of many sources, offering users the best price for their trades. Aggregators include 1inch, Slingshot and Paraswap.

Lending/Borrowing

A popular use case of DeFi relates to lending and borrowing, and it operates in a similar fashion to traditional money markets. Users who want to earn interest/yield can deposit (lend) their funds into a pool of liquidity, while borrowers can tap into this pool of liquidity and take out loans. The interest rates depend on the utilization rate of the pool, i.e. how much of the deposits have been borrowed.

The pool is highly liquid. Lenders can withdraw their funds at any time as it is not locked in, and borrowers can pay their loans back at their convenience. In addition, these protocols are borderless and permissionless - anyone from all over the world can participate in them. Given the supply and demand forces at play, the interest rates are variable and will be updated regularly.

To ensure credit-worthiness and protect the lenders, borrowers typically need to deposit collateral worth substantially more than the loan amount and maintain this collateral above a certain value threshold. For example, if a user wants to borrow $5k of USDC, they may need to deposit $10k of BTC or ETH. If the value of the collateral falls below a certain amount due to price volatility and the borrower does not add on, the collateral will usually be liquidated to repay the lender.

Given the overcollateralized nature of the loans and the repayment mechanisms in place, there is a minimal risk of defaults in DeFi lending/borrowing protocols. Prominent protocols include Maker, Aave, InstaDApp and Compound.

Staking

From a user’s standpoint, staking in DeFi is analogous to an interest-bearing savings account. Users receive interest (rewards) for participating in the network governance of Proof-of-Stake (POS) blockchains. This is done by either delegating digital assets to a validator node or by simply holding these digital assets in a compatible wallet. For their efforts in helping to secure the blockchain, users earn rewards that are automatically delivered by the network.

Some of the more popular POS assets that can be staked include Solana, Tezos, Cosmos, Avalanche and Cardano. Users can stake on applications such as Lido, Marinade Finance and Ankr or through wallets that support staking including Phantom, Atomic Wallet and Trust Wallet.

Yield Farming

Another popular way for users to generate passive income with their crypto assets is by engaging in yield farming, which is the practice of lending crypto assets to DeFi protocols in exchange for rewards. The assets which are lent out are used in liquidity pools to facilitate trades in DEXs as well as lending and borrowing. The incentives that lenders (or farmers) receive can be a percentage of the transaction fees, interest from borrowers or a governance token from the protocol (a process which is also known as liquidity mining).

Users can engage in yield farming on DeFi applications such as Curve Finance and Convex Finance. Farmers can contribute their assets for as long as they choose, which can be as short as a few days or as long as 1-2 years. The longer the duration, the greater the rewards.

Given the liquid nature of yield farming pools, yield rates often fluctuate and this incentivizes farmers to move platforms regularly in search of the best returns. However, farmers will incur gas fees each time they leave or enter a liquidity pool. To address this issue, projects such as Yearn Finance has implemented automatic yield farming tactics. The farmer’s assets will be deposited into a vault, which will constantly rebalance its assets among all of the liquidity pools to partake in the best yield farming possibilities.

Derivatives

Similar to the offerings in traditional finance, investors can invest in derivatives based on the crypto asset class, be it options, futures or perpetual contracts. Derivatives trading is growing increasingly popular. In Jun 2021, the total derivatives trading volumes for crypto totalled $3.2 trillion (c. $100 billion per day), which was higher than the total spot volumes at $2.7 trillion, giving it a market share of 53.8%.

There are several derivatives platforms on DeFi, including Synthetix, dYdX, Injective Protocol and Perpetual Protocol. On these applications, users can also engage in leveraged trading, up to 25x the original collateral.

Asset Management

In DeFi, retail users tend to be the custodians and managers of their own crypto assets, as the intent is to eliminate the need for intermediaries. To aid users in the process of investing, projects like TokenSets, Enzyme Finance and Symmetry have created crypto index funds, where there is a predetermined portfolio and investors can gain exposure to a wide range of assets at once. Users simply have to buy the token for the index, and the protocols will execute the trades on their behalf. An automatic rebalancing feature is also available.

For more active investors, these platforms also allow users to create and customise their own portfolios based on their risk-reward preferences and interests in the crypto market. Users can track and benchmark the past and present performance of their portfolios against the market, and make the necessary adjustments.

From a security perspective, to prevent unauthorised usage of crypto assets, there are also applications such as Gnosis Safe, BitGo and Electrum that offer users multi-signature wallets. Users can protect their wallets against any single point of failure by requiring multiple keys or logins to various devices to assess their funds.

How Has DeFi Evolved in the Past Few Years?

Through our interactions with the DeFi space, we have noticed a few key trends about DeFi:

Growth of DeFi

DeFi has experienced exponential growth in the past few years and is gaining mainstream popularity. As of Jan 2022, the total value locked (TVL) in DeFi is around $200 billion, up from around $230 million in Jan 2019. Dune Analytics also estimates that there are around 4.4 million DeFi users currently, and this is more than 3.5x the 1.2 million DeFi users at the start of 2021.

Breaking DeFi down into its various verticals, we see that lending and DEXs are most popular with users, as they currently command the majority of the TVL at $40.6 billion and $30.4 billion respectively. This is followed by asset management, which has a TVL of $16.9 billion.  

Looking ahead, we expect DeFi to gain further traction as developers work on improving the UI/UX, accessibility and security features of DeFi primitives for mass adoption.

There is significant funding in this sector to support these efforts and sustain the momentum. According to CB Insights, crypto exchanges captured the most funding of any other blockchain/crypto category in the third quarter of 2021, raising nearly $2 billion. This translates to a 22.4x increase from the $84M raised in the third quarter of 2020. Some expect DeFi, as a whole, to explode soon and could become an $800 billion industry by the end of this year.

Rise of DeFi on Other Layer-1 Protocols

Over the past year, we have observed the rise of DeFi primitives being built on other layer-1 protocols, including Binance Smart Chain, Terra, Avalanche, Solana and Fantom. While the majority of DeFi primitives are still built on Ethereum today, the percentage share of TVL on Ethereum has dropped significantly since Jan 2021 (see below).  

Source: DeFi Llama

We believe that this trend can be explained by the following reasons:

High Gas Fees on Ethereum

As seen in the chart below, the average transaction cost on Ethereum has largely been above $20 in 2021 and it reached a high of around $70 at the end of May 2021.

Source: Twitter

Gas fees were costly both for users as well as developers. By the end of 2021, developers had to spend an average of over $300k to deploy their smart contracts on Ethereum (see chart below).

Source: Twitter

In light of the cost increases in interacting with Ethereum, it is unsurprising that users and developers started looking for cheaper alternatives in other layer-1 protocols to conduct their transactions. Chains like Solana and Terra offer much lower gas fees, with transaction fees being less than $1 on average.

Better Scalability on Other Layer-1 Protocols

Referencing a table that we had previously produced for the ‘Understanding Fantom’ piece, we note that besides lower gas fees, protocols such as Fantom, Solana, Terra and Avalanche all offer faster speeds and can manage a higher transaction throughput than Ethereum. As a result, these alternative layer-1 protocols are able to scale at a much faster pace, making it more suitable for DeFi which has high trading volumes.

Developer Incentive Mechanisms

Other layer-1 protocols have also rolled out several incentive mechanisms to attract developers and users to be a part of their ecosystem. With more rewards to be gained on these protocols, more have decided to embrace them.

Fantom, for example, announced a 370 million $FTM incentive program in Aug 2021 to encourage more projects to be built on the platform. In the same month, Avalanche also announced a $180 million liquidity mining incentive program to introduce more applications and assets to its DeFi ecosystem. Part of the incentives was also used to bring Aave and Curve to launch on Avalanche.

Ease of Developing Projects

Besides the incentives (and hence desire) given to developers to participate in other layer-1 protocols, developers have the ability to easily crossover to different protocols with the presence of Ethereum Virtual Machine (EVM) - the runtime environment for the Ethereum blockchain. Protocols such as Binance Smart Chain, Fantom and Avalanche are EVM-compatible, which means that projects on these protocols are interoperable with those on Ethereum and developers can tap on Ethereum’s tools and applications. Crypto developers will be familiar with the technology needed to build projects on these protocols, and this enables new projects to be surfaced and scaled up quickly.

Notable Community Leaders

The growth of alternative layer-1 protocols has been supported by many institutions and influential individuals. Binance Smart Chain, for example, is backed by Binance, which is one of the world’s largest centralized exchanges with over 28.6 million users as of October 2021. Fantom has Andre Cronje, who is acting as the project’s DeFi Architect. Andre is a prolific DeFi developer that founded Yearn Finance. For his contributions to the DeFi space, he was named the “DeFi Person of the Year” in 2020 by DeFi Prime. The endorsement of several well-regarded personnel has drawn significant mainstream attention towards these protocols and catalysed their growth.

Symbiotic Relationship Between DeFi and GameFi

Over the past year, we have witnessed the meteoric rise of play-to-earn games, where gamers can truly own and trade their in-game assets for financial rewards. As of Jan 2022, the market cap for all play-to-earn games has exceeded $15 billion. It is estimated that there are currently over 2.5 million players in the blockchain-based gaming space, and experts believe that we could see 100 million players in the sector in the next few years.

As play-to-earn games become increasingly popular, gamers will also start turning their attention to DeFi primitives as they will have to interact with them to buy, sell, or exchange their tokens. Given the fun and easily accessible nature of GameFi, we can expect the mainstream population to first try out these play-to-earn games at the start of their crypto journey, before transitioning to DeFi as they become better acquainted with the ecosystem. GameFi will serve as a conduit to onboard more users to DeFi and enable mass adoption.

At a project-specific level, we are also starting to see the confluence of DeFi and GameFi. There are projects like DeFi Land (see images on gameplay below) on Solana that seeks to gamify DeFi, and educate gamers on how to interact with various DeFi protocols. In Sep 2021, DeFi Land raised $4.1 million in its Series A funding round from investors such as Alameda Research, Jump Capital and FTX.

Source: DeFi Land

BitSport, a blockchain-based eSports platform, also has a unique way of encouraging DeFi users to be part of the GameFi space. BitSport hosts four seasonal tournaments each year, and it is designed to bring together competitive gamers and eSports enthusiasts around the world. BitSport has enabled anyone to sponsor a tournament to earn passive returns. Users can stake stablecoins (DAI, USDT, USDC) to farm BFI token rewards (BitSport’s own token), which can be claimed at any time. Stakeholders can even pool their collective funds to sponsor their favourite BitSport gamer, allowing access to liquidity, while winning profits are distributed at a predetermined ratio amongst sponsorship pool participants and the gamer. By increasing interoperability and access to various digital currencies, BitSport aims to grow its ecosystem and increase synergies between DeFi token users and gamers.

Existing Shortcomings with ‘DeFi 1.0’

While DeFi holds great promise and potential, we acknowledge that it is still relatively nascent and will have to overcome a few shortcomings before we can fully leverage its advantages in Fintech 3.0. The concerns surrounding DeFi can be grouped into two categories: macro and micro, i.e. at the project level.  

Macro

At the macro level, the top issue on the agenda will be regulations. As DeFi is a recent development in the Fintech space, governments and key financial institutions around the world have yet to develop a robust regulatory framework to govern DeFi, but that is slowly changing. The Bank for International Settlements, an umbrella group for central banks, recently urged greater regulations on DeFi platforms as they are concerned that DeFi may not be as decentralized as advertised and may hurt the interests of users. In Sep 2021, the Securities and Exchange Commission (SEC) had also launched an investigation into Uniswap Labs, the developers behind Uniswap, to understand its workings and how Uniswap is marketed.

Stablecoins, a key unit of value in DeFi, have also experienced greater scrutiny from regulators lately. In Nov 2021, the Biden administration released a report stating that while stablecoins are a compelling payment option, they will need to be regulated and urged Congress to pass legislation to limit stablecoin issuance to insured banks. In Oct 2021, the Commodity Futures Trading Commission (CFTC) had also cracked down on Tether and ordered it to pay $41 million in fines for its false claims that the Tether stablecoin was fully backed by US dollars from 2016 to 2018.

At Ocular, we believe that greater regulations may not necessarily be a bad thing as it ensures a safer environment for users to participate in. Nonetheless, regulations may alter the way things operate in the DeFi space, and in light of this headwind, major DeFi labs will have to work closely with regulators and other stakeholders to balance all of the varied interests.

Micro

Projects also have to work through a few issues:

Scalability and Interoperability

As shared above, the majority of DeFi primitives are currently built on Ethereum, but Ethereum users are suffering from the high gas fees and long waiting times for transactions to be completed. This restricts the scalability of DeFi as Ethereum (in its present form before the ETH 2.0 upgrade) may not be the most suitable platform for high trading volumes, especially if the trades are coming in at quick succession.

While there are layer-2 scaling solutions being deployed on Ethereum and alternative layer-1 solutions have also started building their DeFi ecosystem, we note that the DeFi primitives may not be interoperable across blockchains. Users will have to conduct several transfers to bridge their assets from one protocol to another, and this will be costly and time-consuming.

Liquidity

DeFi primitives often require deep liquidity to ensure smooth operations. For example, DEXs will need liquidity for trades to be executed at the best price, while lending/borrowing protocols will need liquidity to offer loans at an attractive rate. However, one of the biggest issues that DeFi projects face is how to attract long-lasting liquidity sustainably.

To bootstrap themselves, what most DeFi projects do is allocate a significant chunk of their native tokens into the liquidity mining incentives. They offer users a high annual percentage yield (APY) to onboard users and rent the users’ liquidity. While this may help attract huge capital inflows at the start, the problem is that the vast majority of liquidity is not loyal and will move to the next project if it offers better incentives. Users will be driven by prices and should they pull out of a project, it will create huge selling pressure for the native token, which can then make or break a project. In addition, the process of sustaining liquidity in the project will incur perpetual variable costs as there is a need to continuously pay out the expected APY.

Capital Efficiency

Although the DeFi sector has seen rapid growth in its TVL, much of the capital that is in the ecosystem is not efficiently allocated, resulting in many assets remaining static and unused. In lending/borrowing primitives, for example, loans are often overcollateralized, which means borrowers have to lock up a significant portion of their base capital as collateral and this collateral does not generate any yields. Furthermore, these projects may have a low utilization ratio, where they may be more lenders than borrowers, resulting in large amounts of untapped capital.

Capital inefficiency is also an issue for staking or yield farming. Users will deposit their assets in a liquidity pool, and may receive a liquidity provider (LP) or aggregator token. These tokens represent the user’s share of the pool and will be used to redeem the underlying asset that has been contributed. However, at times, these tokens may not have other use cases, and they will sit idle in wallets before the users are ready to unstake.

In addition, users may not choose the optimal liquidity pool to maximise their rewards or may be reluctant to switch from primitives to primitives due to the perceived barriers of entry (e.g. multiple transactions with high fees and needing to re-learn how things work) and a status quo bias.

Security Risks

While DeFi eliminates the need for intermediaries and significantly reduces counterparty risks, there are other security risks that are present when interacting with DeFi primitives. Overall, security concerns about DeFi are rising, as the total number of hacking incidents on the blockchain and the total monetary losses have increased significantly over the past few years (see chart below). While it is in tandem with the increase in TVL in DeFi, it highlights that more needs to be done on the security front to protect users.

Source: Cointelegraph

The first security risk is flash loan attacks due to primitives relying on their reserves as the sole price oracle. Chainlink describes this process at a deeper level here, and below is a pictorial representation.

Source: Chainlink

To summarise, malicious actors with large amounts of funds due to flash loans (step 1) can manipulate the price of various tokens on a primitive with large trades (step 2), since some projects only use a single oracle that does not offer adequate market coverage. Given so, these actors are able to raise the reported value of the token used as collateral and lower the reported value of the token used as debt. This allows the attacker to borrow more funds than they should have been able to (step 3), and upon paying back the flash loan (step 4), they will be able to get away with a sizable profit. Flash loan attacks are not uncommon in DeFi - in 2021, victims included PancakeBunny who saw $200 million drained from its platform; Cream Finance who experienced a $130 million exploit; and Yearn Finance who lost $11 million.

The second risk is smart contract vulnerabilities. Smart contracts are driven by code and there are often cross-contract interactions. Through these exchanges, there may be flaws and bugs in the code that can be exploited. A common type of security attack is the reentrancy attack, and this happens when a contract calls an external contract before updating its own state. Malicious actors may take control of the external contract and potentially drain the main contract of its crypto assets. In 2020, we saw reentrancy attacks on Lendf.me and Uniswap, with about $25 million stolen from both protocols.

Another common exploit on smart contracts is to gain privileged access control. Many DeFi smart contracts include privileged functions, which are designed to only be called by the owner of the contract and have access controls in place to enforce this. In some cases, these access controls are missing or implemented in a way that allows an attacker to bypass them and drain value from the contract. The most notable example of this exploit happened to Poly Network in Aug 2021, with hackers stealing more than $600 million in assets before returning nearly all of it 48 hours later.

While some vulnerabilities in DeFi are complex, this is not always the case and a small coding error in smart contracts could sometimes lead to assets being compromised. An example of this can be seen with the Value DeFi hack in May 2021, which led to $11 million being lost. The line “initialized = true” was missing from the code, which meant that anyone could re-initialize the pool and set themselves as the operator of the contract. The attacker took advantage of the situation, re-initialized the pool and used a simple function to drain the staked tokens from the contract.

The third risk is leaked or stolen private keys, which serve as PIN codes to access blockchain accounts. By gaining hold of the private keys, malicious actors can control the transactions from the account. This happened to the EasyFi Defi protocol in Apr 2021 and the attacker got away with over $80 million. From what we understand, the attacker had gained access to the private keys to EasyFi’s admin account by hacking into the CEO’s computer and compromising the MetaMask wallet.

UI/UX

As DeFi primitives are relatively new, the UI/UX of the apps may not be as sophisticated as those in TradFi. In addition, as they are offering new financial products in a new asset class without the help of mainstream media to explain and educate them to the public, their products may not be easily understood. In several cases where DeFi applications require users to move assets across chains, new users might be discouraged by the number of execution steps needed and could lose interest in the products or make mistakes along the way (which might result in money loss). To achieve mass adoption, DeFi projects will need to simplify their apps’ UI/UX, abstract away as many technical steps as possible, and enable easier onboarding of new users.

Final Remarks

The DeFi community is cognizant of the above issues surrounding their ecosystem, and have taken steps to address them. In the next part of the DeFi series, we will discuss their efforts in greater detail and write about this new wave of DeFi innovation, also known as ‘DeFi 2.0’. In addition, we will seek the views of key players and experts in the DeFi space on what may lie ahead for the sector. It promises to be a great time of learning and sharing, and we cannot wait to write about our findings! Stay tuned for the next part to read more about it!