A Framework for Analysing and Understanding DeFi Protocols

A Framework for Analysing and Understanding DeFi Protocols

Enabling web3 developers and product owners to gain a deep understanding of DeFi protocols, and possibly extend some of the ideas they learn to designing and building theirs.

Photo by Kaleidico on Unsplash

DeFi protocols are algorithmic agents that facilitate financial transactions on the blockchain. Their autonomous behaviour requires that they are designed to perform their functions predictably using concepts from Financial Mathematics, Economics, and of course, Algorithms. The imbuing of these concepts into DeFi protocols has inadvertently made them very complicated, and sometimes hard to understand especially for folks who are unfamiliar with them.

Having a framework for navigating various DeFi protocols would not only help us understand them, but it would also help us see common patterns across these protocols. Furthermore, having a framework can also come in handy when trying to spot design loopholes or recognise areas that can be improved in the design of a protocol.

I came up with this framework while trying to gain a deeper understanding of different DeFi protocols during my day job and also during my study times. I decided to share it with others to provide a narrative to follow whenever they are trying to understand, design, or build a DeFi protocol. While the ideas in this framework apply to DeFi protocols, they can also be extended to understanding blockchain protocols in general.

The following points outline the framework for analysing and understanding DeFi Protocols.

Step 1: Start with a General Introduction

The general introduction of a DeFi protocol is where you'd find a high-level description of what the protocol is about; this would typically be a short sentence that describes what the protocol is about. In addition to this, the general introduction would also highlight the key features of the protocol, define some commonly used technical terms in the protocol, a few concerns to pay attention to when using the protocol, the blockchain network that the protocol supports, and in some cases, links to the deployments of the protocol.

For most protocols, the general introduction can be found in the Introduction or Getting started section of the protocol's documentation. The Introduction section of the protocol's white paper would also give a deeper explanation of the protocol. The final, and possibly most unapparent places to find a wholesome introduction to a protocol would be in the protocol's security audit reports. Although this highly depends on the audit firm, audit reports provide an excellent overview of a protocol, and they explain high-level information about a protocol's mechanisms, and how the protocol's key components interact.

Having a good understanding of what a protocol is and how it works provides a solid foundation for deep-diving into other key parts of the protocol. There are many sources to get a basic understanding of a protocol as highlighted above, and consulting two or three of these sources would be a great start.

Step 2: Deep dive into the Protocol's Architecture

Having gained enough understanding of a protocol, the next step is to take a deep dive into the protocol's architecture. A protocol's architecture explains the protocol's mechanics – the components of the protocol and how they interact. Generally speaking, a protocol's architecture would be classified into three areas: Core Components, Protocol Math, and Protocol Algorithms. Each of these areas contributes significantly to how the protocol works. I will be going into more detail about each of these areas in the points that follow.

  • Core Components
    The core components of a protocol are the low-level smart contracts and integrations that power its mechanism. These smart contracts may be categorised based on their functionalities, depending on the protocol design, however, they are responsible for how the protocol functions.

    For example, UniswapV2's core components are separated into two modules: v2-core and v2-periphery. The v2-core contains UniswapV2Pair.sol which holds all the logic of a liquidity pool and the UniswapV2Factory.sol contract which is used to deploy new pair contracts. The v2-periphery contains the UniswapRouter which makes it easy to interact and integrate with the Uniswap protocol.

    A protocol's core components do not always have to be stand-alone implementations; in some designs, they can be integrations with other protocols. A fine example of this is Alchemix's vault adapters. Alchemix is a self-repaying loan protocol. The loans that users take from the protocol are repaid by investing the user's collateral to generate yield on other yield aggregation platforms. Alchemix integrates with these yield-generating protocols via vault adapters. These vault adapters are parts of the core components of the protocol even though the protocol also has some other stand-alone components.

    The point here is that the core components of a protocol can either be stand-alone or, integrated with other smart contracts or both, depending on the protocol. The implementation of these contracts provides even deeper insight into how the protocol works and spending some time understanding them would be valuable. However, just having a basic understanding of the function of each smart contract is just about enough to get started.

  • Protocol Math
    The backbone of DeFi protocols is the Math that powers them. A protocol would rise or fall depending on how good its financial model is. The financial models use Math to model the behaviour of the assets and markets in the protocol. The kind of financial model that would be used by a protocol largely depends on the area of finance the protocol operates in.

    For example, a protocol operating in a decentralised finance market would be using a financial model such as the Constant Function Market Maker (CFMM), which uses a continuous trading function to model market behaviours such as price impact, impermanent loss, trading fees, asset price, etc. The Constant Product Function Market Maker is a variant of the CFMM made popular by the decentralised exchange, Uniswap. Other financial models have also been designed for use in the decentralised exchange market; Balancer uses the constant mean market makers model which uses the geometric mean trading function, Curve Finance uses a combination of sum and geometric mean functions, and Swaap Finance uses its Matrix Market Maker model.

    As another example, if a protocol operates in the lending market, its financial models would include models commonly used in the traditional lending market such as utilisation rate models, borrow and supply rate models, liquidation models, and interest rate models. Aave and Compound are two protocols that have popularised some financial models for the lending market in the DeFi space.

    The protocol math used in various protocols is a financial model that is used to formally specify the behaviour of the protocol, thereby making the protocol formally verifiable. Having a good understanding of a protocol's math would contribute to your understanding of how the protocol works.

  • Protocol Algorithms
    Some DeFi protocols have certain algorithms that are peculiar to their protocol mechanism. An example of this is Sushiswap's MasterChef algorithm. The MasterChef algorithm distributes a constant number of rewards per block to liquidity providers that stake tokens within the contract. This algorithm has been used in several other protocols as well to manage their reward-distribution logic.

    There are a few other algorithms used in various protocols across the DeFi space. Most of them are often embedded in the various smart contracts and can only be discovered when you dig deep through the protocol's codebase. Protocol algorithms essentially handle some core logic in a protocol. This could include reward distribution, price calculation, fee distribution, etc. Having a great understanding of a protocol's algorithms would definitely go a long way in understanding how the protocol works.

