-
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
Split mapping main file #12
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GraphQL schema changes: - Epoch counter's unique entity ID ('Singleton') have been replaced by `epoch-counter` to have a more meaningful name. - EpochStake entities only contains the fields `staking provider address` and `amount`. `participation` and `stakeData` fields have been removed to avoid redundant data. - The timestamp field name of an epoch have been replaced by `timestamp`. The total amount of token staked in a epoch entity is saved in `totalStaked` field. - Now, the first epoch (number 0) is the period between the token staking contract deployment and the first staking event. - Comments format have been homogenized. Src files changes: - Added src/utils/epochs.ts code with some utilities related to the management of the epochs and its counter. - Modified HandleStaked function in mapping.ts to follow the new schema (handleToppedUp and handleUnstaked are pending).
These modifications increase the processing time of subgraph. A bug has been fixed also in Staked handle function: previous epochStakes were not properly saved when a new Epoch is created.
To create a new Epoch, it's necessary to copy the last epoch stakes but replacing the ID for a new one. This task is made in at least three handlers (staked, toppedup and unstaked), so a new function has been created in utils. Also, a new constant variable for amount and staking provider has been added to staked and unstaked handler functions.
These modifications increase the processing time of subgraph.
A stake can have different stake types at the same time (T, NuInTStake and KeepInTStake), so the StakeType's field can be misleading.
This function from utils returns a string with the Epoch Stake's ID. Now it accepts an epoch ID. If this is not passed, it takes the current epoch count. Also, the staking provider argument type have changed from String to Address for simplicity.
- Entity name changed to PREOperator, which is more descriptive. - Added OperatorBonded event handler, so PREOperator instance is created when a new operator is bonded. - Added confirmationTimestamp field, which will store the time in which the operator is confirmed.
Threshold Subgraph recieves events from several sources (contracts). So a logical division of events handlers can be each contract. To achieve this, the generic "mappings.ts" file have been splitted in "pre-app.ts" and "staking.ts". Also, TokenStaking entities list in subgraph manifest has been updated.
manumonti
force-pushed
the
operator-events
branch
from
June 8, 2022 07:47
a79ad0b
to
c2834fa
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Note: This PR must be merged after #11 .
Threshold Subgraph recieves events from several sources (contracts). So
a logical division of events handlers can be each contract.
To achieve this, the generic "mappings.ts" file have been splitted in
"pre-app.ts" and "staking.ts".
Also, TokenStaking entities list in subgraph manifest has been updated.