RobinNagpal / dodao-ui

https://y-tau-beryl.vercel.app
GNU Affero General Public License v3.0
5 stars 3 forks source link

Dune Analytics for Compound Users #211

Open RobinNagpal opened 5 months ago

RobinNagpal commented 5 months ago

Background

Compound V3

ALIRAZA17 commented 5 months ago

Some Important links to read Techniques for fetching the data: https://docs.dune.com/data-catalog/evm/ethereum/decoded/overview How decoding works: https://docs.dune.com/data-catalog/evm/ethereum/decoded/call-tables Storage Structure of Dune: https://docs.dune.com/query-engine/writing-efficient-queries

ALIRAZA17 commented 5 months ago
SELECT
  "from" AS wallet_address,
  SUM(amount) AS total_supplied
FROM
  compound_v3_ethereum.Comet_evt_Supply
WHERE
  evt_block_time >= (CURRENT_TIMESTAMP - INTERVAL '1' day)
GROUP BY
  "from"
ORDER BY
  total_supplied DESC;
ALIRAZA17 commented 5 months ago
SELECT
  "src" AS wallet_address,
  SUM(amount) AS total_withdrawn
FROM
  compound_v3_ethereum.Comet_evt_Withdraw
WHERE
  evt_block_time >= (CURRENT_TIMESTAMP - INTERVAL '1' day)
GROUP BY
  "src"
ORDER BY
  total_withdrawn DESC;