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

Subgraph data miss-align for amount0 and amount1 #235

Open
studentofcoding opened this issue Jun 4, 2024 · 0 comments
Open

Subgraph data miss-align for amount0 and amount1 #235

studentofcoding opened this issue Jun 4, 2024 · 0 comments

Comments

@studentofcoding
Copy link

If we query swaps activity on V3 with this query

{
  swaps(first: 10, skip: 0, orderBy: timestamp, orderDirection: desc) {
    transaction {
      id
      blockNumber
      gasUsed
      gasPrice
    }
    timestamp
    token0 {
      symbol
    }
    token1 {
      symbol
    }
    sender
    recipient
    amount0
    amount1
  }
}

We would get the example data below

{
        "transaction": {
          "id": "0xfbc144494e603ed67258e49d948d3f0e0617ca71123f1dd362b4e9e80a6c05ce",
          "blockNumber": "20018060",
          "gasUsed": "266251",
          "gasPrice": "7729821113"
        },
        "timestamp": "1717499327",
        "token0": {
          "symbol": "FI"
        },
        "token1": {
          "symbol": "WETH"
        },
        "sender": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
        "recipient": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
        "amount0": "-50125",
        "amount1": "0.114394037615079189"
      },

And when we checked, the amount0 shouldn't be negative (-) as it's buying 50125 FI with 0.114++ WETH (here is the tx)
Screenshot 2024-06-04 at 18 16 56

This is all around the swap transactions, is there any reason why this is happening?

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