From 962789661b261de1eac8ec716d304643d4606ec0 Mon Sep 17 00:00:00 2001 From: Jan-Felix Date: Tue, 9 Jan 2024 09:52:02 +0100 Subject: [PATCH] remove contract detection by bytecode 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 --- packages/app/src/utils/contracts.ts | 10 ---------- packages/app/src/utils/modulesValidation.ts | 13 +------------ 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/packages/app/src/utils/contracts.ts b/packages/app/src/utils/contracts.ts index 8cf87849..11cd4140 100644 --- a/packages/app/src/utils/contracts.ts +++ b/packages/app/src/utils/contracts.ts @@ -10,7 +10,6 @@ import SafeAppsSDK from "@gnosis.pm/safe-apps-sdk" import { getGenericProxyMaster, getModuleContractMetadata, - getModuleContractMetadataByBytecode, getProxyMaster, isGenericProxy, isGnosisGenericProxy, @@ -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) diff --git a/packages/app/src/utils/modulesValidation.ts b/packages/app/src/utils/modulesValidation.ts index 31133489..f0d942aa 100644 --- a/packages/app/src/utils/modulesValidation.ts +++ b/packages/app/src/utils/modulesValidation.ts @@ -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, } @@ -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 }