yearn-vaults-v2-subgraph icon indicating copy to clipboard operation
yearn-vaults-v2-subgraph copied to clipboard

Wrong shares burnt amount

Open Deams51 opened this issue 3 years ago • 2 comments

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"
          }
        }
      ]
    }
  }
}

Deams51 avatar May 06 '21 11:05 Deams51

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

bsamuels453 avatar Dec 04 '21 05:12 bsamuels453

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.

bogdanuch41 avatar Jul 26 '22 12:07 bogdanuch41