Event signature · Governance

VoteCast event signature and topic0

The topic0 of the VoteCast event is 0xb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4, the keccak-256 hash of VoteCast(address,uint256,uint8,uint256,string); 1 of its 5 arguments is indexed. Governance vote cast on a Governor / Compound-style DAO.

Anatomy of a VoteCast log

Topics

  • topic00xb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4keccak256("VoteCast(address,uint256,uint8,uint256,string)")
  • topic1voter (address)indexed: filterable

Data

  • dataproposalId (uint256), support (uint8), weight (uint256), reason (string)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
voteraddresstopic1
proposalIduint256data
supportuint8data
weightuint256data
reasonstringdata

Solidity declaration

event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason);

Canonical signature

VoteCast(address,uint256,uint8,uint256,string)

topic0

0xb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4

Ready-made alerts

Get an alert on VoteCast

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 VoteCast

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

Code

Read VoteCast logs in code

The same filter in viem, ethers and plain JSON-RPC, and the Solidity that emits it. The address is Uniswap Governor Bravo, 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: "0x408ed6354d4973f66138c91495f2f2fcbd8724c3",
  event: parseAbiItem("event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason)"),
  fromBlock: "latest",
})

for (const log of logs) console.log(log.args) // { voter, proposalId, support, weight, reason }
ethers v6
import { Interface, JsonRpcProvider } from "ethers"

const provider = new JsonRpcProvider(process.env.RPC_URL)
const iface = new Interface(["event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason)"])

const logs = await provider.getLogs({
  address: "0x408ed6354d4973f66138c91495f2f2fcbd8724c3",
  topics: [iface.getEvent("VoteCast")!.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": "0x408ed6354d4973f66138c91495f2f2fcbd8724c3",
      "topics": [
        "0xb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4"
      ],
      "fromBlock": "latest"
    }
  ]
}
Solidity
event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason);

// inside a function:
emit VoteCast(voter, proposalId, support, weight, reason);
Example

An example VoteCast 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("VoteCast(address,uint256,uint8,uint256,string)")0xb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4
  • topic1voter0x0000000000000000000000001111111111111111111111111111111111111111
  • data0x00000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000fa0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000076578616d706c6500000000000000000000000000000000000000000000000000
Decoded with the ABI
  • voteraddress · indexed0x1111111111111111111111111111111111111111
  • proposalIduint2562000
  • supportuint83
  • weightuint2564000
  • reasonstringexample
FAQ

Frequently asked questions

What is the topic0 of the VoteCast event?

0xb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4: the keccak-256 hash of VoteCast(address,uint256,uint8,uint256,string).

Which VoteCast arguments are indexed?

voter is indexed and sit in the log's topics; proposalId, support, weight, reason are in the data.

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

Open one of the ready-made rules on this page, or add any contract and pick VoteCast 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.