Step 3: Checkout the Smart Contract Integration

The next step to take after spending some time digging deep into the core components of a protocol is to explore the peripherals of the protocol. The peripherals of a protocol are just as important as the core components of the protocol. The peripherals are what create a community around the protocol and also create a robust user and developer experience.

The first periphery of a protocol to pay attention to is its support for smart contract integration. Most protocols provide a guide for smart contract integration in their developer documentation. The key benefit of providing an interface for other smart contracts to integrate with your protocol is that it boosts composability. This means other protocols can build their products around your protocol, and that's a smart thing to do. However, composability also comes with security risks as attackers can exploit some vulnerabilities in the smart contract if there are any.

When checking out a protocol's smart contract integration support, it's important to look out for the interfaces that the protocol provides, follow the best practices for integrating with the smart contracts as specified by the documentation, and evaluate the risks of integrating with the protocol's smart contract.

Step 4: Assess the Protocol's Governance System

As mentioned above, the peripherals of a protocol create a community around the protocol; that is what a protocol's governance system is about; therefore, it's worth paying attention to when trying to understand a protocol.

A governance system provides a way for a protocol's community to decide on the future of the protocol by allowing members of the community to participate in governance by voting on proposals. I won't be going too deep into governance systems in the DeFi space, but I'll give some context. A governance system would centre around two things: The governance token and the governance mechanism.

A governance token is a token that delegates voting rights and voting weight to a token holder. Holding a governance token means that you can vote for or against governance proposals such as protocol upgrades, adding new features, etc. The more governance token a user holds, the higher their voting weight, and eventually the more influence they wield in the governance system.

A governance mechanism is how governance is executed on a protocol. This would include a series of tools and platforms that allow token holders to participate in governance, instructions on how governance proposals should be created, instructions on how token holders can vote on proposals, etc. The tools and platforms used in a governance system would include a forum for creating, exploring, and discussing governance proposals, a portal for voting and delegating voting rights to other token holders, and a system that executes the proposals that successfully pass through the review and voting stages.

When analysing a protocol, these are the things that you should keep in mind: you want to quickly identify whether or not the protocol has a governance system in place. If it does, you want to check its governance token and find out more about its governance mechanism. Most protocols with a governance system have details about them in their documentation. You can check out Compound's governance system as an example.  

Step 5: Seek out the Protocol's Incentive Mechanisms

Incentive mechanisms are methods by which protocols reward their users for their contributions to the protocol. Most incentive mechanisms in DeFi are built around yield farming and liquidity mining strategies. These strategies are created to allow users to earn a profit (yield) on the assets they have supplied to the protocol.

Alchemix protocol, for example, has a yield farming strategy that allows users to earn rewards by providing liquidity to their ALCX/ETH market in SushiSwap. This means if a user increases the liquidity of ALCX by providing ETH to the ALCX/ETH pool on SushiSwap so that other users can easily swap ALCX for ETH, the user receives a reward. So one way for users to earn rewards generally in DeFi is to support protocols by providing them with more liquidity.

Another example of a protocol that provides incentive mechanisms to users is ConvexFinance. Convex allows users to earn staking and liquidity provider rewards such as trading fee rewards, platform fee rewards, governance token rewards, airdrops, etc., on their Curve LP tokens by depositing them into convex pools.

Protocol incentives are peripherals of a protocol that keep users coming back to the protocol through rewards. When analysing a protocol, the protocol reward is definitely an area worth paying attention to, to understand why the protocol is enjoying plenty of community support, or not.

Step 6: Evaluate the Protocol's Tokenomics

A protocol's tokenomics is often tightly coupled with its incentive mechanisms. This ensures that the incentive mechanism aligns with the protocol's long-term goals. A protocol's tokenomics highlights the parameters that determine the economic behaviour of its tokens. Some of those parameters include token type (governance token or utility token), token standard (ERC20, ERC 721), token allocation, token supply, soft cap and hard cap, token emission rate, incentive mechanisms, etc.

It's important to understand a protocol's tokenomics because it provides a lot of information about the risks of investing in the protocol, the relevance of its token within and beyond the protocol's ecosystem, and of course the long-term vision of the protocol. Information about a protocol's tokenomics can be found in the protocol's documentation or occasionally in the protocol's white paper.


Getting started in the DeFi space can be quite overwhelming as there's a lot of information to absorb about the different protocols in the space. Therefore, I wrote this article to provide a guide for anyone who's looking to get started on learning more about various protocols in the space, and I hope it does that.