Skip to content

Commit

Permalink
chore: mark some known error types as permanent errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alfetopito committed Nov 14, 2023
1 parent a87e4b5 commit fe62cbd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libs/permit-utils/src/lib/getTokenPermitInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
}

Expand Down

0 comments on commit fe62cbd

Please sign in to comment.