Skip to content

Subgraph data miss-align for amount0 and amount1 #235

Open
@studentofcoding

Description

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?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions