Lesson 3. DeFi

GREED Academy
14 min readAug 15, 2024

--

Before diving into DeFi, it’s crucial to understand the foundations of traditional finance — what we often refer to as “TradFi” (a term the cool kids use). For centuries, financial systems have been dominated by intermediaries like banks, brokers, and other financial institutions. These entities have served as gatekeepers, controlling access to financial services and generating profits through various means: fees, interest rates, and, most importantly, control over the flow of money.

When you deposit money into a bank, for example, it doesn’t just sit there. The bank lends it out, invests it, and earns interest — passing only a fraction of that return back to you as interest on your savings. Similarly, financial brokers facilitate trades and investments, charging fees that, while lower today, were once borderline abusive for retail investors. The reality is that these intermediaries profit significantly from the control they have over your assets. Their decision-making power often doesn’t align with the best interests of the end user. Over time, the traditional financial system has become synonymous with inefficiency, lack of transparency, and a profit model that disproportionately benefits those at the top. This entire structure has been also possible due to the support of the ruling powers, making the system even more asymmetrical and resistant to change.

Introduction to DeFi

Fast forward to 2008, the world found itself in the middle of one of the most severe financial crises in recent history. Trust in banks plummeted as millions lost their homes, jobs, and savings. The future of the global economy was uncertain, and it was unclear who would take the brunt of this fallout. During this chaos, in early 2009, the genesis block of Bitcoin was mined, marking the birth of a new financial paradigm. Bitcoin’s creation was a direct response to the failures of the traditional financial system.

The Bitcoin whitepaper outlined a vision for a decentralized, trustless financial system, one that could work without the need for banks or other intermediaries. This vision was a precursor to what we now know as Decentralized Finance, or DeFi. The whitepaper foreshadowed the discontent that would later started movements like Occupy Wall Street in 2011, where people across the globe expressed their frustration with a system that seemed rigged against the common individual.

DeFi as we know it today, was not really possible until enabled smart contract chains like Ethereum were launched in 2015. And even then it still took years for DeFi protocols to reach terminal velocity.

One of the earliest and most significant DeFi projects on Ethereum was MakerDAO, which launched in 2014 and created DAI, a decentralized stablecoin, algorithmically pegged to the US Dollar (we’ll talk about this some other day). Many pivotal projects have been launched since then, decentralized exchanges (DEXs) like Uniswap or 0x, lending and borrowing platforms, like Aave or Compound, derivatives trading platforms like Synthetix, and more. All these protocols on Ethereum defined DeFi to what it is today, and has positioned itself as one of the most fast-evolving sectors in web3, providing an alternative financial system that is global, open, and accessible to anyone with an internet connection.

So, after this history lesson, you might have a good idea about what DeFi is, but let’s recap it. DeFi is a financial ecosystem that replaces traditional financial intermediaries with smart contracts. These smart contracts allow for a wide range of financial services such as lending, borrowing, trading, and earning interest in a decentralized, trustless environment. Unlike TradFi, where users rely on third parties to manage their assets, DeFi allows users to interact directly with protocols, retaining full control over their assets and transactions.

DeFi is trustless and transparent, eliminates the need for third parties, reduces costs and the potential for corruption or bias. This system is global and inclusive, anyone with an internet connection can access it. Interest rates in DeFi are more competitive and fair, determined by market dynamics instead of by centralized institutions with opaque decision-making processes. And as this ecosystem grows, we are seeing it mature, with better developed and sophisticated products and services, that can rival traditional finance in terms of transparency, fairness, and accessibility.

The DeFi Ecosystem

As we mentioned before, the DeFi ecosystem has been growing and evolving, fast. A wide range of financial services, with a whole spectrum of protocols on different chains. At its core, DeFi seeks to recreate and improve upon traditional financial services by using the transparency, security, and automation provided by blockchain. Already back in 2019, this ecosystem was thriving, just look at the amount of protocols during that time that were being built, you’ll recognize some, but a lot of them are defunct.

DeFi Ecosystem Ethereum December 2019

Now, let’s take a closer look at the major types of DeFi protocols, and their roles in the ecosystem

