The DeFi ecosystem has been bursting with innovation as the community continues to build new primitives, assets, and rails which promises greater value creation. This article is my attempt to contextualise all the innovation that has been happening in the space by framing each protocol within the wider DeFi ecosystem.

Specific to DeFi, the stack is made up of 8 distinct layers:
- **Analysis: **Applications and tools which help to make sense of blockchain transaction data. These are read only applications which help to increase transparency in the space.
- **Wallets: **User owned wallets which stores and manages the private keys of the user. These self-custodial wallets enable signing of transactions as well as user interaction with the DeFi protocols.
- **Optimisers: **A set of applications which build on top of DeFi primitives in order to maximise returns through implementing specific strategies.
- **DeFi Primitives: **The building blocks of the DeFi ecosystem whereby each protocol offers a specific financial function. These primitives can be easily combined with other primitives.
- **Oracles: **Data providers that enable DeFi protocols to ingest external data for logic processing within their smart contracts.
- **Assets: **The item/thing which is being traded within the DeFi ecosystem, usually represented in the form of a token(ERC20/721).
- **Cross-Chain Bridges: **Protocols that enable assets to be securely moved across various chains.
- **Transaction Settlement: **The base layer for DeFi where all transactions are finalised and secured.
The sections below outlines the components of each layer by elaborating on its use case, underlying concept, as well as the ecosystem benefits. Components are ordered by ease of readability. Additionally, a non-conclusive list of protocols are provided as reference implementations for each component.
If you would like a more generalised approach that looks at the Web3 space as a whole, please refer to:
Assets

Stablecoins
**Use Case: **Tokens whose value is pegged to a particular value reference. At present, majority of stablecoins are pegged to the USD due to its status as a global reserve currency. Macroeconomic and political factors will likely result in a multi-stablecoin future as nations vie for liquidity.
**Underlying Concept: **Stablecoins are usually minted/burned based on a collateralisation ratio of a basket of assets. These assets determine the trust assumptions of the stablecoin and can range from fiat/assets being held in a tradFi account (USDC, USDT, PAXG) or crypto assets/tokens (DAI, TUSD, FRAX). Stablecoin protocols are able to set a target collateralisation ratio in order to drive capital efficiency.
**Ecosystem Benefits: **Stable unit of accounting; Borrowed trust from tradFi for fiat-backed stables; Target peg is intuitive due to historical precedent
**Protocols: Tether, **Circle, Binance, Paxos, Maker, Frax, Ampleforth

Tokenised Assets
**Use Case: **Representation of financial assets on the blockchain. This can be blockchain native assets where the asset is fully described by the blockchain or a tokenised representation of an asset that is external to the blockchain. In the latter case, an oracle or trusted party is required to bridge the asset into the blockchain. Note that tokens can represent anything and everything as it is just tokenised data units.
**Underlying Concept: **Majority of tokens will be defined by a smart contract which describes the token as either a fungible token (ERC20) or a non-fungible token (ERC721).
**Ecosystem Benefits: **Digital asset accessibility; Settlement and registrar process optimisation; Transaction transparency; Fresh liquidity based on new token valuation; Effectively real-time finality
**Protocols: **Propy (property), Polymath, Purplefi, Maecenas (physical art), Yuga Labs, Dapper Labs, Sky Mavis

Liquid Staking
**Use Case: **Added flexibility to cash flows by enabling users to utilise the value locked in staked funds. Users can still earn the rewards from staking while gaining liquidity.
**Underlying Concept: **Proof-of-Stake tokens are provided to a liquid staking provider which then pools the funds to be staked on the protocol. Users receive a token representing their share of the staked funds which can then be utilised for other purposes.
**Ecosystem Benefits: **Lowers minimum capital cost of staking; Incentivises larger staking volume which improves protocol security; Adds liquidity to essentially dormant funds; Flexibility in determining value flows
**Protocols: **Lido, Rocket Pool, Ankr
DeFi Primitives

