From 7b611f96e23be32b1f5a29712add178c23fdcb27 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Thu, 28 Oct 2021 17:41:56 -0300 Subject: [PATCH] Fix fallback case on dedup sig function --- src/useErigonHooks.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/useErigonHooks.ts b/src/useErigonHooks.ts index 0d094ba..e0bba21 100644 --- a/src/useErigonHooks.ts +++ b/src/useErigonHooks.ts @@ -5,7 +5,7 @@ import { getAddress } from "@ethersproject/address"; import { Contract } from "@ethersproject/contracts"; import { BigNumber } from "@ethersproject/bignumber"; import { arrayify, hexDataSlice, isHexString } from "@ethersproject/bytes"; -import { rawInputTo4Bytes } from "./use4Bytes"; +import { extract4Bytes } from "./use4Bytes"; import { getInternalOperations } from "./nodeFunctions"; import { TokenMetas, @@ -414,6 +414,7 @@ export const useUniqueSignatures = (traces: TraceGroup[] | undefined) => { while (nextTraces.length > 0) { const traces = nextTraces; nextTraces = []; + for (const t of traces) { if ( t.type === "CALL" || @@ -421,8 +422,12 @@ export const useUniqueSignatures = (traces: TraceGroup[] | undefined) => { t.type === "STATICCALL" || t.type === "CALLCODE" ) { - sigs.add(rawInputTo4Bytes(t.input)); + const fourBytes = extract4Bytes(t.input); + if (fourBytes) { + sigs.add(fourBytes); + } } + if (t.children) { nextTraces.push(...t.children); }