CirclesUBI / circles-subgraph

Circles subgraph for The Graph
https://thegraph.com/explorer/subgraph/circlesubi/circles-ubi
GNU Affero General Public License v3.0
5 stars 5 forks source link

Transitive transfers going through users do not show up in their balance #20

Closed adzialocha closed 4 years ago

adzialocha commented 4 years ago

Currently we only display HUB_TRANSFER events (via Hub contract transferThrough method, https://github.com/CirclesUBI/circles-contracts/blob/master/contracts/Hub.sol#L241) but apparently there are also important TRANSFER events taking place. We were not displaying TRANSFER events as they so far only contained gas fee transfers which we decided to hide.

Example here:

{
  notifications(orderBy: "time", orderDirection: "desc", where: {type: TRANSFER, safeAddress: "0x206b9f90df961871c1da12c7fd6d7fd32d357d11"}) {
    id
    transactionHash
    safeAddress
    type
    time
    trust {
      user
      canSendTo
      limitPercentage
    }
    transfer {
      from
      to
      amount
    }
    hubTransfer {
      from
      to
      amount
    }
    ownership {
      adds
      removes
    }
  }
}

Returning:

      {
        "hubTransfer": null,
        "id": "transfer-from-19477831-1",
        "ownership": null,
        "safeAddress": "0x206b9f90df961871c1da12c7fd6d7fd32d357d11",
        "time": "1594208372",
        "transactionHash": "0x9d52e0b4aca4aa8e53788668817888838a9910d71db81776ef0121135485d742",
        "transfer": {
          "amount": "4000000000000000000",
          "from": "0x206b9f90df961871c1da12c7fd6d7fd32d357d11",
          "to": "0xc9078398942a926a790521f855e8998d5559b529"
        },
        "trust": null,
        "type": "TRANSFER"
      }
ana0 commented 4 years ago

This transfer is from a transitive transaction that moved through address "0x206b9f90df961871c1da12c7fd6d7fd32d357d11" and shouldn't be displayed (at least with current ui decisions). You can see the transaction steps here: https://kovan.etherscan.io/tx/0x9d52e0b4aca4aa8e53788668817888838a9910d71db81776ef0121135485d742

ana0 commented 4 years ago

The issue for me is actually why the user's balance received transitively isn't showing up in this query:

{balances
  (where: {owner:"0x206b9f90df961871c1da12c7fd6d7fd32d357d11"}) {
  id amount owner {
    id
  } token {
    id
  }
  } }
ana0 commented 4 years ago

Our most recent graph sync had some kind of problem - moving to a hosted service shows the missing data