Event signature · DEX and liquidity

PairCreated (Uniswap V2) event signature and topic0

The topic0 of the PairCreated (Uniswap V2) event is 0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9, the keccak-256 hash of PairCreated(address,address,address,uint256); 2 of its 4 arguments are indexed. New pair deployed by the Uniswap V2 factory.

Anatomy of a PairCreated (Uniswap V2) log

Topics

  • topic00x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9keccak256("PairCreated(address,address,address,uint256)")
  • topic1token0 (address)indexed: filterable
  • topic2token1 (address)indexed: filterable

Data

  • datapair (address), (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
token0addresstopic1
token1addresstopic2
pairaddressdata
uint256data

Solidity declaration

event PairCreated(address indexed token0, address indexed token1, address pair, uint256);

Canonical signature

PairCreated(address,address,address,uint256)

topic0

0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9

Ready-made alerts

Get an alert on PairCreated

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 PairCreated

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

Code

Read PairCreated logs in code

The same filter in viem, ethers and plain JSON-RPC, and the Solidity that emits it. The address is Uniswap V2 Factory, 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: "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f",
  event: parseAbiItem("event PairCreated(address indexed token0, address indexed token1, address pair, uint256)"),
  fromBlock: "latest",
})

for (const log of logs) console.log(log.args) // { token0, token1, pair,  }
ethers v6
import { Interface, JsonRpcProvider } from "ethers"

const provider = new JsonRpcProvider(process.env.RPC_URL)
const iface = new Interface(["event PairCreated(address indexed token0, address indexed token1, address pair, uint256)"])

const logs = await provider.getLogs({
  address: "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f",
  topics: [iface.getEvent("PairCreated")!.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": "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f",
      "topics": [
        "0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9"
      ],
      "fromBlock": "latest"
    }
  ]
}
Solidity
event PairCreated(address indexed token0, address indexed token1, address pair, uint256);

// inside a function:
emit PairCreated(token0, token1, pair, );
Example

An example PairCreated 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("PairCreated(address,address,address,uint256)")0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9
  • topic1token00x0000000000000000000000001111111111111111111111111111111111111111
  • topic2token10x0000000000000000000000002222222222222222222222222222222222222222
  • data0x00000000000000000000000033333333333333333333333333333333333333330000000000000000000000000000000000000000000000000000000000000fa0
Decoded with the ABI
  • token0address · indexed0x1111111111111111111111111111111111111111
  • token1address · indexed0x2222222222222222222222222222222222222222
  • pairaddress0x3333333333333333333333333333333333333333
  • uint2564000
FAQ

Frequently asked questions

What is the topic0 of the PairCreated (Uniswap V2) event?

0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9: the keccak-256 hash of PairCreated(address,address,address,uint256).

Which PairCreated (Uniswap V2) arguments are indexed?

token0, token1 are indexed and sit in the log's topics; pair, are in the data.

How do I get an alert when a contract emits PairCreated (Uniswap V2)?

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