How to calculate APY for Compound V3 Rewards

Introduction

Annual Percentage Yield (APY) is a critical metric for evaluating the returns on investments in DeFi protocols. In Compound V3, calculating the APY for COMP rewards involves understanding the reward rates and their impact on supply and borrow activities. If you want to understand how the rewards system works for Compound V3, please checkout this post. In this post, lets explore the method to calculate the APY for COMP rewards in Compound V3 with detailed examples.

Understanding APY Calculation

APY measures the real rate of return on an investment, taking into account the effect of compounding interest. For COMP rewards in Compound V3, the APY calculation involves several steps:

  1. Gathering Key Variables:
    • baseTrackingSupplySpeed and baseTrackingBorrowSpeed: These indicate the speed at which COMP rewards are accumulated for supply and borrow activities, respectively.
    • baseIndexScale: The scaling factor for the indexes.
    • totalSupply and totalBorrow: The total amount of assets supplied and borrowed in the protocol.
    • Prices of COMP and USDC in USD to convert values into a common unit.
  2. Daily Reward Calculation:
    • Calculate the daily COMP rewards for both suppliers and borrowers.
    • For suppliers:
    • For borrowers:
  3. Converting to APY:
    • Convert the daily reward rates into APY using the formula for compounding interest:
    • Similarly for borrowers:

Example Calculation

Let’s go through an example to illustrate the calculation of COMP reward APY:

  1. Given Data:
    • BaseTrackingSupplySpeed: 1,747,685,185,185 COMP per second
    • COMP Price: $54.17
    • Total Supply: 550,801,738 USDC
    • USDC Price: $0.99998462
    • baseIndexScale: 1e15.
    • seconds per day: 86,400.
    • days in year: 365.
  2. Daily COMP Rewards for Suppliers:
  3. Calculating APY:

Conclusion

By understanding the detailed mechanics of the Compound V3 rewards system and the method for calculating APY, users can make informed decisions about their lending and borrowing strategies. This in-depth knowledge helps in maximizing returns and optimizing participation in the protocol.


Discover more from BitsByBlocks

Subscribe to get the latest posts sent to your email.

Discover more from BitsByBlocks

Subscribe now to keep reading and get access to the full archive.

Continue reading