Skip to content

Commit

Permalink
add createdAtTimestamp/BlockNumber for ATS entity (#1909)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdavinchee authored Mar 25, 2024
1 parent 2b90dce commit f3d5d3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,8 @@ type AccountTokenSnapshot @entity {
ID composed of: accountID-tokenID
"""
id: ID!
createdAtTimestamp: BigInt!
createdAtBlockNumber: BigInt!
updatedAtTimestamp: BigInt!
updatedAtBlockNumber: BigInt!
# ---------------------------------- state ----------------------------------
Expand Down
2 changes: 2 additions & 0 deletions packages/subgraph/src/mappingHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ export function getOrInitAccountTokenSnapshot(

if (accountTokenSnapshot == null) {
accountTokenSnapshot = new AccountTokenSnapshot(atsId);
accountTokenSnapshot.createdAtTimestamp = block.timestamp;
accountTokenSnapshot.createdAtBlockNumber = block.number;
accountTokenSnapshot.updatedAtTimestamp = block.timestamp;
accountTokenSnapshot.updatedAtBlockNumber = block.number;
accountTokenSnapshot.totalNumberOfActiveStreams = 0;
Expand Down

0 comments on commit f3d5d3a

Please sign in to comment.