Major Types of DeFi Protocols

  • Stablecoins. Stablecoins are tokens that are pegged to the value of a fiat currency, such as the US Dollar, and provide price stability. They are used for all the other DeFi operations like trading, lending, borrowing, and other financial activities. Examples include DAI, which is decentralized and backed by assets locked in MakerDAO’s smart contracts, we call these algorithmic stablecoins. On the other hand, USDC by Circle or USDT by Tether, which are centrally issued and backed by actual reserves, which are called collateralized stablecoins.
  • Decentralized Exchanges (DEXs). DEXs are platforms that allow users to trade tokens without depending on centralized intermediaries. Uniswap is perhaps the most well-known example, the first to make use of automated market makers (AMMs) to facilitate trades. Other notable DEXs include SushiSwap, PancakeSwap (on Binance Smart Chain), and Raydium or Orca on Solana. Another type of DEX are orderbooks, such as dXdY in Ethereum. Solana was the one to make orderbooks on chain possible with Serum, that was later taken over by the community and relaunched as Openbook. You can find more information about the type of DEXs here.
  • Lending and Borrowing Protocols. Lending and borrowing platforms like Aave, Compound, Solend, or Kamino, allow users to lend their crypto to earn interest or borrow against them, as traditional financial institutions do with your funds but retaining full control. In this lesson, we will be covering lending and borrowing protocols in more depth, below.
  • Yield Farming/ Yield Aggregators. Yield farming and aggregation allows users to earn rewards by depositing their assets in different DeFi platforms. Yield aggregation involves providing liquidity to pools on DEXs or lending platforms in exchange for the best/ a combination of interests, while yield farming includes additional token rewards. Yearn Finance on Ethereum or Lulo on Solana have popularized this segment.
  • Liquid Staking. We covered this type of staking in Lesson 1 of the GREED Academy. This type of staking allows one to obtain liquid tokens of staked assets, that, like stablecoins, can be used as collateral or for other trading purposes instead of just being locked.
  • Synthetic Assets. Synthetic asset platforms like Synthetix enable the creation and trading of synthetic versions of real-world assets, that include commodities, stocks, and fiat currencies, these assets are backed by collateral. Synthetic assets allow users to gain exposure to traditional financial markets while being on-chain. These products are usually aimed at experienced individuals and veteran traders.
  • Derivatives and Prediction Markets. DeFi also includes platforms for derivatives and prediction markets. Derivatives platforms allow users to trade futures, options, and other financial contracts based on the value of an underlying asset. Prediction markets allow users to bet on the outcome of future events, with payouts determined by the accuracy of their predictions, the most popular is Polymarket. These products are usually aimed at experienced individuals and veteran traders.
Total Value Locked in Solana (source)

These are some of the major types of protocols on DeFi, but there are more and many in the pipeline to come soon. DeFi is one of the fastest growing sectors in web3, and so are the options, solutions and products that are launched.

DeFi on Solana

We have talked about DeFi in general, its history, and some of the major types and protocols. Ethereum and EVM ecosystems are the ones with most of the protocols, nevertheless, other chains like Solana have also been shining. Coming out as a major player in DeFi, offering a high-performance chain that is optimized for speed and low transaction costs, has made it an attractive platform for developers and users, leading to a growing number of protocols built on the chain.

DeFi Ecosystem on Solana (source)

Let’s cover some of the most important ones.

  • Jupiter continues to lead as Solana’s primary DEX aggregator, allowing users to swap tokens across different platforms at the best possible rates, with minimal slippage and optimized routes. You probably used it back in Lesson 2 to obtain $SAMO for the DAO task
  • Mango Markets offers a platform for margin trading, borrowing, and lending. It’s known for its high leverage, low fees, and ample offering of tokens, including the newest fungible tokens.
  • Solend is one of the most popular lending and borrowing platforms on the chain. Users can earn interest on their deposits or borrow against their assets while being fully permissionless, meaning that anybody can deploy their own pools.
  • Marinade Finance was one of the first to offer liquid staking on Solana, users can stake their SOL and receive mSOL, a liquid token that can be used across various DeFi protocols while still earning staking rewards. Their offering goes further, with staking pools and new alternatives for staking. We covered them in the first lesson of the GREED Academy.
  • Raydium is a major DEX on Solana, known for combining the features of an AMM with a traditional order book.
  • Orca is a user-friendly DEX, a popular choice for newcomers to DeFi.
  • Kamino Finance is a protocol that focuses on automated yield optimization for liquidity providers, helping users maximize their returns with various strategies.
  • Lulo (formerly Flexlend) aggregates yield across various platforms (Mango, Drift, Kamino, Solend and more), offering users a simple way to optimize returns on their assets with the best yield opportunities.
  • Texture is a platform that specializes in over-collateralized, fixed-duration, and fixed APY loans. Users can borrow tokens against collateral with no liquidation risks during the loan term, making it an attractive option for those looking to leverage their assets without the fear of forced liquidation. We will be covering them further in the next section.
  • Flash Trade is a decentralized spot and perpetuals exchange that allows users to trade with up to 100x leverage. Flash Trade also integrates gamification elements through its Flash Beast NFTs, which offer fee discounts and rebates to holders. This approach to trading makes Flash Trade an attractive option for high-volume traders.

