Skip to content

Commit

Permalink
Add creation block number and timestamp to activations (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsudmi authored Feb 10, 2022
1 parent f427500 commit 7a6ddc7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions subgraphs/stakewise/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ type DepositActivation @entity {

"The amount that will be activated"
amount: BigInt!

"The creation block number"
createdAtBlock: BigInt!

"The creation timestamp"
createdAtTimestamp: BigInt!
}

"""
Expand Down
2 changes: 2 additions & 0 deletions subgraphs/stakewise/src/entities/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export function createOrLoadDepositActivation(
activation.account = account;
activation.validatorIndex = validatorIndex;
activation.amount = BIG_INT_ZERO;
activation.createdAtBlock = BIG_INT_ZERO;
activation.createdAtTimestamp = BIG_INT_ZERO;
activation.save();
}

Expand Down
2 changes: 2 additions & 0 deletions subgraphs/stakewise/src/mappings/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ export function handleActivationScheduled(event: ActivationScheduled): void {
);

activation.amount = activation.amount.plus(event.params.value);
activation.createdAtBlock = event.block.number;
activation.createdAtTimestamp = event.block.timestamp;
activation.save();

let pool = createOrLoadPool();
Expand Down

0 comments on commit 7a6ddc7

Please sign in to comment.