Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
EdNoepel committed Dec 20, 2023
1 parent 8c675f9 commit 764304b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/mappings/ajna-token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Bytes } from "@graphprotocol/graph-ts"
import { log } from "@graphprotocol/graph-ts"
import {
DelegateChanged as DelegateChangedEvent,
DelegateVotesChanged as DelegateVotesChangedEvent,
Expand Down Expand Up @@ -76,12 +77,16 @@ export function handleAjnaTokenTransfer(
event: AjnaTokenTransferEvent
): void {
const ajnaToken = event.transaction.to!
log.info('handleAjnaTokenTransfer tx.from {} tx.to {}', [event.transaction.from.toHexString(), event.transaction.to!.toHexString()])

const fromAccount = loadOrCreateAccount(addressToBytes(event.params.from))
fromAccount.tokens = wadToDecimal(getTokenBalance(ajnaToken, event.params.from))
fromAccount.save()
log.info('handleAjnaTokenTransfer from {} balance {}', [fromAccount.id.toHexString(), fromAccount.tokens.toString()])

const toAccount = loadOrCreateAccount(addressToBytes(event.params.to))
toAccount.tokens = wadToDecimal(getTokenBalance(ajnaToken, event.params.to))
toAccount.save()
log.info('handleAjnaTokenTransfer to {} balance {}', [fromAccount.id.toHexString(), fromAccount.tokens.toString()])

}

0 comments on commit 764304b

Please sign in to comment.