These protocols represent just a snapshot of Solana’s DeFi ecosystem, which continues to grow quickly and is broad. Messari published a great report on the state of Solana in Q1 2024 that includes a lot of information about DeFi in Solana.

In this lesson we are going to be diving into one of the many segments of DeFi in more depth, borrowing and lending. This use case of DeFi is relatively familiar to the common individual, since loans are a product widely used, as compared to derivate trading or market making. In addition, we will be exemplifying with Texture Finance. We chose Texture for a deeper dive in this lesson, not just because of their new approach to lending, but also to show our appreciation for their support the first semester of the GREED Academy. Texture aligns with our values and made it easy to pick a lending protocol to feature them in this lesson.

Borrowing and Lending in DeFi

Borrowing and lending are central pillars of DeFi. In traditional finance, these activities are typically mediated by banks and financial institutions, with strict requirements, control interest rates, and determine who can access credit. DeFi, however, democratizes it and allows anyone holding crypto to participate. Users can deposit their assets into protocols to earn interest or use them as collateral to borrow other assets. This system provides new avenues for passive income and enables users to unlock liquidity without needing to sell.

Flow diagram of lending and borrowing (source)

Interest Rates and Risks

Understanding interest rates and the associated risks is extremely important for anyone participating in this activity. DeFi platforms generally offer two types of interest rates: fixed and variable. Fixed interest rates remain constant over the term of the loan, providing certainty for lenders and borrowers. Variable interest rates, on the other hand, fluctuate based on market conditions, which can offer opportunities for higher returns but also introduce greater risk. In DeFi, variable interest is the norm since high volatility and a lack of assurances limit offering fixed rates.

In DeFi, the terms APY (annual percentage yield) and APR (annual percentage rate) are commonly used. APY takes into account compounding interest, which can significantly increase returns over time. APR, on the other hand, does not include compounding and typically appears lower. Understanding these distinctions is extremely important in DeFi, since it helps make better decisions, but also many protocols inflate their potential returns to make them more attractive, these returns in APY might include other tokens native to the platforms, or calculations of APY based on short term returns that won’t give a good picture of the real APYs, that is why it’s always convenient to do research or even seek information in third party apps like DefiLlama that can breakdown these return.

For example, let’s say a DeFi platform advertises an APY of 20%, compounded daily. While this sounds attractive, the equivalent APR (without compounding) would actually be closer to 18.18%. The difference between the two rates might seem small, but it highlights how compounding can slightly increase returns over time, even when the nominal interest rate appears the same.

You can explore these differences further using an APY/APR calculator. This tool allows you to input various interest rates, compounding frequencies, and time periods to see how compounding affects your returns and to better understand the relationship between APR and APY.

Borrowing and lending in DeFi are not without risks. The potential for liquidation is an important concern; if the value of a borrower’s collateral falls below a certain threshold, the collateral may be sold off to repay the loan, this is known as a margin call, and happens often with market swings. Additionally, smart contracts introduce risk of vulnerabilities or exploits, which could lead to the loss of funds. And remember, market volatility can drastically affect both the value of collateral and the cost of borrowing, making it essential for users to carefully manage their positions.

You can read more about the fundamentals of DeFi borrowing in lending HERE.

Borrowing and Lending with Texture Finance

Texture Finance brings a new way of lending by offering overcollateralized, fixed-duration, and fixed APY peer-to-peer loans. What sets Texture apart from other platforms is its approach to managing loan terms and risks. Unlike most platforms where borrowers face the risk of liquidation if their collateral value drops, Texture eliminates this risk entirely during the 7-day loan term. This no-liquidation policy gives an advantage for users looking to borrow against their assets without the constant worry of market volatility and dumps that will trigger margin calls and automatic sell-off of their collateral.

