Skip to content

Commit

Permalink
isToken must not be null
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdavinchee committed Mar 27, 2024
1 parent ec3163c commit 0cb3fd9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/subgraph/src/mappings/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,22 @@ export function handleRoleRevoked(event: RoleRevoked): void {
function getOrInitResolverEntry(id: string, target: Address, block: ethereum.Block): ResolverEntry {
let resolverEntry = ResolverEntry.load(id);

const isListed = target.notEqual(ZERO_ADDRESS);
const isToken = Token.load(target.toHex()) != null;

if (resolverEntry == null) {
resolverEntry = new ResolverEntry(id);
resolverEntry.createdAtBlockNumber = block.number;
resolverEntry.createdAtTimestamp = block.timestamp;
resolverEntry.targetAddress = target;
// on initialization, we are unlikely to set this to zero address
// if we do, this gets fixed in subsequent set events
resolverEntry.isToken = isToken;
}
const isListed = target.notEqual(ZERO_ADDRESS);

// we only update this if the target is not equal to the zero address
if (isListed) {
resolverEntry.isToken = Token.load(target.toHex()) != null;
resolverEntry.isToken = isToken;
}
resolverEntry.updatedAtBlockNumber = block.number;
resolverEntry.updatedAtTimestamp = block.timestamp;
Expand Down

0 comments on commit 0cb3fd9

Please sign in to comment.