Skip to content

Commit

Permalink
improve proxy detection
Browse files Browse the repository at this point in the history
  • Loading branch information
jfschwarz committed Feb 10, 2023
1 parent a020bb1 commit 8bd60c2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/app/src/services/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,12 @@ const looksLikeAProxy = (abi: JsonFragment[]) => {
const signatures = Object.keys(iface.functions)
return (
signatures.length === 0 ||
(signatures.length === 1 && looksLike(abi, ["implementation()"])) ||
looksLike(abi, ERC897) ||
looksLike(abi, COMPTROLLER)
signatures ||
looksLike(abi, ["implementation()"]) || // for EIP-897/EIP-1967/... proxies
looksLike(abi, ["comptrollerImplementation()"]) // for Compound Comptroller
)
}

const ERC897 = ["proxyType()", "implementation(address)"]
const COMPTROLLER = ["pendingAdmin()", "comptrollerImplementation()", "pendingComptrollerImplementation()", "admin()"]

const looksLike = (abi: JsonFragment[], expectedFunctions: string[]) => {
const iface = new Interface(abi)
const signatures = Object.keys(iface.functions)
Expand Down

0 comments on commit 8bd60c2

Please sign in to comment.