#bug; Compound V3 - wrong wallet balances in subgraphs
Describe the bug TL;DR - wrong wallet balanced on Compound V3 subgraphs
We’ve identified several wallets with a wrong balance stored on the subgraph compared to on-chain.
Reproduction
For example, Ethereum subgraph showing wallet 0xab62b80fca2c60254978e0a2ee269c492f319b2d has borrowed 1,463,004 USDC without any collateral position, however when calling the borrowBalanceOf of the USDC comet contract the borrow balance is 0:
Additional account addresses with wrong balances:
| Chain | Address |
|---|---|
| Ethereum | 0x649cc3ff614a70741cc1ce099c0fa14bdc51ac11 |
| Ethereum | 0xab62b80fca2c60254978e0a2ee269c492f319b2d |
| Ethereum | 0xdf7bdb2d8e3c2c39b9367d887d497d450ad1c597 |
| Ethereum | 0x05e70979fd3355133f91fc7c6597a8274169b3be |
| Ethereum | 0x2178e1d614fefb2b304db58f07116d89f948fda1 |
| Ethereum | 0xe7ce11f4b1cfd8e607b0ca64823ad645f260badc |
| Polygon | 0x19bf9810d6bfc4d1b8e742edb1448486b38dc35f |
| Polygon | 0x6822c1c54ed42ceb294a46b855de75e82f8f98c5 |
| Polygon | 0x5d38341569a12d50a44cdce4643ca474073a9a8b |
| Polygon | 0x6d903cbfdc7cf765c13fa05241392c9c7c2f00b7 |
@dmelotik
I believe what is happening is that this transaction repays all of the debt, and withdraws the remaining USDC supplied.
So it is only recorded as a withdraw, however the subgraph should also record it as a repay, or at least update the borrow position. Going to have to come back around when I have capacity for this.