Skip to content

Commit

Permalink
fix: added warning log if from Sentry wallet is missing on transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
XDapps committed Nov 20, 2024
1 parent 943cc6d commit 4b73871
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions infrastructure/sentry-subgraph/src/node-license.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address, BigInt } from "@graphprotocol/graph-ts"
import { Address, BigInt, log } from "@graphprotocol/graph-ts"
import {
Transfer as TransferEvent,
} from "../generated/NodeLicense/NodeLicense"
Expand Down Expand Up @@ -28,11 +28,12 @@ export function handleTransfer(event: TransferEvent): void {
if (event.params.from != Address.zero()) {
const fromSentryWallet = SentryWallet.load(event.params.from.toHexString());
if (fromSentryWallet) {
fromSentryWallet.keyCount = fromSentryWallet.keyCount.minus(
BigInt.fromI32(1)
);
fromSentryWallet.keyCount = fromSentryWallet.keyCount.minus(BigInt.fromI32(1));
fromSentryWallet.save();
}
}else{
log.warning("Failed to find SentryWallet for from address: " + event.params.from.toHexString() + ", TX: " + event.transaction.hash.toHexString(), []);
return;
}

let sentryKey = SentryKey.load(event.params.tokenId.toString())
Expand Down

0 comments on commit 4b73871

Please sign in to comment.