({
modules: [],
spendingLimits: [],
balances: [],
+ implementation: {
+ value: '',
+ name: null,
+ logoUri: null,
+ },
loaded: false,
nonce: 0,
recurringUser: undefined,
diff --git a/src/logic/safe/store/reducer/safe.ts b/src/logic/safe/store/reducer/safe.ts
index 7e5b621349..fd60e4eca2 100644
--- a/src/logic/safe/store/reducer/safe.ts
+++ b/src/logic/safe/store/reducer/safe.ts
@@ -51,6 +51,9 @@ const updateSafeProps = (prevSafe, safe) => {
List.isList(safe[key])
? record.set(key, safe[key])
: record.update(key, (current) => current.merge(safe[key]))
+ } else {
+ // TODO: temporary fix if type is AddressEx because it's neither a Map, nor has a size property
+ record.set(key, safe[key])
}
} else {
// By default we overwrite the value. This is for strings, numbers and unset values
diff --git a/src/logic/safe/utils/__tests__/safeVersion.test.ts b/src/logic/safe/utils/__tests__/safeVersion.test.ts
index 10cfad951c..44ce634b55 100644
--- a/src/logic/safe/utils/__tests__/safeVersion.test.ts
+++ b/src/logic/safe/utils/__tests__/safeVersion.test.ts
@@ -1,5 +1,6 @@
import { FEATURES } from '@gnosis.pm/safe-react-gateway-sdk'
-import { checkIfSafeNeedsUpdate, hasFeature } from 'src/logic/safe/utils/safeVersion'
+import * as GatewaySDK from '@gnosis.pm/safe-react-gateway-sdk'
+import { checkIfSafeNeedsUpdate, hasFeature, isValidMasterCopy } from 'src/logic/safe/utils/safeVersion'
describe('Check safe version', () => {
it('Calls checkIfSafeNeedUpdate, should return true if the safe version is bellow the target one', async () => {
@@ -36,4 +37,50 @@ describe('Check safe version', () => {
expect(hasFeature(FEATURES.SAFE_APPS, '1.1.1')).toBe(true)
})
})
+
+ describe('isValidMasterCopy', () => {
+ it('returns false if address is not contained in result', async () => {
+ jest.spyOn(GatewaySDK, 'getMasterCopies').mockImplementation(() =>
+ Promise.resolve([
+ {
+ address: '0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552',
+ version: '1.3.0',
+ deployer: 'Gnosis',
+ deployedBlockNumber: 12504268,
+ lastIndexedBlockNumber: 14927028,
+ l2: false,
+ },
+ ]),
+ )
+
+ const isValid = await isValidMasterCopy('1', '0x0000000000000000000000000000000000000005')
+ expect(isValid).toBe(false)
+ })
+
+ it('returns true if address is contained in list', async () => {
+ jest.spyOn(GatewaySDK, 'getMasterCopies').mockImplementation(() =>
+ Promise.resolve([
+ {
+ address: '0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552',
+ version: '1.3.0',
+ deployer: 'Gnosis',
+ deployedBlockNumber: 12504268,
+ lastIndexedBlockNumber: 14927028,
+ l2: false,
+ },
+ {
+ address: '0x3E5c63644E683549055b9Be8653de26E0B4CD36E',
+ version: '1.3.0+L2',
+ deployer: 'Gnosis',
+ deployedBlockNumber: 12504423,
+ lastIndexedBlockNumber: 14927028,
+ l2: true,
+ },
+ ]),
+ )
+
+ const isValid = await isValidMasterCopy('1', '0x3E5c63644E683549055b9Be8653de26E0B4CD36E')
+ expect(isValid).toBe(true)
+ })
+ })
})
diff --git a/src/logic/safe/utils/__tests__/shouldSafeStoreBeUpdated.test.ts b/src/logic/safe/utils/__tests__/shouldSafeStoreBeUpdated.test.ts
index 6b6a60787b..fd5ec47f99 100644
--- a/src/logic/safe/utils/__tests__/shouldSafeStoreBeUpdated.test.ts
+++ b/src/logic/safe/utils/__tests__/shouldSafeStoreBeUpdated.test.ts
@@ -35,6 +35,11 @@ const getMockedOldSafe = ({
{ tokenAddress: mockedActiveTokenAddress1, tokenBalance: '100' },
{ tokenAddress: mockedActiveTokenAddress2, tokenBalance: '10' },
],
+ implementation: {
+ value: '',
+ name: null,
+ logoUri: null,
+ },
loaded: true,
nonce: nonce || 2,
recurringUser: recurringUser || false,
diff --git a/src/logic/safe/utils/safeVersion.ts b/src/logic/safe/utils/safeVersion.ts
index 0c853357f1..b3821d8864 100644
--- a/src/logic/safe/utils/safeVersion.ts
+++ b/src/logic/safe/utils/safeVersion.ts
@@ -1,13 +1,14 @@
import semverLessThan from 'semver/functions/lt'
import semverSatisfies from 'semver/functions/satisfies'
import semverValid from 'semver/functions/valid'
-import { FEATURES } from '@gnosis.pm/safe-react-gateway-sdk'
+import { FEATURES, getMasterCopies } from '@gnosis.pm/safe-react-gateway-sdk'
import { GnosisSafe } from 'src/types/contracts/gnosis_safe.d'
import { getSafeMasterContract } from 'src/logic/contracts/safeContracts'
import { LATEST_SAFE_VERSION } from 'src/utils/constants'
import { Errors, logError } from 'src/logic/exceptions/CodedException'
import { getChainInfo } from 'src/config'
+import { sameAddress } from 'src/logic/wallets/ethAddresses'
const FEATURES_BY_VERSION: Record