From fe62cbde984035d4ce1e8d2a294d4cde31428107 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Tue, 14 Nov 2023 15:27:48 +0000 Subject: [PATCH] chore: mark some known error types as permanent errors --- libs/permit-utils/src/lib/getTokenPermitInfo.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/permit-utils/src/lib/getTokenPermitInfo.ts b/libs/permit-utils/src/lib/getTokenPermitInfo.ts index d55e6707bf..519ec16d52 100644 --- a/libs/permit-utils/src/lib/getTokenPermitInfo.ts +++ b/libs/permit-utils/src/lib/getTokenPermitInfo.ts @@ -125,6 +125,15 @@ async function actuallyCheckTokenIsPermittable(params: GetTokenPermitInfoParams) if (!isDaiLike) { console.debug(`[checkTokenIsPermittable] Failed to estimate eip-2612 permit for ${tokenAddress}`, e) + + // These might be supported, as they have nonces, but we don't know why the permit call fails + // TODO: further investigate this kind of token + // For now mark them as unsupported and don't check it again + if (/invalid signature/.test(e) || e?.code === 'UNPREDICTABLE_GAS_LIMIT') { + return { ...UNSUPPORTED, name: tokenName } + } + + // Maybe a temporary failure return { error: e.message || e.toString() } }