superfluid-finance/protocol-monorepo

[SUBGRAPH][BUG] PoolMember not getting updated when the member units change

Closed this issue · 3 comments

Describe the bug:
When a pool member units change, it should trigger an update on the PoolMember entity. It doesn't seem to currently.

An example transaction where it didn't trigger: https://optimistic.etherscan.io/tx/0xf724ab6afeebd00e9238d731ba7cd13f36889b39d043f62f9938980b12667155

Subgraph endpoint: https://optimism-mainnet.subgraph.x.superfluid.dev/

Query:

query PoolMemberNotUpdating {
  memberUnitsUpdatedEvents(where: {blockNumber: "117017811"}) {
    blockNumber
    poolMember {
      id
    }
  }
  poolMember(
    id: "poolMember-0x468d9c9570917905c655a4f8aae2c039938d3d13-0xd66e40b0c30595bec72153b502ac1e0c4785991b"
    block: {number: 117017812}
  ) {
    id
    updatedAtBlockNumber
  }
}

Response:

{
  "data": {
    "memberUnitsUpdatedEvents": [
      {
        "blockNumber": "117017811",
        "poolMember": {
          "id": "poolMember-0x468d9c9570917905c655a4f8aae2c039938d3d13-0xd66e40b0c30595bec72153b502ac1e0c4785991b"
        }
      }
    ],
    "poolMember": {
      "id": "poolMember-0x468d9c9570917905c655a4f8aae2c039938d3d13-0xd66e40b0c30595bec72153b502ac1e0c4785991b",
      "updatedAtBlockNumber": "116759527"
    }
  }
}

I don't see the updateAt* fields updated anywhere in this spaghetti:

export function handleMemberUnitsUpdated(event: MemberUnitsUpdated): void {

The only reference to "member.updated" I find is in getOrInitPoolMember:

export function getOrInitPoolMember(

Tbh I feel like the units thing is a red herring and I would love to see a tx where the units issue pops up where the units actually change because in the tx you mention in the first comment the MemberUnitsUpdatedEvent oldUnits and newUnits are the same, altho confusing , I can see how it would not update the PoolMember entity, as the units in reality have not changed

Have a look at this pool:
https://console.superfluid.finance/matic/pools/0x8280718f4eae17af504f1c34145a34853f2168cb
Here I did this:
Create pool -> Add member 1 and update member1 units to 100 -> Distribute 1 token -> Add member 2 and update member2 units to 100 -> Distribute 1 token

There is no issue with units updated event in this scenario , but the first users amount received did not get the +0.5 tokens which should be there

This should be closed?