Improved accuracy in state indexing: Addressing inaccuracies in TheGraph implementation #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
According to the following illustrations, it's evident that the current implementation of TheGraph only considers deposit and borrow amounts, neglecting the borrow and deposit rates. This leads to inaccuracies in the representation of borrowed amounts, as detailed below.
Illustration of the Issue:
Case 1: Illustration of borrow balance issue
For instance, a 10.5k xDAI borrow balance is misrepresented as a 10k xDAI borrow on the community dashboard due to the omission of borrow rate by TheGraph’s current implementation.
Screenshot 1: Screenshot of RMM (match on-chain data)
Screenshot 2: Screenshot of Community Dashboard (un-match on-chain data)
Case 2: Illustration of deposit balance issue
For instance, a 54,1k xDAI is misrepresented as a 53k xDAI deposit on the community dashboard due to the omission of deposit rate by TheGraph’s current implementation.
Screenshot 3: Screenshot of Gnosisscan (Gnosis chain explorer)
Show the 53k deposit and the current balance at 54,1k armmWXDAI (xDAI deposited on the RMM) link
Screenshot 4: Screenshot of Community Dashboard (un-match on-chain data)
Here, the screenshot illustrates how the borrow amount is inaccurately depicted on the community dashboard due to the lack of consideration for borrow and deposit rates in TheGraph’s current indexing methodology.
Proposed Solution:
The
feature/rmm-debt-from-smart-contract
branch has been developed to address this oversight by incorporating borrow and deposit rates, ensuring the accurate representation of borrow amounts in state indexing.Benefits of the Solution:
Additional Advisory:
While the
feature/rmm-debt-from-smart-contract
branch serves to rectify the inaccuracies in state representation due to the current limitations of TheGraph implementation, a more sustainable solution would be to address this issue at its root – by updating the indexing code of TheGraph itself.However, as of now, the codebase for TheGraph’s indexing code is private, and therefore inaccessible for external contributions or modifications. This restricts the possibility of submitting updates or enhancements directly to the source and necessitates interim solutions like the one provided in this branch to manage and mitigate the inaccuracies observed.
Call to Action:
I strongly advise that, once accessible, the TheGraph indexing code be updated to inherently account for borrow and deposit rates to ensure accuracy and reliability in state representations. This would eliminate the need for workaround solutions and provide a more streamlined and cohesive experience for the community.
In the interim, I recommend the integration of the
feature/rmm-debt-from-smart-contract
branch as a temporary measure to address the current inaccuracies.Final Thoughts:
Until the accessibility status of TheGraph's indexing code changes, solutions like the one proposed in this branch are pivotal in maintaining accuracy and trust within the community. I look forward to a time when such inherent inaccuracies can be resolved at their source, fostering a more stable and reliable ecosystem for all users.