Event signature · Token standards

ApprovalForAll event signature and topic0

The topic0 of the ApprovalForAll event is 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31, the keccak-256 hash of ApprovalForAll(address,address,bool); 2 of its 3 arguments are indexed. Operator approved for every token (ERC-721 / ERC-1155).

Anatomy of a ApprovalForAll log

Topics

  • topic00x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31keccak256("ApprovalForAll(address,address,bool)")
  • topic1owner (address)indexed: filterable
  • topic2operator (address)indexed: filterable

Data

  • dataapproved (bool)ABI-encoded, decoded with the ABI
Parameters

Arguments and where they sit in the log

Indexed arguments travel as topics and can be filtered cheaply; the others are ABI-encoded together in the data.

NameTypeIn the log
owneraddresstopic1
operatoraddresstopic2
approvedbooldata

Solidity declaration

event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

Canonical signature

ApprovalForAll(address,address,bool)

topic0

0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31

Ready-made alerts

Get an alert on ApprovalForAll

Each rule opens with the contract and the conditions filled in. Sign in, pick your chat and click Create.

Who emits it

Contracts we list that emit ApprovalForAll

Any other contract with the same signature emits a log with the same topic0.

Code

Read ApprovalForAll logs in code

The same filter in viem, ethers and plain JSON-RPC, and the Solidity that emits it. The address is Bored Ape Yacht Club, a contract we list that emits it.

viem
import { createPublicClient, http, parseAbiItem } from "viem"
import { mainnet } from "viem/chains"

const client = createPublicClient({ chain: mainnet, transport: http() })

const logs = await client.getLogs({
  address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
  event: parseAbiItem("event ApprovalForAll(address indexed owner, address indexed operator, bool approved)"),
  fromBlock: "latest",
})

for (const log of logs) console.log(log.args) // { owner, operator, approved }
ethers v6
import { Interface, JsonRpcProvider } from "ethers"

const provider = new JsonRpcProvider(process.env.RPC_URL)
const iface = new Interface(["event ApprovalForAll(address indexed owner, address indexed operator, bool approved)"])

const logs = await provider.getLogs({
  address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
  topics: [iface.getEvent("ApprovalForAll")!.topicHash],
})

for (const log of logs) console.log(iface.parseLog(log)?.args)
JSON-RPC (eth_getLogs)
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getLogs",
  "params": [
    {
      "address": "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
      "topics": [
        "0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31"
      ],
      "fromBlock": "latest"
    }
  ]
}
Solidity
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

// inside a function:
emit ApprovalForAll(owner, operator, approved);
Example

An example ApprovalForAll log, encoded and decoded

Placeholder values, not a real transaction: how each argument is stored in the topics and the data, and what decoding gives back.

Encoded (as the node returns it)
  • topic0keccak256("ApprovalForAll(address,address,bool)")0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31
  • topic1owner0x0000000000000000000000001111111111111111111111111111111111111111
  • topic2operator0x0000000000000000000000002222222222222222222222222222222222222222
  • data0x0000000000000000000000000000000000000000000000000000000000000001
Decoded with the ABI
  • owneraddress · indexed0x1111111111111111111111111111111111111111
  • operatoraddress · indexed0x2222222222222222222222222222222222222222
  • approvedbooltrue
FAQ

Frequently asked questions

What is the topic0 of the ApprovalForAll event?

0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31: the keccak-256 hash of ApprovalForAll(address,address,bool).

Which ApprovalForAll arguments are indexed?

owner, operator are indexed and sit in the log's topics; approved is in the data.

How do I get an alert when a contract emits ApprovalForAll?

Open one of the ready-made rules on this page, or add any contract and pick ApprovalForAll from the event list. Conditions can be set on indexed and non-indexed arguments, and each alert names the contract and links to the transaction.

Keep exploring

More event signatures and tools

Know the moment a contract emits it

The Beta plan is free: one wallet and one contract, no credit card.