AMM DEXes
**Use Case: **Non-custodial token swaps. New trading pairs can be created as long as the token contract adheres to the ERC20/ERC721 standards. The DEX relies on external arbitrageurs and oracles to determine token price ratios. Liquidity is provided by market makers who provide their tokens to the smart contract in return for a cut of trading fees.
**Underlying Concept: **Token liquidity pools are defined by a smart contract which manages the ratio of tokens held by the contract. Token deposits, trades, and withdrawals are effected along a price curve (constant function market maker) which ensures the stability of the pool. This enables market making to be automated which led to mechanism being known as an Automated Market Maker (AMM).
**Ecosystem Benefits: **No limitations on trading pairs (including stablecoins); Instantaneous liquidity along custom price curve; Automated yield generation for market makers; Lower fees for stable pairs
**Protocols: **Uniswap, Curve, SushiSwap, Bancor, Balancer, PancakeSwap

Orderbook DEXes
**Use Case: **Traditional orderbook trading process for swapping tokens. In addition to the traditional order matching, most orderbook DEXes will also search for opportunities for orders to be settled on AMM DEXes.
**Underlying Concept: **Orders are signed (cryptographically committed) by the user and distributed across a network of counter-parties. The order is comitted on-chain once a counter-party is found. Orders have to be matched off-chain due to gas costs of settlement.
**Ecosystem Benefits: **Intuitive swap model based on historical precedent; Able to set target prices; Less slippage risks
**Protocols: **0x, Loopring, Serum

Marketplaces
**Use Case: **Marketplaces which facilitate the peer-to-peer discovery and trading of assets. The asset traded usually takes the form of NFTs (Non-Fungible Tokens) whereby each asset is unique and therefore requires significant amount of information and price discovery.
**Underlying Concept: **Sellers are able to list NFTs for sale together with all the additional details required for a product page. Buyers can then browse and determine the NFTs which they will want to purchase. A marketplace smart contract facilitates the trade, either upon immediate purchase or on auction close.
**Ecosystem Benefits: **Convenient listing and discovery process; Increased transparency across assets in the same collection
**Protocols: **Opensea, Rarible, Mintable, SuperRare

Collateralised Lending
**Use Case: **Borrowing and lending of crypto assets. Crypto providers are able to earn an interest by depositing crypto to a specific pool. Borrowers are able to take out loans by collateralising crypto. By allowing collateralisation and lending across various cryptos, users are able to mix-and-match their current and borrowed assets according to their liquidity preferences.
**Underlying Concept: **A lending contract defines the asset to hold in reserve as well as the share of each borrower/lender. The interests paid to lenders or paid by borrowers is dynamically determined based on a combination of market mechanisms and protocol governance targets. Utilisation and collateralisation ratios can be used to improve capital efficiency.
**Ecosystem Benefits: **Additional liquidity generated from utilising dormant assets (i.e. leveraging); No need to sell assets to generate yield; Creation of liquidation markets
**Protocols: **Aave, Compound, Cream, Salt

Flash Loans
**Use Case: **Uncollateralised lending of crypto assets that enables profit making strategies via stacking multiple strategies into a single Ethereum transaction. This is possible as transaction finality is dependent on block times which enables loans to be taken and paid back within the same block. The trade can be dropped if the transaction turns out to be unprofitable. In the case of a profitable trade, the protocol charges a fixed fee for the flash loan.
**Underlying Concept: **A flash loan contract defines the loan terms as well as strategy to implement. The flash loan contract will have to interact with a variety of other DeFi products to achieve profitability (loans, DEXes, aggregators). All flash loan strategies are grouped into a single transaction which is atomically processed by the network.
**Ecosystem Benefits: **Instantaneous liquidity; No collateral required with no default risks; More stability due to instantaneous arbitrage
**Protocols: **Aave, Defi Saver, Furucombo

Insurance
**Use Case: **Risk management of assets by purchasing insurance coverage in the event of asset loss (hacks, smart contract bug, etc.). Underwriters are able to select protocols/events to underwrite in exchange for a fee. Based on the insurance pools, a user is able to insure themselves by paying a premium to that pool. Payout determination can be either through a voting process or event driven code.
**Underlying Concept: **A smart contract defines the risk to be insured as well as conditions for claims/payouts. Funds, including premiums, are deposited to the contract thereby enabling the respective pool share to be determined.
**Ecosystem Benefits: **Enable more fine-grained management of risks; Increases trust due to loss minimisation; Creates an insurance market whereby undertakers are able to fund projects based on their relative confidence in the project
**Protocols: **Nexus Mutual, Unslashed, Insurace, Solace, inSure

