How to calculate USDC TVL on Compound

What is the total value locked of USDC stablecoin on the Compound protocol?

To begin answering this question we need two things:

  1. The contract address of the cUSDC pool on Compound: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
  2. The contract address for USDC: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

We can answer this question by leveraging Flipside’s `ethereum.erc20_balances` table. This table records the daily balance for every “user” of a contract. Keep in mind a “user” could be an actual person, or in this case another contract. In this example we’re looking to understand the amount of USDC held by the cUSDC address. 

Let’s compose our query:

We compute the balance of USDC held by the cUSDC address each day, otherwise known as TVL. We also include the token label and pool name in the select statement, which leverages Flipside’s labels.

Let’s graph these results to visualize them over time:

These results can also be exported via CSV or accessed via an auto-updating API endpoint. 

View the full results here: https://velocity-app.flipsidecrypto.com/shareable/compound-dai-tvl-DPT9qe

Signup for free and answer your own questions here.

Share This Post on Social Media
Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn