From 8fafc235fb5f9cb2c66c27669aa77834eb2bf982 Mon Sep 17 00:00:00 2001 From: Jan-Felix Date: Thu, 27 Apr 2023 14:25:21 +0200 Subject: [PATCH 1/2] cleanup --- yarn.lock | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 yarn.lock diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index fb57ccd1..00000000 --- a/yarn.lock +++ /dev/null @@ -1,4 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - From 9b77d435b3338538ec004fac9dcdad124b510136 Mon Sep 17 00:00:00 2001 From: Jan-Felix Date: Tue, 9 May 2023 10:40:47 +0200 Subject: [PATCH 2/2] fix edit roles links for legacy contract versions --- packages/app/package.json | 2 +- packages/app/src/store/modules/helpers.ts | 28 +++++++++++++++---- packages/app/src/store/modules/models.ts | 14 ---------- .../src/views/Panel/item/RoleModuleItem.tsx | 3 +- packages/app/yarn.lock | 8 +++--- 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/packages/app/package.json b/packages/app/package.json index 3f3b10e9..d4ec0f32 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -8,7 +8,7 @@ "@gnosis.pm/safe-apps-react-sdk": "4.6.2", "@gnosis.pm/safe-deployments": "1.17.0", "@gnosis.pm/safe-react-components": "^1.2.0", - "@gnosis.pm/zodiac": "3.2.2", + "@gnosis.pm/zodiac": "3.3.2", "@material-ui/core": "^4.12.4", "@material-ui/icons": "^4.11.3", "@material-ui/lab": "^4.0.0-alpha.61", diff --git a/packages/app/src/store/modules/helpers.ts b/packages/app/src/store/modules/helpers.ts index 4d83bf0d..cc842abc 100644 --- a/packages/app/src/store/modules/helpers.ts +++ b/packages/app/src/store/modules/helpers.ts @@ -2,6 +2,7 @@ import { Contract as MultiCallContract, Provider as MultiCallProvider } from "et import SafeAppsSDK from "@gnosis.pm/safe-apps-sdk" import { ContractAddresses, + ContractVersions, getModuleInstance, KnownContracts, SupportedNetworks, @@ -13,7 +14,6 @@ import { DelayModule, Module, MODULE_NAMES, - MODULE_TYPES, ModuleContract, ModuleOperation, ModuleType, @@ -222,17 +222,33 @@ export function getTransactionsFromSafeTransaction( return [safeTransaction] } +const ZODIAC_CONTRACTS_TO_MODULE_TYPE: Record = { + tellor: ModuleType.TELLOR, + optimisticGovernor: ModuleType.OPTIMISTIC_GOVERNOR, + realityETH: ModuleType.REALITY_ETH, + realityERC20: ModuleType.REALITY_ERC20, + delay: ModuleType.DELAY, + bridge: ModuleType.BRIDGE, + exit: ModuleType.EXIT, + scopeGuard: ModuleType.UNKNOWN, + circulatingSupply: ModuleType.UNKNOWN, + roles: ModuleType.ROLES, + ozGovernor: ModuleType.OZ_GOVERNOR, +} export function getContractsModuleType( chainId: number, masterCopyAddress: string, ): ModuleType { - const masterCopyAddresses = ContractAddresses[chainId as SupportedNetworks] - if (!masterCopyAddresses) return ModuleType.UNKNOWN - const entry = Object.entries(masterCopyAddresses).find(([, address]) => { - return address.toLowerCase() === masterCopyAddress.toLowerCase() + const contractVersions = ContractVersions[chainId as SupportedNetworks] + if (!contractVersions) return ModuleType.UNKNOWN + + const entry = Object.entries(contractVersions).find(([, addresses]) => { + return Object.values(addresses).some( + (address) => address.toLowerCase() === masterCopyAddress.toLowerCase(), + ) }) if (!entry) return ModuleType.UNKNOWN - return MODULE_TYPES[entry[0]] || ModuleType.UNKNOWN + return ZODIAC_CONTRACTS_TO_MODULE_TYPE[entry[0]] || ModuleType.UNKNOWN } /** diff --git a/packages/app/src/store/modules/models.ts b/packages/app/src/store/modules/models.ts index bbc822cb..3b532526 100644 --- a/packages/app/src/store/modules/models.ts +++ b/packages/app/src/store/modules/models.ts @@ -14,20 +14,6 @@ export enum ModuleType { UNKNOWN = "unknown", } -export const MODULE_TYPES: Record = { - tellor: ModuleType.TELLOR, - optimisticGovernor: ModuleType.OPTIMISTIC_GOVERNOR, - realityETH: ModuleType.REALITY_ETH, - realityERC20: ModuleType.REALITY_ERC20, - delay: ModuleType.DELAY, - bridge: ModuleType.BRIDGE, - exit: ModuleType.EXIT, - scopeGuard: ModuleType.UNKNOWN, - circulatingSupply: ModuleType.UNKNOWN, - roles: ModuleType.ROLES, - ozGovernor: ModuleType.OZ_GOVERNOR, -} - export const MODULE_NAMES: Record = { [ModuleType.TELLOR]: "Tellor Module", [ModuleType.OPTIMISTIC_GOVERNOR]: "UMA oSnap Module", diff --git a/packages/app/src/views/Panel/item/RoleModuleItem.tsx b/packages/app/src/views/Panel/item/RoleModuleItem.tsx index 23719f8c..67832bd1 100644 --- a/packages/app/src/views/Panel/item/RoleModuleItem.tsx +++ b/packages/app/src/views/Panel/item/RoleModuleItem.tsx @@ -44,7 +44,6 @@ const useStyles = makeStyles((theme) => ({ export const RoleModuleItem: React.FC = ({ module }) => { const classes = useStyles() const { safe: safeInfo } = useSafeAppsSDK() - const rolesAddress = module.address return (
@@ -67,7 +66,7 @@ export const RoleModuleItem: React.FC = ({ module }) => { noWrap className={classes.link} onClick={() => { - window.location.href = rolesAppUrl(safeInfo, rolesAddress) + window.location.href = rolesAppUrl(safeInfo, module.address) }} underline="always" > diff --git a/packages/app/yarn.lock b/packages/app/yarn.lock index 7ca670e1..137c5753 100644 --- a/packages/app/yarn.lock +++ b/packages/app/yarn.lock @@ -2371,10 +2371,10 @@ dependencies: cross-fetch "^3.1.5" -"@gnosis.pm/zodiac@3.2.2": - version "3.2.2" - resolved "https://registry.yarnpkg.com/@gnosis.pm/zodiac/-/zodiac-3.2.2.tgz#21e20d37a2c623dca61ea8248036cacf46526b0e" - integrity sha512-VQ59OKCEPCGMlBcz9O40ZtsW3irLk9cRxhxx9Ecvq1WmepqQdu3Wv718tHraqYxSPgH+4cIUOof8pMU+9sZ01Q== +"@gnosis.pm/zodiac@3.3.2": + version "3.3.2" + resolved "https://registry.yarnpkg.com/@gnosis.pm/zodiac/-/zodiac-3.3.2.tgz#9d7b2c54b7165b8a9e6bbaf5ee2712c5739dac06" + integrity sha512-Uza/aYrhO+Qor5B5FZpHpdciuTQpeG2P1G5LXhokzLoYBF3nEmPD8XdbNop2tl6LqaghhFdymMZp5n97n7VA5g== dependencies: "@gnosis.pm/mock-contract" "^4.0.0" "@gnosis.pm/safe-contracts" "1.3.0"