Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Pin supported safe version #207

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/routes/relay/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The service currently only supports safes with a master copy version of 1.3.0
export const SUPPORTED_SAFE_VERSION = '1.3.0';
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Gnosis_safe__factory,
Proxy_factory__factory,
} from '../../../../../contracts/safe/factories/v1.3.0';
import { SUPPORTED_SAFE_VERSION } from '../../../constants';

const proxyFactoryInterface = Proxy_factory__factory.createInterface();

Expand Down Expand Up @@ -72,6 +73,7 @@ export const isValidCreateProxyWithNonceCall = (
}

const proxyFactoryDeployment = getProxyFactoryDeployment({
version: SUPPORTED_SAFE_VERSION,
network: chainId,
});

Expand All @@ -85,9 +87,11 @@ export const isValidCreateProxyWithNonceCall = (
);

const safeL1Deployment = getSafeSingletonDeployment({
version: SUPPORTED_SAFE_VERSION,
network: chainId,
});
const safeL2Deployment = getSafeL2SingletonDeployment({
version: SUPPORTED_SAFE_VERSION,
network: chainId,
});

Expand Down
2 changes: 2 additions & 0 deletions src/routes/relay/entities/schema/transactions/multi-send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getMultiSendCallOnlyDeployment } from '@safe-global/safe-deployments';

import { Multi_send__factory } from '../../../../../contracts/safe/factories/v1.3.0';
import { isValidExecTransactionCall } from './exec-transaction';
import { SUPPORTED_SAFE_VERSION } from '../../../constants';

const multiSendInterface = Multi_send__factory.createInterface();

Expand Down Expand Up @@ -36,6 +37,7 @@ export const isValidMultiSendCall = (
}

const multiSendLib = getMultiSendCallOnlyDeployment({
version: SUPPORTED_SAFE_VERSION,
network: chainId,
});

Expand Down
11 changes: 8 additions & 3 deletions src/routes/relay/entities/schema/transactions/safe.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { ethers } from 'ethers';
import {
SingletonDeployment,
getSafeL2SingletonDeployment,
getSafeSingletonDeployment,
SingletonDeployment,
} from '@safe-global/safe-deployments';
import { SUPPORTED_SAFE_VERSION } from '../../../constants';

/**
* Checks whether data is a call to any method in the specified singleton
Expand Down Expand Up @@ -33,8 +34,12 @@ const isSingletonCalldata = (
* @returns boolean
*/
export const isSafeCalldata = (data: string): boolean => {
const safeL1Deployment = getSafeSingletonDeployment();
const safeL2Deployment = getSafeL2SingletonDeployment();
const safeL1Deployment = getSafeSingletonDeployment({
version: SUPPORTED_SAFE_VERSION,
});
const safeL2Deployment = getSafeL2SingletonDeployment({
version: SUPPORTED_SAFE_VERSION,
});

if (!safeL1Deployment || !safeL2Deployment) {
return false;
Expand Down
11 changes: 8 additions & 3 deletions src/routes/relay/relay.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ import { SupportedChainId } from '../../config/constants';
import {
getMockAddOwnerWithThresholdCalldata,
getMockChangeThresholdCalldata,
getMockCreateProxyWithNonceCalldata,
getMockDisableModuleCalldata,
getMockEnableModuleCalldata,
getMockCreateProxyWithNonceCalldata,
getMockErc20TransferCalldata,
getMockExecTransactionCalldata,
getMockMultiSendCalldata,
getMockSetFallbackHandlerCalldata,
getMockRemoveOwnerCallData,
getMockSetFallbackHandlerCalldata,
getMockSetGuardCalldata,
getMockSwapOwnerCallData,
MOCK_UNSUPPORTED_CALLDATA,
getMockErc20TransferCalldata,
} from '../../__mocks__/transaction-calldata.mock';
import { TestLoggingModule } from '../common/logging/__tests__/test.logging.module';
import { TestSponsorModule } from '../../datasources/sponsor/__tests__/test.sponsor.module';
Expand All @@ -42,24 +42,29 @@ import {
} from '../../datasources/safe-info/safe-info.service.interface';
import { TestCacheModule } from '../../datasources/cache/__tests__/test.cache.module';
import { TestAppProvider } from '../../__tests__/test-app.provider';
import { SUPPORTED_SAFE_VERSION } from './constants';

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const GOERLI_MULTI_SEND_CALL_ONLY_ADDRESS = getMultiSendCallOnlyDeployment({
version: SUPPORTED_SAFE_VERSION,
network: '5',
})!.defaultAddress;

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const GOERLI_L1_SINGLETON_DEPLOYMENT_ADDRESS = getSafeSingletonDeployment({
version: SUPPORTED_SAFE_VERSION,
network: '5',
})!.defaultAddress;

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const GOERLI_L2_SINGLETON_DEPLOYMENT_ADDRESS = getSafeL2SingletonDeployment({
version: SUPPORTED_SAFE_VERSION,
network: '5',
})!.defaultAddress;

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const GOERLI_PROXY_FACTORY_DEPLOYMENT_ADDRESS = getProxyFactoryDeployment({
version: SUPPORTED_SAFE_VERSION,
network: '5',
})!.defaultAddress;

Expand Down