Skip to content

Latest commit

 

History

History
93 lines (70 loc) · 6.88 KB

evm-calls.md

File metadata and controls

93 lines (70 loc) · 6.88 KB
description
The core EVM blockchain data collection

EVM Calls

Availability

{% hint style="success" %} This collection is available for the Ethereum, Polygon, Arbitrum and Base. {% endhint %}

Points-of-Presence Tables
eu-west-1

evm_calls_ethereum_mainnet_v1
evm_calls_arbitrum_mainnet_v1
evm_calls_polygon_mainnet_v1
evm_calls_base_mainnet_v1

Mapping rules

The table is wide and sparse. Each call's input and output is stored in a column named after its index in the input list and its derived type.

The column's name for a given input is derived as such: input_index_value_type.

The column's name for a given output is derived as such: output_index_value_type

{% hint style="info" %} We support calls with up to 12 inputs and 3 outputs. {% endhint %}

The mapping rules used to derive an input type from an ABI type are specified in the table below.

ABI Type Derived Type
address address
string string
bytes string
bytes<M> where 0 < M <= 32 string
bool uint8
uint8 uint8
uintX where 8 < X <= 32 uint32
uintX where 32 < X <= 64 uint64
uintX where 64 < X <= 256 uint256
int8 int8
intX where 8 < X <= 32 int32
intX where 32 < X <= 64 int64
intX where 64 < X <= 256 int256
address[] address_array
string[] string_array
bool[] uint8_array
uint8[] uint8_array
uintX[] where 8 < X <= 32 uint32_array
uintX[] where 32 < M <= 64 uint64_array
uintX[] where 64 < M <= 256 uint256_array
int8[] int8_array
intX[] where 8 < X <= 32 int32_array
intX[] where 32 < X <= 64 int64_array
intX[] where 64 < X <= 256 int256_array

{% hint style="info" %} Here is how we store the various inputs and outputs of the transfer function:

transfer(recipient address, amount uint256)(ok bool)

  • recipient value is stored in the column input_0_value_address
  • amount value is stored in the column input_1_value_uint256
  • ok value is stored in the column output_0_value_uint8 {% endhint %}

Table Schema

Column NameColumn TypeDescription
chain_namestringName of the chain (ethereum, arbitrum, polygon, ...).
chain_network_namestringname of the network (mainnet).
block_hashstringBlock hash encoded as binary string
block_numberuint64Block height
block_indexuint32Index of the call in the block
transaction_indexuint32Index of the transaction in the block
transaction_statusuint32Status of the transaction
timestampdatetimeUNIX timestamp for when the block was collated
signaturestringSignature of the event as defined per the ABI spec (transfer(address,uint256))
fullsigstringSignature of the event as defined per the ABI spec with the addition of the indexed modifier (transfer(address,uint256)(bool))
fromstringAddress of the caller
gasuint32Number of gas used during the call
valueuint256Amount of native token sent to the contract
call_typestringThe type of method used (call, delegatecall, staticcall, ...)
subcallsuint32The number of traces below this one in the call stack
call_addressuint32[]The position of this trace in the call stack
errorstringThe error returned during the execution of the method, if any
input_index_value_typeContent of the input at index
output_index_typestringABI type of the output at index
output_index_value_typeContent of the output at index

Usage

The below query make use of the evm_events_ethereum_mainnet_v1 table to report on gas usage per each method of the ShibaInu-ETH Uniswap V2 pair.

We compute the total gas used and average gas used for each method called since genesis.

The result is sorted by decreasing total gas used value.

select 
    signature,
    sum(gas) as total_gas,
    avg(gas) as avg_gas,
    count(*) as total_calls,
    countIf(error <> '') as total_errors
from evm_calls_ethereum_mainnet
where to = '0x811beEd0119b4AfCE20D2583EB608C6F7AF1954f'
group by signature
order by total_gas DESC