Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue filtering PairCreated events #965

Closed
Q6Crypto opened this issue Jul 11, 2024 · 1 comment
Closed

Issue filtering PairCreated events #965

Q6Crypto opened this issue Jul 11, 2024 · 1 comment

Comments

@Q6Crypto
Copy link

Q6Crypto commented Jul 11, 2024

I have an issue when getting the args coming from the event filtered.

This is my setup :

//ponder.config.ts
export default createConfig({
  networks: {
    bsc: {
      chainId: 56,
      transport: rateLimit(http(process.env.PONDER_RPC_URL_56), {
        requestsPerSecond: 60,
      }),
    },
  },
  contracts: {
    UniswapV2Factory: {
      network: "bsc",
      abi: UniswapV2FactoryAbi,
      startBlock: 5_000_000,
      filter: {
        event: "PairCreated",
      },
    },
  },
});
//UniswapV2FactoryAbi.ts
[...]
{
    anonymous: false,
    inputs: [
      {
        indexed: true,
        internalType: "address",
        name: "token0",
        type: "address",
      },
      {
        indexed: true,
        internalType: "address",
        name: "token1",
        type: "address",
      },
      {
        indexed: false,
        internalType: "address",
        name: "pair",
        type: "address",
      },
      { indexed: false, internalType: "uint256", name: "", type: "uint256" },
    ],
    name: "PairCreated",
    type: "event",
 }
[...]

The first issue is that the event.args structure is not named like in the docs
image

The second issue is that when I console.log event, I can see that token0 and token1 are not in event.args, they just show in event.log.topics[1] and [2], maybe because they are indexed in the ABI

//console.log(event)
{
name: 'PairCreated',
  args: [ '0xefD7aF98146279da592937a77fd8a4EBc8DA51C3', 3613n ],
  log: {
    address: '0xBCfCcbde45cE874adCB698cC183deBcF17952812',
    blockHash: '0xedbf6ec6a3d7145935e5a9f45f48f46f5144601427460ad4cb12cd47a829735b',
    blockNumber: 5000227n,
    data: '0x000000000000000000000000efd7af98146279da592937a77fd8a4ebc8da51c30000000000000000000000000000000000000000000000000000000000000e1d',
    id: '0xedbf6ec6a3d7145935e5a9f45f48f46f5144601427460ad4cb12cd47a829735b-0x113',
    logIndex: 275,
    removed: false,
    topics: [
      '0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9',
      '0x000000000000000000000000a81f65da7f65b1d82dce8fef54f8ba921ebb927e',
      '0x000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'
    ],
    transactionHash: '0xe7d983567a259df20185f6b1f7c8521ed1f1d70b2161922a3cbaba57c2b97aac',
    transactionIndex: 50
  },
}
@Q6Crypto
Copy link
Author

Dupplicate of #777

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant