aave / aave/protocol-subgraphs

UserReserve scaledATokenBalance are wrong ?

Open
#52 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
150
Forks
130
PR merge metrics
No merged PRs in 30d

Description

For the convenience of locating the data, I directly queried userReserves by id

{
  userReserves(where: {
      id: "0xe813e410f1841c06e40bff0407f7f4b63bc3ff360x7ceb23fd6bc0add59e62ac25578270cff1b9f6190xd05e3e715d945b59290df0ae8ef85c1bdb684744"
    }) {
      id
      reserve {
        symbol,
        underlyingAsset
      },
      user {
        id
      }
      currentATokenBalance,
      currentStableDebt,
      scaledATokenBalance
      currentVariableDebt,
    }
  
}

I got a response like this

{
  "data": {
    "userReserves": [
      {
        "id": "0xe813e410f1841c06e40bff0407f7f4b63bc3ff360x7ceb23fd6bc0add59e62ac25578270cff1b9f6190xd05e3e715d945b59290df0ae8ef85c1bdb684744",
        "reserve": {
          "symbol": "WETH",
          "underlyingAsset": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"
        },
        "user": {
          "id": "0xe813e410f1841c06e40bff0407f7f4b63bc3ff36"
        },
        "currentATokenBalance": "-313884125764640270",
        "currentStableDebt": "0",
        "scaledATokenBalance": "-312335331786059929",
        "currentVariableDebt": "0"
      }
    ]
  }
}

Why is scaledATokenBalance negative?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported userReserves query for the supplied id and compare currentATokenBalance with scaledATokenBalance. The payload names no source file or test, so trace the userReserves indexing and balance calculation entry points; done means explaining the negative value or correcting it and verifying the query result.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.