-
Notifications
You must be signed in to change notification settings - Fork 1
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
[NOT MERGE BEFORE #26] Add supply indexing #28
base: main
Are you sure you want to change the base?
Conversation
- Introduced a new `Supply` type in `schema.graphql`. - Created `getSupply` function in `src/mappings/bank/supply.ts` to fetch total supply. - Modified `handleGenesis` to store the initial supply from genesis state. - Added `_handleSupply` function in `src/mappings/primitives.ts` to periodically index total supply. - Updated the Genesis interface to include supply data.
- Introduced `supplies` field in `Block` type to reference `Supply` entities. - Added new fields `denom` and `block` to `Supply` type. - Replaced `getSupply` with `queryTotalSupply` and implement `getSupplyRecord`. - Modified `_handleSupply` to create supply records with `getSupplyRecord` and avoid duplicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one @jorgecuesta! 🚀
- Removed `_handleSupply` from `primitives.ts` and imported it from `supply.ts`. - Reorganized `getSupplyRecord` in `supply.ts` to use `getSupplyId` for ID generation. - Simplified supply concatenation logic in `queryTotalSupply` by using `push` instead of `concat`. - Centralized total supply handling in `supply.ts` for clearer separation of concerns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preemptively approving! 🙌
Just a couple more last-minute suggestions and then I think this is good to go.
…what we plan to do on future releases.
- Introduced new handler `handleBlockSupply` to link block with recent supply. - Added `supply` field to `Block` entity in GraphQL schema. - Ensured supply records in genesis block are handled properly. - Modified `_handleSupply` and `_handleBlockSupply` to update and retrieve supply data. - Updated `Genesis` interface to include supply information.
…the amount changes.
- Replaced the old block supply handler with a more robust tracking system. - Introduced `SupplyDenom` and `BlockSupply` entities for better denomination supply tracking. - Added logic to handle supply records creation for each block, adjusting for the genesis block. - Adjusted schema to accommodate new entities and relationships. - Removed unused functions and refactored supply-related code for clarity and efficiency.
@bryanchriswhite Please refer to the attached images to look how the structure looks at the database and also the same result on the graphql query. I think now this achieve a proper handling of supply for any denomination on the block, which allows further updates on the protocol like IBC transactions without need to modify it. |
Summary
This pull request adds the Supply entity and updates the block entity.
Issue
This PR addresses improvements required for supply handling and indexing. The updates include:
Type of change
Select one or more:
Sanity Checklist