Users borrow tokens by locking up their assets as collateral. The loan has a fixed duration of 7 days, during which the interest rate remains constant. Here’s how the process works:

  1. Borrowing. Users select the tokens they wish to borrow and lock up collateral tokens at a high loan-to-value (LTV) ratio. The protocol sets the interest rate, and the loan duration is fixed at 7 days. During this period, borrowers do not have to worry about liquidations, regardless of market conditions.
  2. Lending. Lenders provide liquidity by offering loans specifying LTV they want to lend at. Loans with the highest LTV are prioritized, ensuring these funds are utilized efficiently. Lenders earn interest on the amount they lend, and since there are no liquidations during the loan term, they can be assured that their loans will either be repaid with interest or they will receive the collateral if the borrower defaults.
  3. Repayment: At the end of the 7-day term, the borrower repays the loan plus the interest to regain access to their collateral. If the borrower does not repay, the lender automatically receives the collateral, effectively concluding the loan process.

Advanced Strategies

Texture also supports advanced strategies that can help users optimize their portfolios. For instance, users can leverage their positions by taking out high-LTV loans to increase their exposure to a particular asset. This strategy lets users potentially amplify their gains during good market conditions, while Texture’s fixed-duration term gives protection against short-term market volatility.

Another strategy involves using Texture for hedging. Users can borrow against their assets to protect themselves from market turns. If the market goes down, the borrower can choose to default on the loan, keeping the borrowed funds and avoiding further losses on their collateral. This approach can be very effective during periods of high volatility.

Texture allows users to create their own strategies, to hedge or profit from market swings, since it gives users flexibility, security, and opportunities to maximize their potential return.

Texture has a great guide that goes into depth on these strategies and logic HERE.

Step-by-Step Guide. Opening a Borrowing Position on Texture

Step 1: Connect your wallet. Visit texture.finance and click on the “Connect Wallet” button in the top right corner of the website.

Step 2: Navigate to borrow. Click on the “Borrow” tab. This guide will walk you through opening a borrow position, or in other words, requesting a loan on the platform.

Step 3: Select your token and collateral. On the main borrowing screen, you will see options to select the token you wish to borrow and the collateral you will use to secure the loan. Here are some key terms to understand:

  • Token to lock: This is the token you will use as collateral. You can select from a range of available tokens on the platform.
  • Token to borrow: Choose the token you wish to borrow, such as USDC or SOL.
  • Loan-to-value (LTV): The ratio of the loan amount to the value of the collateral. A higher LTV means you are borrowing closer to the value of your collateral.

Step 4: Execute the transaction. Once you are satisfied with the terms of your loan, sign the transactions. There are three transactions in total: account creation, deposit collateral and borrow tokens.

All transactions will be visible on an explorer, allowing you to track the process.

Step 5 (Optional): Repay or extend your loan. At any point, you have the option to repay the loan along with the accrued interest to reclaim your collateral. Alternatively, if needed, you can extend the loan by initiating a new borrowing process for another 7 days.

For detailed guides on borrowing and lending, visit the Texture Finance FAQ section.

Exam — Lesson 3

To complete this lesson, you will engage with Texture by opening a borrowing position following the instructions above. Follow the guide above on how to engage with Texture. Then you will have to submit the transaction ID of the borrow transaction in THIS LINK. You can find the transaction ID in an explorer as we have done in previous exams.

Note: This task is designed to familiarize you with the Texture Finance platform and the processes of borrowing and lending in a DeFi environment. There is not minimum for amount of capital to open the position, its at your discretion and should be small if you are just testing the waters.

For this lesson to be considered completed and to count towards your first semester rewards split, ensure you use the same wallet that you registered with (which should be visible on our leaderboard). Complete the exercise and submit it before 3PM UTC on Thursday, 29th of August. Good luck!

We hope you found this lesson insightful and engaging. Thank you for participating in the third lesson of the GREED Academy, and we look forward to seeing you in the next one.

Follow our Twitter to stay updated on your progress, view the leaderboard, and learn more about upcoming lessons. Consider staking with the GREED Validator to continue supporting educational initiatives in the crypto space.

--

--