yearn / yearn-vaults-v2-subgraph

26 stars 41 forks source link

Wrong shares burnt amount #64

Open Deams51 opened 3 years ago

Deams51 commented 3 years ago

Looking at this transaction on Etherscan: https://etherscan.io/tx/0x20127185f6e74cd981d7800c24b385932328cf85a98b59a97c843b14109d775a

Etherscan is showing 157544759481891494214 shares burnt (the exact total amount of shares for this account) for vault 0xb32747b4045479b77a8b8eb44029ba12580214f8. But the subgraph is returning: 157544759481891494210

Request:

    {
      a0:account(id:"0xe4f077bf767a57ae9aad77b0ab54cbde0bede65a") {
        withdrawals {
          vault{id}
          sharesBurnt
        }
        }
    }

Result:

{
  "data": {
    "a0": {
      "withdrawals": [
        {
          "sharesBurnt": "119029962005625651290",
          "vault": {
            "id": "0xac1c90b9c76d56ba2e24f3995f7671c745f8f308"
          }
        },
        {
          "sharesBurnt": "157544759481891494210",
          "vault": {
            "id": "0xb32747b4045479b77a8b8eb44029ba12580214f8"
          }
        },
        {
          "sharesBurnt": "100000000",
          "vault": {
            "id": "0xcb550a6d4c8e3517a939bc79d0c7093eb7cf56b5"
          }
        },
        {
          "sharesBurnt": "10637027342642593208",
          "vault": {
            "id": "0xe9dc63083c464d6edccff23444ff3cfc6886f6fb"
          }
        },
        {
          "sharesBurnt": "869118244119344024533",
          "vault": {
            "id": "0x2f194da57aa855caa02ea3ab991fa5d38178b9e6"
          }
        },
        {
          "sharesBurnt": "28951680313449594296748",
          "vault": {
            "id": "0x19d3364a399d251e894ac732651be8b0e4e85001"
          }
        },
        {
          "sharesBurnt": "2258248615072966164",
          "vault": {
            "id": "0xe14d13d8b3b85af791b2aadd661cdbd5e6097db1"
          }
        },
        {
          "sharesBurnt": "49929824103",
          "vault": {
            "id": "0x5f18c75abdae578b483e5f43f12a39cf75b973a9"
          }
        }
      ]
    }
  }
}
bsamuels453 commented 2 years ago

I'm fairly certain this bug is caused by the following logic that's used to calculate the burnt share amount; https://github.com/yearn/yearn-vaults-v2-subgraph/blob/main/src/mappings/vaultMappings.ts#L360-L362

The total shares burnt are not exposed through the event that triggered the withdrawal. The logic used to calculate the shares burnt should work, but is several satoshi off. If it turns out this is caused by a rounding error, then the shares burnt may have to be acquired in some other way

bogdanuch41 commented 2 years ago

I wanted to ask: is this task closed or not? I wanted to contribute, but I don't understand if this task is open since there was answer before, but it was left without reply.