Skip to content

Commit

Permalink
remove contract detection by bytecode
Browse files Browse the repository at this point in the history
this blows up the bundle size and is super unreliable (not supporting minor version changes, not supporting libraries), i don't see any real world use case where this would come in helpful
  • Loading branch information
jfschwarz committed Jan 9, 2024
1 parent 2ca2b83 commit 9627896
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
10 changes: 0 additions & 10 deletions packages/app/src/utils/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import SafeAppsSDK from "@gnosis.pm/safe-apps-sdk"
import {
getGenericProxyMaster,
getModuleContractMetadata,
getModuleContractMetadataByBytecode,
getProxyMaster,
isGenericProxy,
isGnosisGenericProxy,
Expand Down Expand Up @@ -194,15 +193,6 @@ export const getModuleData = memoize(
}
}

const standardContract = getModuleContractMetadataByBytecode(bytecode)
if (standardContract) {
return {
address,
implAddress: address,
...standardContract,
}
}

try {
const { ABI, ContractName } = await fetchContractSourceCode(chainId, address)

Expand Down
13 changes: 1 addition & 12 deletions packages/app/src/utils/modulesValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const MODULES_METADATA = {
[ModuleType.EXIT]: EXIT_MODULE_METADATA,
[ModuleType.BRIDGE]: BRIDGE_MODULE_METADATA,
[ModuleType.DELAY]: DELAY_MODIFIER_METADATA,
[ModuleType.ROLES]: ROLES_MODIFIER_METADATA,
[ModuleType.ROLES_V1]: ROLES_MODIFIER_METADATA,
[ModuleType.OZ_GOVERNOR]: OZ_GOVERNOR_METADATA,
[ModuleType.CONNEXT]: CONNEXT_METADATA,
}
Expand All @@ -46,17 +46,6 @@ export function getModuleContractMetadata(
return { type: module, ...MODULES_METADATA[module] }
}

export function getModuleContractMetadataByBytecode(
bytecode: string,
): ModuleContractMetadata | undefined {
const entry = Object.entries(MODULES_METADATA).find(
([, metadata]) => metadata.bytecode === bytecode.toLowerCase().trim(),
)
if (!entry) return
const [type, metadata] = entry
return { ...metadata, type: getModuleType(type) }
}

export function isGnosisGenericProxy(bytecode: string) {
return bytecode.toLowerCase() === GNOSIS_GENERIC_PROXY_CONTRACT_BYTECODE
}
Expand Down

0 comments on commit 9627896

Please sign in to comment.