Skip to content

Commit

Permalink
fix: set resolver on domain to null if 0x0
Browse files Browse the repository at this point in the history
  • Loading branch information
TateB committed Jul 19, 2023
1 parent 707985b commit 5c95cbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ensRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
// Import types and APIs from graph-ts
import { BigInt, crypto, ens } from "@graphprotocol/graph-ts";

import { concat, createEventID, EMPTY_ADDRESS, ROOT_NODE } from "./utils";
import {
concat,
createEventID,
EMPTY_ADDRESS,
EMPTY_ADDRESS_BYTEARRAY,
ROOT_NODE,
} from "./utils";

// Import event types from the registry contract ABI
import {
Expand Down Expand Up @@ -165,7 +171,7 @@ export function handleNewResolver(event: NewResolverEvent): void {

// if resolver is set to 0x0, set id to null
// we don't want to create a resolver entity for 0x0
if (event.params.resolver.toHexString() === EMPTY_ADDRESS) {
if (event.params.resolver.equals(EMPTY_ADDRESS_BYTEARRAY)) {
id = null;
} else {
id = event.params.resolver
Expand Down
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const ETH_NODE =
export const ROOT_NODE =
"0x0000000000000000000000000000000000000000000000000000000000000000";
export const EMPTY_ADDRESS = "0x0000000000000000000000000000000000000000";
export const EMPTY_ADDRESS_BYTEARRAY = new ByteArray(20);

// Helper for concatenating two byte arrays
export function concat(a: ByteArray, b: ByteArray): ByteArray {
Expand Down

0 comments on commit 5c95cbb

Please sign in to comment.