Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add supply and borrower count to core pool #120

Merged
merged 4 commits into from
Nov 14, 2023

Conversation

coreyar
Copy link
Collaborator

@coreyar coreyar commented Oct 31, 2023

Adds supply and borrower count to core subgraph
A borrowerCountAdjusted value is added that removes accounts that were liquidated with only dust left

@coreyar coreyar marked this pull request as ready for review November 1, 2023 19:18
@coreyar coreyar force-pushed the update-core-supplier-and-borrower-count branch 3 times, most recently from 150108b to 7ab894b Compare November 8, 2023 16:37
@coreyar coreyar force-pushed the update-core-supplier-and-borrower-count branch 9 times, most recently from 0dae85e to 8435df8 Compare November 9, 2023 16:22
subgraphs/isolated-pools/schema.graphql Outdated Show resolved Hide resolved
subgraphs/venus/schema.graphql Show resolved Hide resolved
Comment on lines +23 to +33
'MINT',
'REDEEM',
'BORROW',
'REPAY',
'SEIZE',
'LIQUIDATE',
'TRANSFER',
'ENTER_MARKET',
'EXIT_MARKET',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the outside it looks the same as before, just that it's not using the constants declared above

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this because of an assembly script error. I can investigate further

if (event.params.accountBorrows == event.params.borrowAmount) {
// if both the accountBorrows and the borrowAmount are the same, it means the account is a new borrower
market.borrowerCount = market.borrowerCount.plus(oneBigInt);
market.borrowerCountAdjusted = market.borrowerCountAdjusted.plus(oneBigInt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: does it make sense to apply the same dust rule here if you borrow a real small amount? Although I do see the difference between borrowing and liquidating

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is an interesting question. It is unlikely that a user will borrow such a small amount but if they did I think it should count as a borrow because it was an action taken by a user.

In this case we are trying to differentiate between actually live positions and positions that were closed by liquidators but remained open because of dust

subgraphs/venus/src/mappings/vToken.ts Outdated Show resolved Hide resolved
subgraphs/venus/tests/VToken/index.test.ts Outdated Show resolved Hide resolved
@coreyar coreyar force-pushed the update-core-supplier-and-borrower-count branch from 8435df8 to b19bcf2 Compare November 13, 2023 15:20
@coreyar coreyar merged commit 718eb40 into main Nov 14, 2023
4 checks passed
@coreyar coreyar deleted the update-core-supplier-and-borrower-count branch January 2, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants