EVM
On-chain Data Sources for EVM chains
Balance
Name: Balance
Type: integer
Gets the ETH balance of an address.
address
address
yes
source balance: integer = Balance {
address: 0xface...cafe
};
balance == 1000Call
Name: Call
Type: varies
Calls a function and gets the return value.
The type of this source and it's parameters are determined by the signature provided. See the Example tab for more info
contract
address
yes
signature
string
yes
params
tuple<varies>
depends on signature
eth
integer
no (default 0)
block
integer
no
If block is provided, the call will be made against the blockchain state in that block, instead of the current block.
This can be useful for example to make a call x blocks in the past, by providing
block: BlockNumber {} - x
source addresses: list<address> = Call {
contract: 0xface...ddad,
signature: "function getAddresses(uint256 id) returns (address[])",
params: tuple(1),
eth: 1024
};
addresses == list(0xface...ddadd, 0xcafe..1234)Events
Name: Events
Type: list<tuple<varies>>
Get the parameters of all events with a specific signature emitted by a contract in the evaluated block.
The type of this source depends on the signature of the event. See the Example tab for more information.
contract
address
no
signature
string
yes
withContract
boolean
no (default false)
The signature must match the event exactly.
Ensure
indexedfields are marked accordinglyEnsure there are no spaces in tuple types (
(int,address)and not(int, address))
With withContract: true, the source will also include the address of the contract the event was emitted from. This means the return type will change to list<tuple<address, tuple<varies>>>, where the outer tuple is (contract address, call arguments).
source transfers: list<tuple<address, address, integer>> = Events {
contract: 0xface...ddad,
signature: "event Transfer(address indexed from, address indexed to, uint256 value)"
};Calls
Name: Calls
Type: list<tuple<varies>>
Get the arguments of all function calls with a specific signature to a contract in the evaluated block
The type of this source depends on the signature of the event. See the Example tab for more information.
contract
address
no
signature
string
yes
withReverted
boolean
no (default false)
withSender
boolean
no (default false)
withContract
boolean
no (default false)
The signature must match the function exactly.
Ensure there are no spaces in tuple types (
(int,address)and not(int, address))
With withSender: true, the source will also include the address of the caller to the function. This means the return type will change to list<tuple<address, tuple<varies>>>, where the outer tuple is (caller address, call arguments).
With withContract: true, the source will also include the address of the contract the function was called in. This means the return type will change to list<tuple<address, tuple<varies>>>, where the outer tuple is (contract address, call arguments).
With withSender and withContract are true, the return type is :list<tuple<address, address, tuple<vaires>>> where the outer tuple is: (sender address, contract address, call arguments)
Historical Events
Name: HistoricalEvents
Type: list<tuple<varies>>
Get the parameters of all events with a specific signature emitted by a contract since genesis.
The type of this source depends on the signature of the event. See the Example tab for more information.
contract
address
no
signature
string
yes
withBlocks
boolean
no (default false)
withContract
boolean
no (default false)
blockWindow
integer
no
With withBlocks: true, the source will also include the block number in which each event happened. This means the return type will change to list<tuple<integer, tuple<varies>>>, where the first tuple is (block number, event params).
With withContract: true, the source will also include the address of the contract the event was emitted from. This means the return type will change to list<tuple<address, tuple<varies>>>, where the outer tuple is (contract address, call arguments).
With withBlocks and withContract are true, the return type is :list<tuple<integer, address, tuple<vaires>>> where the outer tuple is: (block number, contract address, call arguments)
The signature must match the event exactly.
Ensure
indexedfields are marked accordinglyEnsure there are no spaces in tuple types (
(int,address)and not(int, address))
With blockWindow set to some positive integer, the result will contain events from only the last blockWindowblocks.
Historical Calls
Name: HistoricalCalls
Type: list<tuple<varies>>
Get the arguments of all function calls with a specific signature to a contract since genesis.
The type of this source depends on the signature of the event. See the Example tab for more information.
contract
address
yes
signature
string
yes
withBlocks
boolean
no (default false)
withSender
boolean
no (default false)
withValue
boolean
no (default false)
blockWindow
integer
no
With withBlocks: true, the source will also include the block number in which each event happened. This means the return type will change to list<tuple<integer, tuple<varies>>>, where the outer tuple is (block number, call arguments).
With withSender: true, the source will also include the address of the caller to the function. This means the return type will change to list<tuple<address, tuple<varies>>>, where the outer tuple is (caller address, call arguments).
With withValue: true, the source will also include the ETH value of the call. This means the return type will change to list<tuple<integer, tuple<varies>>>, where the outer tuple is (value int, call arguments).
With withBlocks, withSender and withValue all true, the return type is :list<tuple<integer, address, integer, tuple<vaires>>> where the outer tuple is: (block number, caller address, value, call arguments)
The signature must match the function exactly.
Ensure there are no spaces in tuple types (
(int,address)and not(int, address))
With blockWindow set to some positive integer, the result will contain calls from only the last blockWindowblocks.
Storage Access
Name: StorageAccess
Type: varies
Fetches storage data from a contract, starting at a specific slot, and decode the data according to a given signature.
contract
address
yes
slot
bytes
yes
signature
string
yes
Storage Map Access
Name: StorageMapAccess
Type: varies
Fetches a value from a mapping in storage, given a key, starting at a specific slot, and decode the data according to a given signature.
contract
address
yes
slot
bytes
yes
mapKey
varies
yes
keySignature
string
yes
valueSignature
string
yes
Filter Addresses In Trace
Name: FilterAddressesInTrace
Type: list<address>
Given a list of addresses, only return the addresses that are active in this block (appear somewhere in the trace of a transaction)
This is useful when trying to run invariants on a large number of addresses.
The given addresses must come from a "historical" source (some deterministic manipulation over HistoricalEvents or HistoricalCalls)
addresses
list<address>
yes
State Root
Name: StateRoot
Type: bytes
Get the hash of the state root in a given block.
block
integer
yes
Storage hash
Name: StorageHash
Type: bytes
Get the the storage hash of a given contract on a given block. StorageHash is the SHA3 of the Merkle-tree root of a contact's storage.
block
integer
yes
address
address
yes
Block Hash
Name: BlockHash
Type: bytes
Get the hash of a specified block.
block
integer
yes
Last updated