Changes in token approvals for ERC721 contracts
Chains supported: Ethereum, Base, Arbitrum (post Nitro)
Block-level table
For efficiency, we only emit one record per block for each
(token_address, token_id)
pair. If there are 2+ changes for the same pair in a given block, we emit the last one. This more efficiently serves queries where you want to know state after a given block, but precludes queries that need intra-block (i.e., transaction-level) state.
Schema
Column Name | Data Type |
---|---|
chain_id | long |
txn_hash | string |
block_number | long |
block_timestamp | long |
token_address | string |
token_name | string |
token_symbol | string |
owner | string |
token_address_owner_hash | string |
is_for_all | bool |
token_id | bigDecimal |
token_address_id_hash | string |
approved_address | string |
operator | address |
approved | bool |
Source
This table was built in sim's ERC721 Owner Changes Block canvas.
Usage notes
There are two types of approvals for ERC721:
approve(address to, uint256 tokenId)
grants permission to a single address to transfer a specific NFT, identified by its ID. Approve records will haveis_for_all = false
and the details of the approval specified intoken_id
andapproved_address
. The two remaining columns,operator
andapproved
, take default values and should be disregarded for this case.setApprovalForAll(address operator, bool approved)
grants or revokes permission to an operator address to manage all of the caller's NFTs. In this case,is_for_all = true
and the operator is defined inoperator
. Ifapproved = true
then the record corresponds to the granting of an approval. Ifapproved = false
, the record corresponds to the removal of an approval.
This column contains two composite index columns to improve performance for queries:
token_address_owner_hash
is the keccak256 hash(token_address, owner)
. Use in queries where you would otherwise filter on(token_address, owner)
.token_address_id_hash
is the keccak256 hash(token_address, token_id)
. Use in queries where you would otherwise filter on(token_address, token_id)
.