Skip to content

Commit

Permalink
fix: lastUpdatedAt and lastUpdatedAtTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmardefago committed Aug 24, 2022
1 parent 672ee76 commit 514ad7c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/utils/helpers/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export function getOrCreateUser(
user.save();

proxy.userCount = proxy.userCount + BIGINT_ONE;
} else if (user != null) {
user.lastUpdatedAt = compoundIdToSortableDecimal(transactionId);
user.lastUpdatedAtTransaction = transactionId;
}

return user as User;
Expand All @@ -68,6 +71,9 @@ export function getOrCreatePool(
pool.save();

proxy.poolCount = proxy.poolCount + BIGINT_ONE;
} else if (pool != null) {
pool.lastUpdatedAt = compoundIdToSortableDecimal(transactionId);
pool.lastUpdatedAtTransaction = transactionId;
}

return pool as Pool;
Expand Down Expand Up @@ -181,6 +187,9 @@ export function getProtocolAccount(transactionId: String): ProtocolAccount {
account.lastUpdatedAtTransaction = transactionId;

account.save();
} else {
account.lastUpdatedAt = compoundIdToSortableDecimal(transactionId);
account.lastUpdatedAtTransaction = transactionId;
}

return account as ProtocolAccount;
Expand Down
3 changes: 3 additions & 0 deletions src/utils/helpers/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export function getOrCreateAccountNFTSlot(
slot.lastUpdatedAt = compoundIdToSortableDecimal(transactionId);
slot.createdAtTransaction = transactionId;
slot.lastUpdatedAtTransaction = transactionId;
} else if (slot != null) {
slot.lastUpdatedAt = compoundIdToSortableDecimal(transactionId);
slot.lastUpdatedAtTransaction = transactionId;
}

return slot as AccountNFTSlot;
Expand Down

0 comments on commit 514ad7c

Please sign in to comment.