livepeer / subgraph

This repository contains the code for the Livepeer Protocol subgraph
5 stars 5 forks source link

[feature_request] Add `pendingStake` field #158

Open rickstaa opened 9 months ago

rickstaa commented 9 months ago

Problem description

The current method of retrieving bondedAmount for delegators from the LivePeer subgraph using the provided query has revealed a discrepancy. Upon closer examination, it became apparent that the returned LPT does not represent the total LPT accumulated by a delegator. This discrepancy is primarily attributed to including the initial bond and the pending stake due to interest.

{
  transcoder (id: "0x5bdeedca9c6346b0ce6b17ffa8227a4dace37039"){
    delegators (where:{id:"0x5bdeedca9c6346b0ce6b17ffa8227a4dace37039"}){
      bondedAmount
    }
  }
}

For instance, comparing the subgraph result (e.g., 1.002563476329049571 LPT) with the actual stake displayed on Arbiscan (e.g., 2.536529849800865 LPT) for my orchestrator highlights this variance.

Proposed solution

To address this inconsistency and provide users with a more accurate representation of the total stake of a delegator to a given orchestrator, I suggest introducing a new field, pendingStake, to the subgraph. This addition would enable users to retrieve the complete stake information for delegators associated with a specific transcoder.

Screenshots

I performed the following actions:

image

The result should be 9.40 but include the 128 transferred.

image