Call Tables
On Dune, we parse all message calls and transactions made to smart contracts in their own tables.
Overview
On Dune, we parse all message calls and transactions made to smart contracts in their own tables. This allows us to isolate the logic of a specific smart contract and analyze how it interacts with other smart contracts.
The data is stored in the format:
[projectname_blockchain].[contractName]_call_[functionName]
This allows us to analyze how a specific function is used in a smart contract, and how often it is called, as well as how it interacts with other smart contracts.
Call tables always originate from the traces
table, which contains all the transactions and message calls on the Ethereum network. We parse the data
field of the traces
table to decode the function call and parameters.
Decoding
When a transaction is sent to a smart contract on the Ethereum network, it contains a data
field. This data
field is the encoded function call and parameters. Dune decodes this data and stores it in the corresponding table.
For example, when a transaction is sent to the Uniswap v3 factory contract on the Ethereum network, Dune will decode the data
field and store it in the table:
uniswap_v3_ethereum.Factory_call_createPool
Multiple Instances
For a contract where multiple instances exist, we will decode all calls to all instances of this smart contract into one table. If there are transactions calling the swap
function of any instance of the Uniswap v3 pair contract, we will decode this data into the table uniswap_v3_ethereum.Pair_call_swap
. The pair
contract is a template contract and there are many instances of it, each with its own address. The column contract_address
will indicate the address of the instance of the pair contract that was called.
Common misconceptions
One thing to keep in mind here is that web3.js, web3.py and all other methods of (locally) calling a pure
, read
, or constant
function do not broadcast or publish anything on the blockchain and are therefore not recorded in Dune.
However, if one of these functions is invoked by another smart contract in the context of a transaction, this will be broadcast on the chain and therefore accessible in Dune.
In short: State data stored in the memory of a smart contract is not available on Dune!
A good example of this is the function decimals
of the erc20 token contract Uni
which is a constant
state variable that is able to be accessed through an automatically created “getter function”. Should a smart contract invoke this function in the context of transaction, this message call will be recorded in the Dune table uniswap_ethereum.UNI_call_decimals"
.
This is in contrast to anyone calling this function locally using web3.py/web3.js or using the Etherscan frontend to access this state. These local calls are not recorded in Dune.
Further Reading
Was this page helpful?