Bonds
**Use Case: **Fixed income by lending assets to a protocol treasury. The asset loaned need not be the protocol token and is determined through treasury governance. Similarly, interest payments are not limited to just the protocol tokens.
**Underlying Concept: **Smart contracts are utilised for storing tokens within the treasury as well as implementing rules based on governance votes. Token bonds are unlocked and claimed when matured.
**Ecosystem Benefits: **Incentivises protocol-owned liquidity which leads to improved trust in the protocol token; Treasury reserves can be allocated based on DAO governance
**Protocols: **Olympus

Derivatives
**Use Case: **Creates a market for hedging, leveraging, or downward speculation. Through more advanced strategies, users are able to manage their risks as well as maximise their potential rewards through derivative assets such as futures, perpetuals, synthetics, options, and rate swaps.
**Underlying Concept: **Majority of derivative implementations involves the creation of a token representing the derivative. Given the pseudonymous nature of DeFi, these assets are usually created upon the smart contract securing funding (i.e. collateral). The derivatives are then free to be traded while the protocol is protected from insolvency through a liquidation market.
**Ecosystem Benefits: **Exposure to price movements of any asset (i.e. a synthetic asset that tracks the price of a stock); Enables short selling; More fine-tuned risk management options
**Protocols: **DYDX, Synthetix, Opyn, Perp, Barnbridge
Optimisers

DEX Aggregators
**Use Case: **Routing of trades via multiple DEXes to get the best combination of effective price as well as lowest transaction cost. DEX aggregators exist as different DEXes will have different prices for the same token pair at any one point in time.
**Underlying Concept: **The DEX aggregator queries multiple DEX protocols based on the trading pair requested. By filtering and sorting the potential trades, the DEX aggregator can discover the most optimal path for a trade. This includes the transaction gas fees as well as the transaction fees for each token hop.
**Ecosystem Benefits: **Swaps are routed based on the best rates; Liquidity is spread across DEXes based on actual trade value; Incentivises price stability across DEXes
**Protocols: **1inch, Matcha, Slingshot, Paraswap

Yield Vaults
**Use Case: **Auto-compounding of liquidity provision to maximise potential gains while minimising costs of interacting with DEX smart contracts. There are varying vault strategies that result in different expected returns based on risk tolerance. Vaults are able to increase yields via protocol rewards, leverage (via borrowing), and also alternative streams of income.
**Underlying Concept: **A vault contract defines the strategy which will be implemented. Liquidity providers from the specified pool are able to delegate their liquidity share to the vault contract. The contract manages the liquidity and auto-compounds rewards for the user.
**Ecosystem Benefits: **Increased capital efficiency and yields; Reduced exposure to reward tokens; Reduced liquidity management transaction fees
**Protocols: **Yearn, Beefy, Autofarm, Homora

Governance Boost
**Use Case: **Maximise returns by controlling the allocation of fees and votes of the underlying DEX protocol. This is possible as majority of DEX protocols stream rewards to different liquidity pools based on token votes.
**Underlying Concept: **Users are able to lock their liquidity provider tokens from the underlying protocol with Convex/Ellipsis. This entitles them to gain a share of Convex trading fees as well as additional rewards via the reallocation governance votes (see Curve Wars for more info).
**Ecosystem Benefits: **Creates a fee and voting market on top of a base protocol which brings in new liquidity; Yield maximisation through compounding rewards
**Protocols: **Convex, Ellipsis
Cross-chain Bridges

**Use Case: **Enable swapping of assets across different chains. Most bridges has the added functionality of DEXes which aids in the swapping of assets across different chains.
**Underlying Concept: **Most implementations involve a cross-chain messaging protocol which enables assets to be bridged across chains. This bridging can be achieved via wrapped assets where the asset on the origin chain is locked by a smart contract. Alternatively, cross-chain assets can also be sourced via stableswap pools.
**Ecosystem Benefits: **Exponentially more trade volume based on opportunities for cross-chain swaps; Instantaneous liquidity across chains; Prevents value lock-in at the settlement layer
**Protocols: **Multichain, RenBridge, Rubic, Synapse, Umbria