Event signature · Lending

Withdraw (Compound V3) event signature and topic0

The topic0 of the Withdraw (Compound V3) event is 0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb, the keccak-256 hash of Withdraw(address,address,uint256); 2 of its 3 arguments are indexed. Base asset withdrawn (or borrowed) from a Compound V3 (Comet) market.

Anatomy of a Withdraw (Compound V3) log

Topics

  • topic00x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8ebkeccak256("Withdraw(address,address,uint256)")
  • topic1src (address)indexed: filterable
  • topic2to (address)indexed: filterable

Data

  • dataamount (uint256)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
srcaddresstopic1
toaddresstopic2
amountuint256data

Solidity declaration

event Withdraw(address indexed src, address indexed to, uint256 amount);

Canonical signature

Withdraw(address,address,uint256)

topic0

0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb

Ready-made alerts

Get an alert on Withdraw

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 Withdraw

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

Code

Read Withdraw logs in code

The same filter in viem, ethers and plain JSON-RPC, and the Solidity that emits it. The address is Compound V3 USDC (cUSDCv3), 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: "0xc3d688b66703497daa19211eedff47f25384cdc3",
  event: parseAbiItem("event Withdraw(address indexed src, address indexed to, uint256 amount)"),
  fromBlock: "latest",
})

for (const log of logs) console.log(log.args) // { src, to, amount }
ethers v6
import { Interface, JsonRpcProvider } from "ethers"

const provider = new JsonRpcProvider(process.env.RPC_URL)
const iface = new Interface(["event Withdraw(address indexed src, address indexed to, uint256 amount)"])

const logs = await provider.getLogs({
  address: "0xc3d688b66703497daa19211eedff47f25384cdc3",
  topics: [iface.getEvent("Withdraw")!.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": "0xc3d688b66703497daa19211eedff47f25384cdc3",
      "topics": [
        "0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb"
      ],
      "fromBlock": "latest"
    }
  ]
}
Solidity
event Withdraw(address indexed src, address indexed to, uint256 amount);

// inside a function:
emit Withdraw(src, to, amount);
Example

An example Withdraw 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("Withdraw(address,address,uint256)")0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb
  • topic1src0x0000000000000000000000001111111111111111111111111111111111111111
  • topic2to0x0000000000000000000000002222222222222222222222222222222222222222
  • data0x0000000000000000000000000000000000000000000000000000000000000bb8
Decoded with the ABI
  • srcaddress · indexed0x1111111111111111111111111111111111111111
  • toaddress · indexed0x2222222222222222222222222222222222222222
  • amountuint2563000
FAQ

Frequently asked questions

What is the topic0 of the Withdraw (Compound V3) event?

0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb: the keccak-256 hash of Withdraw(address,address,uint256).

Which Withdraw (Compound V3) arguments are indexed?

src, to are indexed and sit in the log's topics; amount is in the data.

How do I get an alert when a contract emits Withdraw (Compound V3)?

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