Here's a short five-step guide to getting familiar with a protocol and figuring out how to query around it. Assuming you've chosen a protocol to look into...
Look at the protocol app page/docs and try to figure out what the main user entry point function is. Sometimes this is straightforward, but different contract patterns on more complex protocols will make this confusing.
Deposit. If the contract isn't decoded yet, you can start with some raw queries for finding the most common function and event signatures here:
Dune Utility Queries
Table Mapping Guide
Once you figure out the entry point, run a basic LIMIT query on it and look at some example transactions in etherscan for data hints (i.e. what protocols did the tx interact with besides the main one)
SELECT * FROM protocol_name."Contractname_evt_EventEmitted" LIMIT 10
evt_tx_hashand plop it into etherscan
If you already have a question in mind, then skip this step. If you don't have a question yet, think through the flow chart of contract interactions. Here are some starter questions to help you find something interesting to look into:
Now that you have settled on a question, the real fun begins. I'm sure you'll quickly notice that the function call data and event log data don't always have all the parameters you're looking for. The usual culprits that are missing are the transaction signer (found in
ethereum."transactions" ) and the ETH value transferred (found in
ethereum."traces"). Typically you'll have to work with the base tables (transactions, traces, logs) and possibly tables from other protocols (like DEX/exchange protocols) to complete the data you need for your query.
Lastly, you should visualize the query in a chart by clicking "New visualization" next to "Query Results".
If you're showing token amounts, you likely have to fix for decimals or multiply by token price (in
dex.trades) to get to a USD value which is more interpretable.
Now If this makes sense to you, take a look at the PoolTogether dapp and try going through this flow. Your goal is to answer the question (or come up with another one):
toaddress is not the depositor address).
If you get stuck, take a look at the focus group recording (this is extra content, linked in the Mirror post).