diff --git a/packages/subgraph/src/mappings/resolver.ts b/packages/subgraph/src/mappings/resolver.ts index 63248c78bc..e814f18560 100644 --- a/packages/subgraph/src/mappings/resolver.ts +++ b/packages/subgraph/src/mappings/resolver.ts @@ -42,11 +42,14 @@ export function handleRoleRevoked(event: RoleRevoked): void { ev.save(); } +function getIsToken(id: string): boolean { + return Token.load(id) != null; +} + 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); @@ -55,12 +58,12 @@ function getOrInitResolverEntry(id: string, target: Address, block: ethereum.Blo 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; + resolverEntry.isToken = getIsToken(target.toHex()); } // we only update this if the target is not equal to the zero address if (isListed) { - resolverEntry.isToken = isToken; + resolverEntry.isToken = getIsToken(target.toHex()); } resolverEntry.updatedAtBlockNumber = block.number; resolverEntry.updatedAtTimestamp = block.timestamp;