From 4d3825f47307132e174f3e7de5301c13e5501a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 12:28:29 +0200 Subject: [PATCH 01/55] initial commit testing kit --- packages/protocol-kit/package.json | 2 +- packages/testing-kit/hardhat.config.ts | 12 + packages/testing-kit/package.json | 48 + packages/testing-kit/src/config.ts | 118 ++ .../testing-kit/src/contracts/Deps_V1_0_0.sol | 8 + .../testing-kit/src/contracts/Deps_V1_1_1.sol | 12 + .../testing-kit/src/contracts/Deps_V1_2_0.sol | 15 + .../testing-kit/src/contracts/Deps_V1_3_0.sol | 28 + .../testing-kit/src/contracts/Deps_V1_4_1.sol | 28 + .../src/contracts/Deps_passkeys.sol | 219 ++++ .../src/contracts/safe_V1_0_0/GnosisSafe.sol | 354 ++++++ .../src/contracts/safe_V1_0_0/Migrations.sol | 31 + .../contracts/safe_V1_0_0/base/BaseSafe.sol | 24 + .../contracts/safe_V1_0_0/base/Executor.sol | 56 + .../src/contracts/safe_V1_0_0/base/Module.sol | 26 + .../safe_V1_0_0/base/ModuleManager.sol | 103 ++ .../safe_V1_0_0/base/OwnerManager.sol | 165 +++ .../src/contracts/safe_V1_0_0/common/Enum.sol | 12 + .../common/EtherPaymentFallback.sol | 15 + .../safe_V1_0_0/common/MasterCopy.sol | 22 + .../common/SecuredTokenTransfer.sol | 32 + .../safe_V1_0_0/common/SelfAuthorized.sol | 11 + .../safe_V1_0_0/common/SignatureDecoder.sol | 54 + .../safe_V1_0_0/external/SafeMath.sol | 66 ++ .../interfaces/ISignatureValidator.sol | 21 + .../libraries/CreateAndAddModules.sol | 43 + .../safe_V1_0_0/libraries/MultiSend.sol | 37 + .../proxies/DelegateConstructorProxy.sol | 27 + .../safe_V1_0_0/proxies/PayingProxy.sol | 29 + .../contracts/safe_V1_0_0/proxies/Proxy.sol | 36 + .../safe_V1_0_0/proxies/ProxyFactory.sol | 59 + .../src/contracts/safe_V1_1_1/GnosisSafe.sol | 416 +++++++ .../src/contracts/safe_V1_1_1/Migrations.sol | 31 + .../contracts/safe_V1_1_1/base/Executor.sol | 40 + .../safe_V1_1_1/base/FallbackManager.sol | 57 + .../src/contracts/safe_V1_1_1/base/Module.sol | 26 + .../safe_V1_1_1/base/ModuleManager.sol | 145 +++ .../safe_V1_1_1/base/OwnerManager.sol | 165 +++ .../src/contracts/safe_V1_1_1/common/Enum.sol | 11 + .../common/EtherPaymentFallback.sol | 15 + .../safe_V1_1_1/common/MasterCopy.sol | 27 + .../common/SecuredTokenTransfer.sol | 33 + .../safe_V1_1_1/common/SelfAuthorized.sol | 11 + .../safe_V1_1_1/common/SignatureDecoder.sol | 54 + .../safe_V1_1_1/external/SafeMath.sol | 66 ++ .../handler/DefaultCallbackHandler.sol | 40 + .../interfaces/ERC1155TokenReceiver.sol | 36 + .../interfaces/ERC721TokenReceiver.sol | 18 + .../interfaces/ERC777TokensRecipient.sol | 12 + .../interfaces/ISignatureValidator.sol | 25 + .../libraries/CreateAndAddModules.sol | 43 + .../safe_V1_1_1/libraries/CreateCall.sol | 26 + .../safe_V1_1_1/libraries/MultiSend.sol | 59 + .../proxies/DelegateConstructorProxy.sol | 27 + .../proxies/IProxyCreationCallback.sol | 6 + .../safe_V1_1_1/proxies/PayingProxy.sol | 29 + .../contracts/safe_V1_1_1/proxies/Proxy.sol | 47 + .../safe_V1_1_1/proxies/ProxyFactory.sol | 102 ++ .../src/contracts/safe_V1_2_0/GnosisSafe.sol | 421 +++++++ .../src/contracts/safe_V1_2_0/Migrations.sol | 31 + .../contracts/safe_V1_2_0/base/Executor.sol | 40 + .../safe_V1_2_0/base/FallbackManager.sol | 57 + .../src/contracts/safe_V1_2_0/base/Module.sol | 26 + .../safe_V1_2_0/base/ModuleManager.sol | 157 +++ .../safe_V1_2_0/base/OwnerManager.sol | 169 +++ .../src/contracts/safe_V1_2_0/common/Enum.sol | 11 + .../common/EtherPaymentFallback.sol | 15 + .../safe_V1_2_0/common/MasterCopy.sol | 27 + .../common/SecuredTokenTransfer.sol | 33 + .../safe_V1_2_0/common/SelfAuthorized.sol | 11 + .../safe_V1_2_0/common/SignatureDecoder.sol | 54 + .../safe_V1_2_0/external/GnosisSafeMath.sol | 75 ++ .../handler/DefaultCallbackHandler.sol | 40 + .../interfaces/ERC1155TokenReceiver.sol | 36 + .../interfaces/ERC721TokenReceiver.sol | 18 + .../interfaces/ERC777TokensRecipient.sol | 12 + .../interfaces/ISignatureValidator.sol | 25 + .../libraries/CreateAndAddModules.sol | 43 + .../safe_V1_2_0/libraries/CreateCall.sol | 26 + .../safe_V1_2_0/libraries/MultiSend.sol | 59 + .../safe_V1_2_0/modules/DailyLimitModule.sol | 92 ++ .../modules/SocialRecoveryModule.sol | 105 ++ .../modules/StateChannelModule.sol | 89 ++ .../safe_V1_2_0/modules/WhitelistModule.sol | 66 ++ .../proxies/DelegateConstructorProxy.sol | 27 + .../safe_V1_2_0/proxies/GnosisSafeProxy.sol | 47 + .../proxies/GnosisSafeProxyFactory.sol | 102 ++ .../proxies/IProxyCreationCallback.sol | 6 + .../safe_V1_2_0/proxies/PayingProxy.sol | 29 + .../src/deploy/deploy-contracts.ts | 249 ++++ packages/testing-kit/src/index.ts | 1 + packages/testing-kit/tsconfig.build.json | 8 + packages/testing-kit/tsconfig.json | 8 + tsconfig.json | 1 + yarn.lock | 1000 ++++++++++++++++- 95 files changed, 6463 insertions(+), 33 deletions(-) create mode 100644 packages/testing-kit/hardhat.config.ts create mode 100644 packages/testing-kit/package.json create mode 100644 packages/testing-kit/src/config.ts create mode 100644 packages/testing-kit/src/contracts/Deps_V1_0_0.sol create mode 100644 packages/testing-kit/src/contracts/Deps_V1_1_1.sol create mode 100644 packages/testing-kit/src/contracts/Deps_V1_2_0.sol create mode 100644 packages/testing-kit/src/contracts/Deps_V1_3_0.sol create mode 100644 packages/testing-kit/src/contracts/Deps_V1_4_1.sol create mode 100644 packages/testing-kit/src/contracts/Deps_passkeys.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/GnosisSafe.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/Migrations.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/base/BaseSafe.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/base/Executor.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/base/Module.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/base/ModuleManager.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/base/OwnerManager.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/common/Enum.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/common/MasterCopy.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/common/SelfAuthorized.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/common/SignatureDecoder.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/external/SafeMath.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/libraries/MultiSend.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/proxies/PayingProxy.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/proxies/Proxy.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_0_0/proxies/ProxyFactory.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/GnosisSafe.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/Migrations.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/base/Executor.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/base/FallbackManager.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/base/Module.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/base/ModuleManager.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/base/OwnerManager.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/common/Enum.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/common/MasterCopy.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/common/SelfAuthorized.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/common/SignatureDecoder.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/external/SafeMath.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateCall.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/libraries/MultiSend.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/proxies/PayingProxy.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/proxies/Proxy.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_1_1/proxies/ProxyFactory.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/GnosisSafe.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/Migrations.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/base/Executor.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/base/FallbackManager.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/base/Module.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/base/ModuleManager.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/base/OwnerManager.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/common/Enum.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/common/MasterCopy.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/common/SelfAuthorized.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/common/SignatureDecoder.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/external/GnosisSafeMath.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateCall.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/libraries/MultiSend.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/modules/DailyLimitModule.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/modules/StateChannelModule.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/modules/WhitelistModule.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol create mode 100644 packages/testing-kit/src/contracts/safe_V1_2_0/proxies/PayingProxy.sol create mode 100644 packages/testing-kit/src/deploy/deploy-contracts.ts create mode 100644 packages/testing-kit/src/index.ts create mode 100644 packages/testing-kit/tsconfig.build.json create mode 100644 packages/testing-kit/tsconfig.json diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index 918d63714..b20435692 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -66,7 +66,7 @@ "dotenv": "^16.4.5", "ethers": "^6.13.1", "hardhat": "^2.19.3", - "hardhat-deploy": "^0.11.45", + "hardhat-deploy": "^0.12.4", "mocha": "^10.2.0", "nyc": "^15.1.0", "tsconfig-paths": "^4.2.0", diff --git a/packages/testing-kit/hardhat.config.ts b/packages/testing-kit/hardhat.config.ts new file mode 100644 index 000000000..bcc13532f --- /dev/null +++ b/packages/testing-kit/hardhat.config.ts @@ -0,0 +1,12 @@ +import '@nomicfoundation/hardhat-viem' +import 'hardhat-deploy' +import 'tsconfig-paths/register' +import { HardhatUserConfig } from 'hardhat/types' + +import { getHardHatConfig } from './src/config' + +const config: HardhatUserConfig = { + ...getHardHatConfig() +} + +export default config diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json new file mode 100644 index 000000000..bcd2a4ddc --- /dev/null +++ b/packages/testing-kit/package.json @@ -0,0 +1,48 @@ +{ + "name": "@safe-global/testing-kit", + "version": "1.0.0", + "description": "Helper package providing testing utilities", + "main": "dist/src/index.js", + "types": "dist/src/index.d.ts", + "keywords": [ + "Ethereum", + "Wallet", + "Safe", + "Smart Account", + "SDK", + "Testing" + ], + "scripts": { + "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", + "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", + "unbuild": "rimraf dist artifacts deployments cache .nyc_output *.tsbuildinfo", + "build": "yarn unbuild && hardhat compile && NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && yarn copy-files", + "copy-files": "cpx 'artifacts/**/*' dist/artifacts", + "deploy": "hardhat deploy", + "compile": "hardhat compile" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/safe-global/safe-core-sdk.git" + }, + "author": "Safe (https://safe.global)", + "license": "MIT", + "bugs": { + "url": "https://github.com/safe-global/safe-core-sdk/issues" + }, + "files": [ + "dist" + ], + "homepage": "https://github.com/safe-global/safe-core-sdk#readme", + "devDependencies": { + "@gnosis.pm/safe-contracts-v1.3.0": "npm:@gnosis.pm/safe-contracts@1.3.0", + "@nomicfoundation/hardhat-viem": "^2.0.2", + "@openzeppelin/contracts": "^2.5.1", + "@safe-global/safe-contracts-v1.4.1": "npm:@safe-global/safe-contracts@1.4.1", + "@safe-global/safe-core-sdk-types": "^5.0.3", + "cpx": "^1.5.0", + "hardhat": "^2.19.3", + "hardhat-deploy": "^0.12.4", + "tsconfig-paths": "^4.2.0" + } +} diff --git a/packages/testing-kit/src/config.ts b/packages/testing-kit/src/config.ts new file mode 100644 index 000000000..a0a9539fe --- /dev/null +++ b/packages/testing-kit/src/config.ts @@ -0,0 +1,118 @@ +import path from 'path' +import '@nomicfoundation/hardhat-viem' +import 'hardhat-deploy' +import 'tsconfig-paths/register' +import { HardhatUserConfig, HardhatNetworkAccountsUserConfig } from 'hardhat/types' + +type GetHardHatConfig = { + testsDir?: string + testAccounts?: HardhatNetworkAccountsUserConfig + hardhatAccounts?: HardhatNetworkAccountsUserConfig +} + +const HARDHAT_ACCOUNTS = [ + { + balance: '100000000000000000000', + privateKey: '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d' + }, + { + balance: '100000000000000000000', + privateKey: '0x6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1' + }, + { + balance: '100000000000000000000', + privateKey: '0x6370fd033278c143179d81c5526140625662b8daa446c22ee2d73db3707e620c' + }, + { + balance: '100000000000000000000', + privateKey: '0x646f1ce2fdad0e6deeeb5c7e8e5543bdde65e86029e2fd9fc169899c440a7913' + }, + { + balance: '100000000000000000000', + privateKey: '0xadd53f9a7e588d003326d1cbf9e4a43c061aadd9bc938c843a79e7b4fd2ad743' + }, + { + balance: '100000000000000000000', + privateKey: '0x395df67f0c2d2d9fe1ad08d1bc8b6627011959b79c53d7dd6a3536a33ab8a4fd' + }, + { + balance: '100000000000000000000', + privateKey: '0xe485d098507f54e7733a205420dfddbe58db035fa577fc294ebd14db90767a52' + }, + { + balance: '100000000000000000000', + privateKey: '0xa453611d9419d0e56f499079478fd72c37b251a94bfde4d19872c44cf65386e3' + }, + { + balance: '100000000000000000000', + privateKey: '0x829e924fdf021ba3dbbc4225edfece9aca04b929d6e75613329ca6f1d31c0bb4' + }, + { + balance: '100000000000000000000', + privateKey: '0xb0057716d5917badaf911b193b12b910811c1497b5bada8d7711f758981c3773' + } +] + +export function getHardHatConfig({ + testsDir, + testAccounts, + hardhatAccounts = HARDHAT_ACCOUNTS +}: GetHardHatConfig = {}): HardhatUserConfig { + console.log(__dirname) + return { + defaultNetwork: 'hardhat', + solidity: { + compilers: [ + { version: '0.5.17' }, + { version: '0.5.3' }, + { version: '0.8.0' }, + { + version: '0.8.24', + settings: { + optimizer: { + enabled: true, + runs: 10_000_000 + }, + viaIR: false, + evmVersion: 'paris' + } + } + ], + overrides: { + '@gnosis.pm/safe-contracts-v1.3.0/contracts/handler/CompatibilityFallbackHandler.sol': { + version: '0.8.0' + } + } + }, + paths: { + artifacts: path.resolve(__dirname, '../artifacts'), + deploy: path.resolve(__dirname, './deploy'), + sources: path.resolve(__dirname, './contracts'), + tests: testsDir + }, + networks: { + localhost: { + url: 'http://127.0.0.1:8545' + }, + hardhat: { + allowUnlimitedContractSize: true, + blockGasLimit: 100000000, + gas: 100000000, + accounts: hardhatAccounts + }, + sepolia: { + accounts: testAccounts, + url: 'https://sepolia.gateway.tenderly.co' + } + }, + //@ts-expect-error Type not found + compilerOptions: { + paths: { '^@safe-global/testing-kit/(.*)$': ['../testing-kit/src/*'] } + }, + namedAccounts: { + deployer: { + default: 0 + } + } + } +} diff --git a/packages/testing-kit/src/contracts/Deps_V1_0_0.sol b/packages/testing-kit/src/contracts/Deps_V1_0_0.sol new file mode 100644 index 000000000..4ee34e7d3 --- /dev/null +++ b/packages/testing-kit/src/contracts/Deps_V1_0_0.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.5.0 <0.9.0; + +import { ProxyFactory } from "./safe_V1_0_0/proxies/ProxyFactory.sol"; +import { GnosisSafe } from "./safe_V1_0_0/GnosisSafe.sol"; + +contract SafeProxyFactory_SV1_0_0 is ProxyFactory {} +contract Safe_SV1_0_0 is GnosisSafe {} diff --git a/packages/testing-kit/src/contracts/Deps_V1_1_1.sol b/packages/testing-kit/src/contracts/Deps_V1_1_1.sol new file mode 100644 index 000000000..3a6cd8bc4 --- /dev/null +++ b/packages/testing-kit/src/contracts/Deps_V1_1_1.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.5.0 <0.9.0; + +import { ProxyFactory } from "./safe_V1_1_1/proxies/ProxyFactory.sol"; +import { GnosisSafe } from "./safe_V1_1_1/GnosisSafe.sol"; +import { MultiSend } from "./safe_V1_1_1/libraries/MultiSend.sol"; +import { CreateCall } from "./safe_V1_1_1/libraries/CreateCall.sol"; + +contract SafeProxyFactory_SV1_1_1 is ProxyFactory {} +contract Safe_SV1_1_1 is GnosisSafe {} +contract MultiSend_SV1_1_1 is GnosisSafe {} +contract CreateCall_SV1_1_1 is GnosisSafe {} diff --git a/packages/testing-kit/src/contracts/Deps_V1_2_0.sol b/packages/testing-kit/src/contracts/Deps_V1_2_0.sol new file mode 100644 index 000000000..9b5c59e79 --- /dev/null +++ b/packages/testing-kit/src/contracts/Deps_V1_2_0.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.5.0 <0.9.0; + +import { GnosisSafeProxyFactory } from "./safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol"; +import { GnosisSafe } from "./safe_V1_2_0/GnosisSafe.sol"; +import { MultiSend } from "./safe_V1_2_0/libraries/MultiSend.sol"; + +// Testing contracts +import { DailyLimitModule } from "./safe_V1_2_0/modules/DailyLimitModule.sol"; +import { SocialRecoveryModule } from "./safe_V1_2_0/modules/SocialRecoveryModule.sol"; +import { ERC20Mintable } from "@openzeppelin/contracts/token/ERC20/ERC20Mintable.sol"; + +contract SafeProxyFactory_SV1_2_0 is GnosisSafeProxyFactory {} +contract Safe_SV1_2_0 is GnosisSafe {} +contract MultiSend_SV1_2_0 is MultiSend {} diff --git a/packages/testing-kit/src/contracts/Deps_V1_3_0.sol b/packages/testing-kit/src/contracts/Deps_V1_3_0.sol new file mode 100644 index 000000000..7dc0aca90 --- /dev/null +++ b/packages/testing-kit/src/contracts/Deps_V1_3_0.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.7.0 <=0.8.0; + +import { GnosisSafeProxyFactory } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/proxies/GnosisSafeProxyFactory.sol"; +import { GnosisSafe } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/GnosisSafe.sol"; +import { CompatibilityFallbackHandler } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/handler/CompatibilityFallbackHandler.sol"; +import { MultiSend } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/libraries/MultiSend.sol"; +import { MultiSendCallOnly } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/libraries/MultiSendCallOnly.sol"; +import { SignMessageLib } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/examples/libraries/SignMessage.sol"; +import { CreateCall } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/libraries/CreateCall.sol"; +import { DefaultCallbackHandler } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/handler/DefaultCallbackHandler.sol"; +import { SimulateTxAccessor } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/accessors/SimulateTxAccessor.sol"; + +// Testing contracts +import { DebugTransactionGuard } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/examples/guards/DebugTransactionGuard.sol"; + +contract SafeProxyFactory_SV1_3_0 is GnosisSafeProxyFactory {} +contract Safe_SV1_3_0 is GnosisSafe {} +contract CompatibilityFallbackHandler_SV1_3_0 is CompatibilityFallbackHandler {} +contract MultiSend_SV1_3_0 is MultiSend {} +contract MultiSendCallOnly_SV1_3_0 is MultiSendCallOnly {} +contract SignMessageLib_SV1_3_0 is SignMessageLib {} +contract CreateCall_SV1_3_0 is CreateCall {} +contract DefaultCallbackHandler_SV1_3_0 is DefaultCallbackHandler {} +contract SimulateTxAccessor_SV1_3_0 is SimulateTxAccessor {} + +// Testing contracts +contract DebugTransactionGuard_SV1_3_0 is DebugTransactionGuard {} diff --git a/packages/testing-kit/src/contracts/Deps_V1_4_1.sol b/packages/testing-kit/src/contracts/Deps_V1_4_1.sol new file mode 100644 index 000000000..e2d5ac180 --- /dev/null +++ b/packages/testing-kit/src/contracts/Deps_V1_4_1.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.7.0 <0.9.0; + +import { SafeProxyFactory } from "@safe-global/safe-contracts-v1.4.1/contracts/proxies/SafeProxyFactory.sol"; +import { Safe } from "@safe-global/safe-contracts-v1.4.1/contracts/Safe.sol"; +import { CompatibilityFallbackHandler } from "@safe-global/safe-contracts-v1.4.1/contracts/handler/CompatibilityFallbackHandler.sol"; +import { MultiSend } from "@safe-global/safe-contracts-v1.4.1/contracts/libraries/MultiSend.sol"; +import { MultiSendCallOnly } from "@safe-global/safe-contracts-v1.4.1/contracts/libraries/MultiSendCallOnly.sol"; +import { SignMessageLib } from "@safe-global/safe-contracts-v1.4.1/contracts/libraries/SignMessageLib.sol"; +import { CreateCall } from "@safe-global/safe-contracts-v1.4.1/contracts/libraries/CreateCall.sol"; +import { TokenCallbackHandler } from "@safe-global/safe-contracts-v1.4.1/contracts/handler/TokenCallbackHandler.sol"; +import { SimulateTxAccessor } from "@safe-global/safe-contracts-v1.4.1/contracts/accessors/SimulateTxAccessor.sol"; + +// Testing contracts +import { DebugTransactionGuard} from "@safe-global/safe-contracts-v1.4.1/contracts/examples/guards/DebugTransactionGuard.sol"; + +contract SafeProxyFactory_SV1_4_1 is SafeProxyFactory {} +contract Safe_SV1_4_1 is Safe {} +contract CompatibilityFallbackHandler_SV1_4_1 is CompatibilityFallbackHandler {} +contract MultiSend_SV1_4_1 is MultiSend {} +contract MultiSendCallOnly_SV1_4_1 is MultiSendCallOnly {} +contract SignMessageLib_SV1_4_1 is SignMessageLib {} +contract CreateCall_SV1_4_1 is CreateCall {} +contract TokenCallbackHandler_SV1_4_1 is TokenCallbackHandler {} +contract SimulateTxAccessor_SV1_4_1 is SimulateTxAccessor {} + +// Testing contracts +contract DebugTransactionGuard_SV1_4_1 is DebugTransactionGuard {} diff --git a/packages/testing-kit/src/contracts/Deps_passkeys.sol b/packages/testing-kit/src/contracts/Deps_passkeys.sol new file mode 100644 index 000000000..ad204f89c --- /dev/null +++ b/packages/testing-kit/src/contracts/Deps_passkeys.sol @@ -0,0 +1,219 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity 0.8.24; + +import {SafeWebAuthnSignerFactory} from '@safe-global/safe-passkey/contracts/SafeWebAuthnSignerFactory.sol'; +import {FCLP256Verifier} from '@safe-global/safe-passkey/contracts/verifiers/FCLP256Verifier.sol'; +import {SignatureValidator} from '@safe-global/safe-passkey/contracts/base/SignatureValidator.sol'; +import {P256, WebAuthn} from '@safe-global/safe-passkey/contracts/libraries/WebAuthn.sol'; + +/** + * @title Safe Smart Account + * @dev Minimal interface of a Safe smart account. This only includes functions that are used by + * this project. + * @custom:security-contact bounty@safe.global + */ +interface ISafeTest { + /** + * @notice Sets an initial storage of the Safe contract. + * @dev This method can only be called once. If a proxy was created without setting up, anyone + * can call setup and claim the proxy. + * @param owners List of Safe owners. + * @param threshold Number of required confirmations for a Safe transaction. + * @param to Contract address for optional delegate call. + * @param data Data payload for optional delegate call. + * @param fallbackHandler Handler for fallback calls to this contract + * @param paymentToken Token that should be used for the payment (0 is ETH) + * @param payment Value that should be paid + * @param paymentReceiver Address that should receive the payment (or 0 if tx.origin) + */ + function setup( + address[] calldata owners, + uint256 threshold, + address to, + bytes calldata data, + address fallbackHandler, + address paymentToken, + uint256 payment, + address payable paymentReceiver + ) external; + + /** + * @notice Reads `length` bytes of storage in the currents contract + * @param offset - the offset in the current contract's storage in words to start reading from + * @param length - the number of words (32 bytes) of data to read + * @return the bytes that were read. + */ + function getStorageAt(uint256 offset, uint256 length) external view returns (bytes memory); +} + +contract SafeWebAuthnSignerFactory_SV1_4_1 is SafeWebAuthnSignerFactory {} + +contract WebAuthnContract is FCLP256Verifier {} + +// TODO: ADD SHARED SIGNER CONTRACT FROM @safe-global/safe-passkey + +/** + * @title Safe WebAuthn Shared Signer + * @dev A contract for verifying WebAuthn signatures shared by all Safe accounts. This contract uses + * storage from the Safe account itself for full ERC-4337 compatibility. + */ +contract SafeWebAuthnSharedSigner is SignatureValidator { + /** + * @notice Data associated with a WebAuthn signer. It represents the X and Y coordinates of the + * signer's public key as well as the P256 verifiers to use. This is stored in account storage + * starting at the storage slot {SIGNER_SLOT}. + */ + struct Signer { + uint256 x; + uint256 y; + P256.Verifiers verifiers; + } + + /** + * @notice The storage slot of the mapping from shared WebAuthn signer address to signer data. + * @custom:computed-as keccak256("SafeWebAuthnSharedSigner.signer") - 1 + * @dev This value is intentionally computed to be a hash -1 as a precaution to avoid any + * potential issues from unintended hash collisions, and have enough space for all the signer + * fields. Also, this is the slot of a `mapping(address self => Signer)` to ensure that multiple + * {SafeWebAuthnSharedSigner} instances can coexist with the same account. + */ + uint256 private constant _SIGNER_MAPPING_SLOT = + 0x2e0aed53485dc2290ceb5ce14725558ad3e3a09d38c69042410ad15c2b4ea4e8; + + /** + * @notice An error indicating a `CALL` to a function that should only be `DELEGATECALL`-ed. + */ + error NotDelegateCalled(); + + /** + * @notice Address of the shared signer contract itself. + * @dev This is used for determining whether or not the contract is being `DELEGATECALL`-ed when + * setting signer data. + */ + address private immutable _SELF; + + /** + * @notice The starting storage slot on the account containing the signer data. + */ + uint256 public immutable SIGNER_SLOT; + + /** + * @notice Create a new shared WebAuthn signer instance. + */ + constructor() { + _SELF = address(this); + SIGNER_SLOT = uint256(keccak256(abi.encode(address(this), _SIGNER_MAPPING_SLOT))); + } + + /** + * @notice Validates the call is done via `DELEGATECALL`. + */ + modifier onlyDelegateCall() { + if (address(this) == _SELF) { + revert NotDelegateCalled(); + } + _; + } + + /** + * @notice Return the signer configuration for the specified account. + * @dev The calling account must be a Safe, as the signer data is stored in the Safe's storage + * and must be read with the {StorageAccessible} support from the Safe. + * @param account The account to request signer data for. + */ + function getConfiguration(address account) public view returns (Signer memory signer) { + bytes memory getStorageAtData = abi.encodeCall( + ISafeTest(account).getStorageAt, + (SIGNER_SLOT, 3) + ); + + // Call the {StorageAccessible.getStorageAt} with assembly. This allows us to return a + // zeroed out signer configuration instead of reverting for `account`s that are not Safes. + // We also, expect the implementation to behave **exactly** like the Safe's - that is it + // should encode the return data using a standard ABI encoding: + // - The first 32 bytes is the offset of the values bytes array, always `0x20` + // - The second 32 bytes is the length of the values bytes array, always `0x60` + // - the following 3 words (96 bytes) are the values of the signer configuration. + + // solhint-disable-next-line no-inline-assembly + assembly ('memory-safe') { + // Note that Yul expressions are evaluated in reverse order, so the `staticcall` is the + // first thing to be evaluated in the nested `and` expression. + if and( + and( + // The offset of the ABI encoded bytes is 0x20, this should always be the case + // for standard ABI encoding of `(bytes)` tuple that `getStorageAt` returns. + eq(mload(0x00), 0x20), + // The length of the encoded bytes is exactly 0x60 bytes (i.e. 3 words, which is + // exactly how much we read from the Safe's storage in the `getStorageAt` call). + eq(mload(0x20), 0x60) + ), + and( + // The length of the return data should be exactly 0xa0 bytes, which should + // always be the case for the Safe's `getStorageAt` implementation. + eq(returndatasize(), 0xa0), + // The call succeeded. We write the first two words of the return data into the + // scratch space, as we need to inspect them before copying the signer + // signer configuration to our `signer` memory pointer. + staticcall( + gas(), + account, + add(getStorageAtData, 0x20), + mload(getStorageAtData), + 0x00, + 0x40 + ) + ) + ) { + // Copy only the storage values from the return data to our `signer` memory address. + // This only happens on success, so the `signer` value will be zeroed out if any of + // the above conditions fail, indicating that no signer is configured. + returndatacopy(signer, 0x40, 0x60) + } + } + } + + /** + * @notice Sets the signer configuration for the calling account. + * @dev The Safe must call this function with a `DELEGATECALL`, as the signer data is stored in + * the Safe account's storage. + * @param signer The new signer data to set for the calling account. + */ + function configure(Signer memory signer) external onlyDelegateCall { + uint256 signerSlot = SIGNER_SLOT; + Signer storage signerStorage; + + // solhint-disable-next-line no-inline-assembly + assembly ('memory-safe') { + signerStorage.slot := signerSlot + } + + signerStorage.x = signer.x; + signerStorage.y = signer.y; + signerStorage.verifiers = signer.verifiers; + } + + /** + * @inheritdoc SignatureValidator + */ + function _verifySignature( + bytes32 message, + bytes calldata signature + ) internal view virtual override returns (bool isValid) { + Signer memory signer = getConfiguration(msg.sender); + + // Make sure that the signer is configured in the first place. + if (P256.Verifiers.unwrap(signer.verifiers) == 0) { + return false; + } + + isValid = WebAuthn.verifySignature( + message, + signature, + WebAuthn.USER_VERIFICATION, + signer.x, + signer.y, + signer.verifiers + ); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/GnosisSafe.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/GnosisSafe.sol new file mode 100644 index 000000000..526050fc4 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/GnosisSafe.sol @@ -0,0 +1,354 @@ +pragma solidity ^0.5.0; +import "./base/BaseSafe.sol"; +import "./common/MasterCopy.sol"; +import "./common/SignatureDecoder.sol"; +import "./common/SecuredTokenTransfer.sol"; +import "./interfaces/ISignatureValidator.sol"; +import "./external/SafeMath.sol"; + +/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191. +/// @author Stefan George - +/// @author Richard Meissner - +/// @author Ricardo Guilherme Schmidt - (Status Research & Development GmbH) - Gas Token Payment +contract GnosisSafe is MasterCopy, BaseSafe, SignatureDecoder, SecuredTokenTransfer, ISignatureValidator { + + using SafeMath for uint256; + + string public constant NAME = "Gnosis Safe"; + string public constant VERSION = "1.0.0"; + + //keccak256( + // "EIP712Domain(address verifyingContract)" + //); + bytes32 public constant DOMAIN_SEPARATOR_TYPEHASH = 0x035aff83d86937d35b32e04f0ddc6ff469290eef2f1b692d8a815c89404d4749; + + //keccak256( + // "SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)" + //); + bytes32 public constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8; + + //keccak256( + // "SafeMessage(bytes message)" + //); + bytes32 public constant SAFE_MSG_TYPEHASH = 0x60b3cbf8b4a223d68d641b3b6ddf9a298e7f33710cf3d3a9d1146b5a6150fbca; + + event ExecutionFailed(bytes32 txHash); + + uint256 public nonce; + bytes32 public domainSeparator; + // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners + mapping(bytes32 => uint256) public signedMessages; + // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners + mapping(address => mapping(bytes32 => uint256)) public approvedHashes; + + /// @dev Setup function sets initial storage of contract. + /// @param _owners List of Safe owners. + /// @param _threshold Number of required confirmations for a Safe transaction. + /// @param to Contract address for optional delegate call. + /// @param data Data payload for optional delegate call. + /// @param paymentToken Token that should be used for the payment (0 is ETH) + /// @param payment Value that should be paid + /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin) + function setup(address[] calldata _owners, uint256 _threshold, address to, bytes calldata data, address paymentToken, uint256 payment, address payable paymentReceiver) + external + { + require(domainSeparator == 0, "Domain Separator already set!"); + domainSeparator = keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, this)); + setupSafe(_owners, _threshold, to, data); + + if (payment > 0) { + // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself) + // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment + handlePayment(payment, 0, 1, paymentToken, paymentReceiver); + } + } + + /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction. + /// Note: The fees are always transfered, even if the user transaction fails. + /// @param to Destination address of Safe transaction. + /// @param value Ether value of Safe transaction. + /// @param data Data payload of Safe transaction. + /// @param operation Operation type of Safe transaction. + /// @param safeTxGas Gas that should be used for the Safe transaction. + /// @param baseGas Gas costs for that are indipendent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund) + /// @param gasPrice Gas price that should be used for the payment calculation. + /// @param gasToken Token address (or 0 if ETH) that is used for the payment. + /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). + /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v}) + function execTransaction( + address to, + uint256 value, + bytes calldata data, + Enum.Operation operation, + uint256 safeTxGas, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address payable refundReceiver, + bytes calldata signatures + ) + external + returns (bool success) + { + bytes memory txHashData = encodeTransactionData( + to, value, data, operation, // Transaction info + safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, // Payment info + nonce + ); + // Increase nonce and execute transaction. + nonce++; + checkSignatures(keccak256(txHashData), txHashData, signatures, true); + require(gasleft() >= safeTxGas, "Not enough gas to execute safe transaction"); + uint256 gasUsed = gasleft(); + // If no safeTxGas has been set and the gasPrice is 0 we assume that all available gas can be used + success = execute(to, value, data, operation, safeTxGas == 0 && gasPrice == 0 ? gasleft() : safeTxGas); + gasUsed = gasUsed.sub(gasleft()); + if (!success) { + emit ExecutionFailed(keccak256(txHashData)); + } + + // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls + if (gasPrice > 0) { + handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver); + } + } + + function handlePayment( + uint256 gasUsed, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address payable refundReceiver + ) + private + { + uint256 amount = gasUsed.add(baseGas).mul(gasPrice); + // solium-disable-next-line security/no-tx-origin + address payable receiver = refundReceiver == address(0) ? tx.origin : refundReceiver; + if (gasToken == address(0)) { + // solium-disable-next-line security/no-send + require(receiver.send(amount), "Could not pay gas costs with ether"); + } else { + require(transferToken(gasToken, receiver, amount), "Could not pay gas costs with token"); + } + } + + /** + * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise. + * @param dataHash Hash of the data (could be either a message hash or transaction hash) + * @param data That should be signed (this is passed to an external validator contract) + * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash. + * @param consumeHash Indicates that in case of an approved hash the storage can be freed to save gas + */ + function checkSignatures(bytes32 dataHash, bytes memory data, bytes memory signatures, bool consumeHash) + internal + { + // Check that the provided signature data is not too short + require(signatures.length >= threshold.mul(65), "Signatures data too short"); + // There cannot be an owner with address 0. + address lastOwner = address(0); + address currentOwner; + uint8 v; + bytes32 r; + bytes32 s; + uint256 i; + for (i = 0; i < threshold; i++) { + (v, r, s) = signatureSplit(signatures, i); + // If v is 0 then it is a contract signature + if (v == 0) { + // When handling contract signatures the address of the contract is encoded into r + currentOwner = address(uint256(r)); + + // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes + // This check is not completely accurate, since it is possible that more signatures than the threshold are send. + // Here we only check that the pointer is not pointing inside the part that is being processed + require(uint256(s) >= threshold.mul(65), "Invalid contract signature location: inside static part"); + + // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes) + require(uint256(s).add(32) <= signatures.length, "Invalid contract signature location: length not present"); + + // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length + uint256 contractSignatureLen; + // solium-disable-next-line security/no-inline-assembly + assembly { + contractSignatureLen := mload(add(add(signatures, s), 0x20)) + } + require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, "Invalid contract signature location: data not complete"); + + // Check signature + bytes memory contractSignature; + // solium-disable-next-line security/no-inline-assembly + assembly { + // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s + contractSignature := add(add(signatures, s), 0x20) + } + require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, "Invalid contract signature provided"); + // If v is 1 then it is an approved hash + } else if (v == 1) { + // When handling approved hashes the address of the approver is encoded into r + currentOwner = address(uint256(r)); + // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction + require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, "Hash has not been approved"); + // Hash has been marked for consumption. If this hash was pre-approved free storage + if (consumeHash && msg.sender != currentOwner) { + approvedHashes[currentOwner][dataHash] = 0; + } + } else { + // Use ecrecover with the messageHash for EOA signatures + currentOwner = ecrecover(dataHash, v, r, s); + } + require (currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, "Invalid owner provided"); + lastOwner = currentOwner; + } + } + + /// @dev Allows to estimate a Safe transaction. + /// This method is only meant for estimation purpose, therfore two different protection mechanism against execution in a transaction have been made: + /// 1.) The method can only be called from the safe itself + /// 2.) The response is returned with a revert + /// When estimating set `from` to the address of the safe. + /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction` + /// @param to Destination address of Safe transaction. + /// @param value Ether value of Safe transaction. + /// @param data Data payload of Safe transaction. + /// @param operation Operation type of Safe transaction. + /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs). + function requiredTxGas(address to, uint256 value, bytes calldata data, Enum.Operation operation) + external + authorized + returns (uint256) + { + uint256 startGas = gasleft(); + // We don't provide an error message here, as we use it to return the estimate + // solium-disable-next-line error-reason + require(execute(to, value, data, operation, gasleft())); + uint256 requiredGas = startGas - gasleft(); + // Convert response to string and return via error message + revert(string(abi.encodePacked(requiredGas))); + } + + /** + * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature. + * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract. + */ + function approveHash(bytes32 hashToApprove) + external + { + require(owners[msg.sender] != address(0), "Only owners can approve a hash"); + approvedHashes[msg.sender][hashToApprove] = 1; + } + + /** + * @dev Marks a message as signed + * @param _data Arbitrary length data that should be marked as signed on the behalf of address(this) + */ + function signMessage(bytes calldata _data) + external + authorized + { + signedMessages[getMessageHash(_data)] = 1; + } + + /** + * @dev Should return whether the signature provided is valid for the provided data + * @param _data Arbitrary length data signed on the behalf of address(this) + * @param _signature Signature byte array associated with _data + * @return a bool upon valid or invalid signature with corresponding _data + */ + function isValidSignature(bytes calldata _data, bytes calldata _signature) + external + returns (bytes4) + { + bytes32 messageHash = getMessageHash(_data); + if (_signature.length == 0) { + require(signedMessages[messageHash] != 0, "Hash not approved"); + } else { + // consumeHash needs to be false, as the state should not be changed + checkSignatures(messageHash, _data, _signature, false); + } + return EIP1271_MAGIC_VALUE; + } + + /// @dev Returns hash of a message that can be signed by owners. + /// @param message Message that should be hashed + /// @return Message hash. + function getMessageHash( + bytes memory message + ) + public + view + returns (bytes32) + { + bytes32 safeMessageHash = keccak256( + abi.encode(SAFE_MSG_TYPEHASH, keccak256(message)) + ); + return keccak256( + abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeMessageHash) + ); + } + + /// @dev Returns the bytes that are hashed to be signed by owners. + /// @param to Destination address. + /// @param value Ether value. + /// @param data Data payload. + /// @param operation Operation type. + /// @param safeTxGas Fas that should be used for the safe transaction. + /// @param baseGas Gas costs for data used to trigger the safe transaction. + /// @param gasPrice Maximum gas price that should be used for this transaction. + /// @param gasToken Token address (or 0 if ETH) that is used for the payment. + /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). + /// @param _nonce Transaction nonce. + /// @return Transaction hash bytes. + function encodeTransactionData( + address to, + uint256 value, + bytes memory data, + Enum.Operation operation, + uint256 safeTxGas, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address refundReceiver, + uint256 _nonce + ) + public + view + returns (bytes memory) + { + bytes32 safeTxHash = keccak256( + abi.encode(SAFE_TX_TYPEHASH, to, value, keccak256(data), operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce) + ); + return abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeTxHash); + } + + /// @dev Returns hash to be signed by owners. + /// @param to Destination address. + /// @param value Ether value. + /// @param data Data payload. + /// @param operation Operation type. + /// @param safeTxGas Fas that should be used for the safe transaction. + /// @param baseGas Gas costs for data used to trigger the safe transaction. + /// @param gasPrice Maximum gas price that should be used for this transaction. + /// @param gasToken Token address (or 0 if ETH) that is used for the payment. + /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). + /// @param _nonce Transaction nonce. + /// @return Transaction hash. + function getTransactionHash( + address to, + uint256 value, + bytes memory data, + Enum.Operation operation, + uint256 safeTxGas, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address refundReceiver, + uint256 _nonce + ) + public + view + returns (bytes32) + { + return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce)); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/Migrations.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/Migrations.sol new file mode 100644 index 000000000..4e1701555 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/Migrations.sol @@ -0,0 +1,31 @@ +pragma solidity ^0.5.0; + +contract Migrations { + address public owner; + uint public last_completed_migration; + + modifier restricted() { + if (msg.sender == owner) _; + } + + constructor() + public + { + owner = msg.sender; + } + + function setCompleted(uint completed) + public + restricted + { + last_completed_migration = completed; + } + + function upgrade(address new_address) + public + restricted + { + Migrations upgraded = Migrations(new_address); + upgraded.setCompleted(last_completed_migration); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/BaseSafe.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/base/BaseSafe.sol new file mode 100644 index 000000000..9e35a6638 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/base/BaseSafe.sol @@ -0,0 +1,24 @@ +pragma solidity ^0.5.0; +import "./Module.sol"; +import "./ModuleManager.sol"; +import "./OwnerManager.sol"; + + +/// @title Base Safe - A multisignature wallet with support for modules and owners. This contract needs to be extented to add functionality to execute transactions. +/// @author Stefan George - +/// @author Richard Meissner - +contract BaseSafe is ModuleManager, OwnerManager { + + /// @dev Setup function sets initial storage of contract. + /// @param _owners List of Safe owners. + /// @param _threshold Number of required confirmations for a Safe transaction. + /// @param to Contract address for optional delegate call. + /// @param data Data payload for optional delegate call. + function setupSafe(address[] memory _owners, uint256 _threshold, address to, bytes memory data) + internal + { + setupOwners(_owners, _threshold); + // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules + setupModules(to, data); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/Executor.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/base/Executor.sol new file mode 100644 index 000000000..8b2d87269 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/base/Executor.sol @@ -0,0 +1,56 @@ +pragma solidity ^0.5.0; +import "../common/Enum.sol"; +import "../common/EtherPaymentFallback.sol"; + + +/// @title Executor - A contract that can execute transactions +/// @author Richard Meissner - +contract Executor is EtherPaymentFallback { + + event ContractCreation(address newContract); + + function execute(address to, uint256 value, bytes memory data, Enum.Operation operation, uint256 txGas) + internal + returns (bool success) + { + if (operation == Enum.Operation.Call) + success = executeCall(to, value, data, txGas); + else if (operation == Enum.Operation.DelegateCall) + success = executeDelegateCall(to, data, txGas); + else { + address newContract = executeCreate(data); + success = newContract != address(0); + emit ContractCreation(newContract); + } + } + + function executeCall(address to, uint256 value, bytes memory data, uint256 txGas) + internal + returns (bool success) + { + // solium-disable-next-line security/no-inline-assembly + assembly { + success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0) + } + } + + function executeDelegateCall(address to, bytes memory data, uint256 txGas) + internal + returns (bool success) + { + // solium-disable-next-line security/no-inline-assembly + assembly { + success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0) + } + } + + function executeCreate(bytes memory data) + internal + returns (address newContract) + { + // solium-disable-next-line security/no-inline-assembly + assembly { + newContract := create(0, add(data, 0x20), mload(data)) + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/Module.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/base/Module.sol new file mode 100644 index 000000000..eb33929ca --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/base/Module.sol @@ -0,0 +1,26 @@ +pragma solidity ^0.5.0; +import "../common/MasterCopy.sol"; +import "./ModuleManager.sol"; + + +/// @title Module - Base class for modules. +/// @author Stefan George - +/// @author Richard Meissner - +contract Module is MasterCopy { + + ModuleManager public manager; + + modifier authorized() { + require(msg.sender == address(manager), "Method can only be called from manager"); + _; + } + + function setManager() + internal + { + // manager can only be 0 at initalization of contract. + // Check ensures that setup function can only be called once. + require(address(manager) == address(0), "Manager has already been set"); + manager = ModuleManager(msg.sender); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/ModuleManager.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/base/ModuleManager.sol new file mode 100644 index 000000000..0ae55ef23 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/base/ModuleManager.sol @@ -0,0 +1,103 @@ +pragma solidity ^0.5.0; +import "../common/Enum.sol"; +import "../common/SelfAuthorized.sol"; +import "./Executor.sol"; +import "./Module.sol"; + + +/// @title Module Manager - A contract that manages modules that can execute transactions via this contract +/// @author Stefan George - +/// @author Richard Meissner - +contract ModuleManager is SelfAuthorized, Executor { + + event EnabledModule(Module module); + event DisabledModule(Module module); + + address public constant SENTINEL_MODULES = address(0x1); + + mapping (address => address) internal modules; + + function setupModules(address to, bytes memory data) + internal + { + require(modules[SENTINEL_MODULES] == address(0), "Modules have already been initialized"); + modules[SENTINEL_MODULES] = SENTINEL_MODULES; + if (to != address(0)) + // Setup has to complete successfully or transaction fails. + require(executeDelegateCall(to, data, gasleft()), "Could not finish initialization"); + } + + /// @dev Allows to add a module to the whitelist. + /// This can only be done via a Safe transaction. + /// @param module Module to be whitelisted. + function enableModule(Module module) + public + authorized + { + // Module address cannot be null or sentinel. + require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); + // Module cannot be added twice. + require(modules[address(module)] == address(0), "Module has already been added"); + modules[address(module)] = modules[SENTINEL_MODULES]; + modules[SENTINEL_MODULES] = address(module); + emit EnabledModule(module); + } + + /// @dev Allows to remove a module from the whitelist. + /// This can only be done via a Safe transaction. + /// @param prevModule Module that pointed to the module to be removed in the linked list + /// @param module Module to be removed. + function disableModule(Module prevModule, Module module) + public + authorized + { + // Validate module address and check that it corresponds to module index. + require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); + require(modules[address(prevModule)] == address(module), "Invalid prevModule, module pair provided"); + modules[address(prevModule)] = modules[address(module)]; + modules[address(module)] = address(0); + emit DisabledModule(module); + } + + /// @dev Allows a Module to execute a Safe transaction without any further confirmations. + /// @param to Destination address of module transaction. + /// @param value Ether value of module transaction. + /// @param data Data payload of module transaction. + /// @param operation Operation type of module transaction. + function execTransactionFromModule(address to, uint256 value, bytes memory data, Enum.Operation operation) + public + returns (bool success) + { + // Only whitelisted modules are allowed. + require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), "Method can only be called from an enabled module"); + // Execute transaction without further confirmations. + success = execute(to, value, data, operation, gasleft()); + } + + /// @dev Returns array of modules. + /// @return Array of modules. + function getModules() + public + view + returns (address[] memory) + { + // Calculate module count + uint256 moduleCount = 0; + address currentModule = modules[SENTINEL_MODULES]; + while(currentModule != SENTINEL_MODULES) { + currentModule = modules[currentModule]; + moduleCount ++; + } + address[] memory array = new address[](moduleCount); + + // populate return array + moduleCount = 0; + currentModule = modules[SENTINEL_MODULES]; + while(currentModule != SENTINEL_MODULES) { + array[moduleCount] = currentModule; + currentModule = modules[currentModule]; + moduleCount ++; + } + return array; + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/OwnerManager.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/base/OwnerManager.sol new file mode 100644 index 000000000..ba0f53008 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/base/OwnerManager.sol @@ -0,0 +1,165 @@ +pragma solidity ^0.5.0; +import "../common/SelfAuthorized.sol"; + +/// @title OwnerManager - Manages a set of owners and a threshold to perform actions. +/// @author Stefan George - +/// @author Richard Meissner - +contract OwnerManager is SelfAuthorized { + + event AddedOwner(address owner); + event RemovedOwner(address owner); + event ChangedThreshold(uint256 threshold); + + address public constant SENTINEL_OWNERS = address(0x1); + + mapping(address => address) internal owners; + uint256 ownerCount; + uint256 internal threshold; + + /// @dev Setup function sets initial storage of contract. + /// @param _owners List of Safe owners. + /// @param _threshold Number of required confirmations for a Safe transaction. + function setupOwners(address[] memory _owners, uint256 _threshold) + internal + { + // Threshold can only be 0 at initialization. + // Check ensures that setup function can only be called once. + require(threshold == 0, "Owners have already been setup"); + // Validate that threshold is smaller than number of added owners. + require(_threshold <= _owners.length, "Threshold cannot exceed owner count"); + // There has to be at least one Safe owner. + require(_threshold >= 1, "Threshold needs to be greater than 0"); + // Initializing Safe owners. + address currentOwner = SENTINEL_OWNERS; + for (uint256 i = 0; i < _owners.length; i++) { + // Owner address cannot be null. + address owner = _owners[i]; + require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); + // No duplicate owners allowed. + require(owners[owner] == address(0), "Duplicate owner address provided"); + owners[currentOwner] = owner; + currentOwner = owner; + } + owners[currentOwner] = SENTINEL_OWNERS; + ownerCount = _owners.length; + threshold = _threshold; + } + + /// @dev Allows to add a new owner to the Safe and update the threshold at the same time. + /// This can only be done via a Safe transaction. + /// @param owner New owner address. + /// @param _threshold New threshold. + function addOwnerWithThreshold(address owner, uint256 _threshold) + public + authorized + { + // Owner address cannot be null. + require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); + // No duplicate owners allowed. + require(owners[owner] == address(0), "Address is already an owner"); + owners[owner] = owners[SENTINEL_OWNERS]; + owners[SENTINEL_OWNERS] = owner; + ownerCount++; + emit AddedOwner(owner); + // Change threshold if threshold was changed. + if (threshold != _threshold) + changeThreshold(_threshold); + } + + /// @dev Allows to remove an owner from the Safe and update the threshold at the same time. + /// This can only be done via a Safe transaction. + /// @param prevOwner Owner that pointed to the owner to be removed in the linked list + /// @param owner Owner address to be removed. + /// @param _threshold New threshold. + function removeOwner(address prevOwner, address owner, uint256 _threshold) + public + authorized + { + // Only allow to remove an owner, if threshold can still be reached. + require(ownerCount - 1 >= _threshold, "New owner count needs to be larger than new threshold"); + // Validate owner address and check that it corresponds to owner index. + require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); + require(owners[prevOwner] == owner, "Invalid prevOwner, owner pair provided"); + owners[prevOwner] = owners[owner]; + owners[owner] = address(0); + ownerCount--; + emit RemovedOwner(owner); + // Change threshold if threshold was changed. + if (threshold != _threshold) + changeThreshold(_threshold); + } + + /// @dev Allows to swap/replace an owner from the Safe with another address. + /// This can only be done via a Safe transaction. + /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list + /// @param oldOwner Owner address to be replaced. + /// @param newOwner New owner address. + function swapOwner(address prevOwner, address oldOwner, address newOwner) + public + authorized + { + // Owner address cannot be null. + require(newOwner != address(0) && newOwner != SENTINEL_OWNERS, "Invalid owner address provided"); + // No duplicate owners allowed. + require(owners[newOwner] == address(0), "Address is already an owner"); + // Validate oldOwner address and check that it corresponds to owner index. + require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, "Invalid owner address provided"); + require(owners[prevOwner] == oldOwner, "Invalid prevOwner, owner pair provided"); + owners[newOwner] = owners[oldOwner]; + owners[prevOwner] = newOwner; + owners[oldOwner] = address(0); + emit RemovedOwner(oldOwner); + emit AddedOwner(newOwner); + } + + /// @dev Allows to update the number of required confirmations by Safe owners. + /// This can only be done via a Safe transaction. + /// @param _threshold New threshold. + function changeThreshold(uint256 _threshold) + public + authorized + { + // Validate that threshold is smaller than number of owners. + require(_threshold <= ownerCount, "Threshold cannot exceed owner count"); + // There has to be at least one Safe owner. + require(_threshold >= 1, "Threshold needs to be greater than 0"); + threshold = _threshold; + emit ChangedThreshold(threshold); + } + + function getThreshold() + public + view + returns (uint256) + { + return threshold; + } + + function isOwner(address owner) + public + view + returns (bool) + { + return owner != SENTINEL_OWNERS && owners[owner] != address(0); + } + + /// @dev Returns array of owners. + /// @return Array of Safe owners. + function getOwners() + public + view + returns (address[] memory) + { + address[] memory array = new address[](ownerCount); + + // populate return array + uint256 index = 0; + address currentOwner = owners[SENTINEL_OWNERS]; + while(currentOwner != SENTINEL_OWNERS) { + array[index] = currentOwner; + currentOwner = owners[currentOwner]; + index ++; + } + return array; + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/Enum.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/Enum.sol new file mode 100644 index 000000000..2df024acc --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/common/Enum.sol @@ -0,0 +1,12 @@ +pragma solidity ^0.5.0; + + +/// @title Enum - Collection of enums +/// @author Richard Meissner - +contract Enum { + enum Operation { + Call, + DelegateCall, + Create + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol new file mode 100644 index 000000000..a4f8a1a2e --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol @@ -0,0 +1,15 @@ +pragma solidity ^0.5.0; + + +/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments +/// @author Richard Meissner - +contract EtherPaymentFallback { + + /// @dev Fallback function accepts Ether transactions. + function () + external + payable + { + + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/MasterCopy.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/MasterCopy.sol new file mode 100644 index 000000000..a24f86954 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/common/MasterCopy.sol @@ -0,0 +1,22 @@ +pragma solidity ^0.5.0; +import "./SelfAuthorized.sol"; + + +/// @title MasterCopy - Base for master copy contracts (should always be first super contract) +/// @author Richard Meissner - +contract MasterCopy is SelfAuthorized { + // masterCopy always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract. + // It should also always be ensured that the address is stored alone (uses a full word) + address masterCopy; + + /// @dev Allows to upgrade the contract. This can only be done via a Safe transaction. + /// @param _masterCopy New contract address. + function changeMasterCopy(address _masterCopy) + public + authorized + { + // Master copy address cannot be null. + require(_masterCopy != address(0), "Invalid master copy address provided"); + masterCopy = _masterCopy; + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol new file mode 100644 index 000000000..546512406 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol @@ -0,0 +1,32 @@ +pragma solidity ^0.5.0; + + +/// @title SecuredTokenTransfer - Secure token transfer +/// @author Richard Meissner - +contract SecuredTokenTransfer { + + /// @dev Transfers a token and returns if it was a success + /// @param token Token that should be transferred + /// @param receiver Receiver to whom the token should be transferred + /// @param amount The amount of tokens that should be transferred + function transferToken ( + address token, + address receiver, + uint256 amount + ) + internal + returns (bool transferred) + { + bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", receiver, amount); + // solium-disable-next-line security/no-inline-assembly + assembly { + let success := call(sub(gas, 10000), token, 0, add(data, 0x20), mload(data), 0, 0) + let ptr := mload(0x40) + returndatacopy(ptr, 0, returndatasize) + switch returndatasize + case 0 { transferred := success } + case 0x20 { transferred := iszero(or(iszero(success), iszero(mload(ptr)))) } + default { transferred := 0 } + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/SelfAuthorized.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/SelfAuthorized.sol new file mode 100644 index 000000000..d8da5ffbe --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/common/SelfAuthorized.sol @@ -0,0 +1,11 @@ +pragma solidity ^0.5.0; + + +/// @title SelfAuthorized - authorizes current contract to perform actions +/// @author Richard Meissner - +contract SelfAuthorized { + modifier authorized() { + require(msg.sender == address(this), "Method can only be called from this contract"); + _; + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/SignatureDecoder.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/SignatureDecoder.sol new file mode 100644 index 000000000..ec966eee5 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/common/SignatureDecoder.sol @@ -0,0 +1,54 @@ +pragma solidity ^0.5.0; + + +/// @title SignatureDecoder - Decodes signatures that a encoded as bytes +/// @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) +/// @author Richard Meissner - +contract SignatureDecoder { + + /// @dev Recovers address who signed the message + /// @param messageHash operation ethereum signed message hash + /// @param messageSignature message `txHash` signature + /// @param pos which signature to read + function recoverKey ( + bytes32 messageHash, + bytes memory messageSignature, + uint256 pos + ) + internal + pure + returns (address) + { + uint8 v; + bytes32 r; + bytes32 s; + (v, r, s) = signatureSplit(messageSignature, pos); + return ecrecover(messageHash, v, r, s); + } + + /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`. + /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures + /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access + /// @param signatures concatenated rsv signatures + function signatureSplit(bytes memory signatures, uint256 pos) + internal + pure + returns (uint8 v, bytes32 r, bytes32 s) + { + // The signature format is a compact form of: + // {bytes32 r}{bytes32 s}{uint8 v} + // Compact means, uint8 is not padded to 32 bytes. + // solium-disable-next-line security/no-inline-assembly + assembly { + let signaturePos := mul(0x41, pos) + r := mload(add(signatures, add(signaturePos, 0x20))) + s := mload(add(signatures, add(signaturePos, 0x40))) + // Here we are loading the last 32 bytes, including 31 bytes + // of 's'. There is no 'mload8' to do this. + // + // 'byte' is not working due to the Solidity parser, so lets + // use the second best option, 'and' + v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff) + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/external/SafeMath.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/external/SafeMath.sol new file mode 100644 index 000000000..84f95a0d9 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/external/SafeMath.sol @@ -0,0 +1,66 @@ +pragma solidity ^0.5.0; + +/** + * @title SafeMath + * @dev Math operations with safety checks that revert on error + * TODO: remove once open zeppelin update to solc 0.5.0 + */ +library SafeMath { + + /** + * @dev Multiplies two numbers, reverts on overflow. + */ + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + // Gas optimization: this is cheaper than requiring 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (a == 0) { + return 0; + } + + uint256 c = a * b; + require(c / a == b); + + return c; + } + + /** + * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. + */ + function div(uint256 a, uint256 b) internal pure returns (uint256) { + require(b > 0); // Solidity only automatically asserts when dividing by 0 + uint256 c = a / b; + // assert(a == b * c + a % b); // There is no case in which this doesn't hold + + return c; + } + + /** + * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). + */ + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + require(b <= a); + uint256 c = a - b; + + return c; + } + + /** + * @dev Adds two numbers, reverts on overflow. + */ + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c >= a); + + return c; + } + + /** + * @dev Divides two numbers and returns the remainder (unsigned integer modulo), + * reverts when dividing by zero. + */ + function mod(uint256 a, uint256 b) internal pure returns (uint256) { + require(b != 0); + return a % b; + } +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol new file mode 100644 index 000000000..e16e36927 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol @@ -0,0 +1,21 @@ +pragma solidity ^0.5.0; + +contract ISignatureValidator { + // bytes4(keccak256("isValidSignature(bytes,bytes)") + bytes4 constant internal EIP1271_MAGIC_VALUE = 0x20c13b0b; + + /** + * @dev Should return whether the signature provided is valid for the provided data + * @param _data Arbitrary length data signed on the behalf of address(this) + * @param _signature Signature byte array associated with _data + * + * MUST return the bytes4 magic value 0x20c13b0b when function passes. + * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5) + * MUST allow external calls + */ + function isValidSignature( + bytes calldata _data, + bytes calldata _signature) + external + returns (bytes4); +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol new file mode 100644 index 000000000..e2022512b --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol @@ -0,0 +1,43 @@ +pragma solidity ^0.5.0; +import "../base/Module.sol"; + + +/// @title Create and Add Modules - Allows to create and add multiple module in one transaction. +/// @author Stefan George - +/// @author Richard Meissner - +contract CreateAndAddModules { + + /// @dev Function required to compile contract. Gnosis Safe function is called instead. + /// @param module Not used. + function enableModule(Module module) + public + { + revert(); + } + + /// @dev Allows to create and add multiple module in one transaction. + /// @param proxyFactory Module proxy factory contract. + /// @param data Modules constructor payload. This is the data for each proxy factory call concatinated. (e.g. ) + function createAndAddModules(address proxyFactory, bytes memory data) + public + { + uint256 length = data.length; + Module module; + uint256 i = 0; + while (i < length) { + // solium-disable-next-line security/no-inline-assembly + assembly { + let createBytesLength := mload(add(0x20, add(data, i))) + let createBytes := add(0x40, add(data, i)) + + let output := mload(0x40) + if eq(delegatecall(gas, proxyFactory, createBytes, createBytesLength, output, 0x20), 0) { revert(0, 0) } + module := and(mload(output), 0xffffffffffffffffffffffffffffffffffffffff) + + // Data is always padded to 32 bytes + i := add(i, add(0x20, mul(div(add(createBytesLength, 0x1f), 0x20), 0x20))) + } + this.enableModule(module); + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/MultiSend.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/MultiSend.sol new file mode 100644 index 000000000..b561262fc --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/MultiSend.sol @@ -0,0 +1,37 @@ +pragma solidity ^0.5.0; + + +/// @title Multi Send - Allows to batch multiple transactions into one. +/// @author Nick Dodson - +/// @author Gonçalo Sá - +/// @author Stefan George - +contract MultiSend { + + /// @dev Sends multiple transactions and reverts all if one fails. + /// @param transactions Encoded transactions. Each transaction is encoded as a + /// tuple(operation,address,uint256,bytes), where operation + /// can be 0 for a call or 1 for a delegatecall. The bytes + /// of all encoded transactions are concatenated to form the input. + function multiSend(bytes memory transactions) + public + { + // solium-disable-next-line security/no-inline-assembly + assembly { + let length := mload(transactions) + let i := 0x20 + for { } lt(i, length) { } { + let operation := mload(add(transactions, i)) + let to := mload(add(transactions, add(i, 0x20))) + let value := mload(add(transactions, add(i, 0x40))) + let dataLength := mload(add(transactions, add(i, 0x80))) + let data := add(transactions, add(i, 0xa0)) + let success := 0 + switch operation + case 0 { success := call(gas, to, value, data, dataLength, 0, 0) } + case 1 { success := delegatecall(gas, to, data, dataLength, 0, 0) } + if eq(success, 0) { revert(0, 0) } + i := add(i, add(0xa0, mul(div(add(dataLength, 0x1f), 0x20), 0x20))) + } + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol new file mode 100644 index 000000000..bf26631bf --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol @@ -0,0 +1,27 @@ +pragma solidity ^0.5.0; +import "./Proxy.sol"; + + +/// @title Delegate Constructor Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. +/// @author Stefan George - +/// @author Richard Meissner - +contract DelegateConstructorProxy is Proxy { + + /// @dev Constructor function sets address of master copy contract. + /// @param _masterCopy Master copy address. + /// @param initializer Data used for a delegate call to initialize the contract. + constructor(address _masterCopy, bytes memory initializer) Proxy(_masterCopy) + public + { + if (initializer.length > 0) { + // solium-disable-next-line security/no-inline-assembly + assembly { + let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) + let success := delegatecall(sub(gas, 10000), masterCopy, add(initializer, 0x20), mload(initializer), 0, 0) + let ptr := mload(0x40) + returndatacopy(ptr, 0, returndatasize) + if eq(success, 0) { revert(ptr, returndatasize) } + } + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/PayingProxy.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/PayingProxy.sol new file mode 100644 index 000000000..d3f8f6ba1 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/PayingProxy.sol @@ -0,0 +1,29 @@ +pragma solidity ^0.5.0; +import "../common/SecuredTokenTransfer.sol"; +import "./DelegateConstructorProxy.sol"; + +/// @title Paying Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. And sends funds after creation to a specified account. +/// @author Stefan George - +/// @author Richard Meissner - +contract PayingProxy is DelegateConstructorProxy, SecuredTokenTransfer { + + /// @dev Constructor function sets address of master copy contract. + /// @param _masterCopy Master copy address. + /// @param initializer Data used for a delegate call to initialize the contract. + /// @param funder Address that should be paid for the execution of this call + /// @param paymentToken Token that should be used for the payment (0 is ETH) + /// @param payment Value that should be paid + constructor(address _masterCopy, bytes memory initializer, address payable funder, address paymentToken, uint256 payment) + DelegateConstructorProxy(_masterCopy, initializer) + public + { + if (payment > 0) { + if (paymentToken == address(0)) { + // solium-disable-next-line security/no-send + require(funder.send(payment), "Could not pay safe creation with ether"); + } else { + require(transferToken(paymentToken, funder, payment), "Could not pay safe creation with token"); + } + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/Proxy.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/Proxy.sol new file mode 100644 index 000000000..e2c2a15d2 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/Proxy.sol @@ -0,0 +1,36 @@ +pragma solidity ^0.5.0; + + +/// @title Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. +/// @author Stefan George - +contract Proxy { + + // masterCopy always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. + // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` + address internal masterCopy; + + /// @dev Constructor function sets address of master copy contract. + /// @param _masterCopy Master copy address. + constructor(address _masterCopy) + public + { + require(_masterCopy != address(0), "Invalid master copy address provided"); + masterCopy = _masterCopy; + } + + /// @dev Fallback function forwards all transactions and returns all received return data. + function () + external + payable + { + // solium-disable-next-line security/no-inline-assembly + assembly { + let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) + calldatacopy(0, 0, calldatasize()) + let success := delegatecall(gas, masterCopy, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + if eq(success, 0) { revert(0, returndatasize()) } + return(0, returndatasize()) + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/ProxyFactory.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/ProxyFactory.sol new file mode 100644 index 000000000..7431d7beb --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/ProxyFactory.sol @@ -0,0 +1,59 @@ +pragma solidity ^0.5.3; +import "./Proxy.sol"; + + +/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. +/// @author Stefan George - +contract ProxyFactory { + + event ProxyCreation(Proxy proxy); + + /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. + /// @param masterCopy Address of master copy. + /// @param data Payload for message call sent to new proxy contract. + function createProxy(address masterCopy, bytes memory data) + public + returns (Proxy proxy) + { + proxy = new Proxy(masterCopy); + if (data.length > 0) + // solium-disable-next-line security/no-inline-assembly + assembly { + if eq(call(gas, proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } + } + emit ProxyCreation(proxy); + } + + /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. + function proxyRuntimeCode() public pure returns (bytes memory) { + return type(Proxy).runtimeCode; + } + + /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. + function proxyCreationCode() public pure returns (bytes memory) { + return type(Proxy).creationCode; + } + + /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. + /// @param _mastercopy Address of master copy. + /// @param initializer Payload for message call sent to new proxy contract. + /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. + function createProxyWithNonce(address _mastercopy, bytes memory initializer, uint256 saltNonce) + public + returns (Proxy proxy) + { + // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it + bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); + bytes memory deploymentData = abi.encodePacked(type(Proxy).creationCode, uint256(_mastercopy)); + // solium-disable-next-line security/no-inline-assembly + assembly { + proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) + } + if (initializer.length > 0) + // solium-disable-next-line security/no-inline-assembly + assembly { + if eq(call(gas, proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0,0) } + } + emit ProxyCreation(proxy); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/GnosisSafe.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/GnosisSafe.sol new file mode 100644 index 000000000..ae72291c3 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/GnosisSafe.sol @@ -0,0 +1,416 @@ +pragma solidity >=0.5.0 <0.7.0; +import "./base/ModuleManager.sol"; +import "./base/OwnerManager.sol"; +import "./base/FallbackManager.sol"; +import "./common/MasterCopy.sol"; +import "./common/SignatureDecoder.sol"; +import "./common/SecuredTokenTransfer.sol"; +import "./interfaces/ISignatureValidator.sol"; +import "./external/SafeMath.sol"; + +/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191. +/// @author Stefan George - +/// @author Richard Meissner - +/// @author Ricardo Guilherme Schmidt - (Status Research & Development GmbH) - Gas Token Payment +contract GnosisSafe + is MasterCopy, ModuleManager, OwnerManager, SignatureDecoder, SecuredTokenTransfer, ISignatureValidatorConstants, FallbackManager { + + using SafeMath for uint256; + + string public constant NAME = "Gnosis Safe"; + string public constant VERSION = "1.1.1"; + + //keccak256( + // "EIP712Domain(address verifyingContract)" + //); + bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x035aff83d86937d35b32e04f0ddc6ff469290eef2f1b692d8a815c89404d4749; + + //keccak256( + // "SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)" + //); + bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8; + + //keccak256( + // "SafeMessage(bytes message)" + //); + bytes32 private constant SAFE_MSG_TYPEHASH = 0x60b3cbf8b4a223d68d641b3b6ddf9a298e7f33710cf3d3a9d1146b5a6150fbca; + + event ApproveHash( + bytes32 indexed approvedHash, + address indexed owner + ); + event SignMsg( + bytes32 indexed msgHash + ); + event ExecutionFailure( + bytes32 txHash, uint256 payment + ); + event ExecutionSuccess( + bytes32 txHash, uint256 payment + ); + + uint256 public nonce; + bytes32 public domainSeparator; + // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners + mapping(bytes32 => uint256) public signedMessages; + // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners + mapping(address => mapping(bytes32 => uint256)) public approvedHashes; + + // This constructor ensures that this contract can only be used as a master copy for Proxy contracts + constructor() public { + // By setting the threshold it is not possible to call setup anymore, + // so we create a Safe with 0 owners and threshold 1. + // This is an unusable Safe, perfect for the mastercopy + threshold = 1; + } + + /// @dev Setup function sets initial storage of contract. + /// @param _owners List of Safe owners. + /// @param _threshold Number of required confirmations for a Safe transaction. + /// @param to Contract address for optional delegate call. + /// @param data Data payload for optional delegate call. + /// @param fallbackHandler Handler for fallback calls to this contract + /// @param paymentToken Token that should be used for the payment (0 is ETH) + /// @param payment Value that should be paid + /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin) + function setup( + address[] calldata _owners, + uint256 _threshold, + address to, + bytes calldata data, + address fallbackHandler, + address paymentToken, + uint256 payment, + address payable paymentReceiver + ) + external + { + require(domainSeparator == 0, "Domain Separator already set!"); + domainSeparator = keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, this)); + setupOwners(_owners, _threshold); + if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler); + // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules + setupModules(to, data); + + if (payment > 0) { + // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself) + // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment + handlePayment(payment, 0, 1, paymentToken, paymentReceiver); + } + } + + /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction. + /// Note: The fees are always transfered, even if the user transaction fails. + /// @param to Destination address of Safe transaction. + /// @param value Ether value of Safe transaction. + /// @param data Data payload of Safe transaction. + /// @param operation Operation type of Safe transaction. + /// @param safeTxGas Gas that should be used for the Safe transaction. + /// @param baseGas Gas costs for that are indipendent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund) + /// @param gasPrice Gas price that should be used for the payment calculation. + /// @param gasToken Token address (or 0 if ETH) that is used for the payment. + /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). + /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v}) + function execTransaction( + address to, + uint256 value, + bytes calldata data, + Enum.Operation operation, + uint256 safeTxGas, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address payable refundReceiver, + bytes calldata signatures + ) + external + returns (bool success) + { + bytes32 txHash; + // Use scope here to limit variable lifetime and prevent `stack too deep` errors + { + bytes memory txHashData = encodeTransactionData( + to, value, data, operation, // Transaction info + safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, // Payment info + nonce + ); + // Increase nonce and execute transaction. + nonce++; + txHash = keccak256(txHashData); + checkSignatures(txHash, txHashData, signatures, true); + } + require(gasleft() >= safeTxGas, "Not enough gas to execute safe transaction"); + // Use scope here to limit variable lifetime and prevent `stack too deep` errors + { + uint256 gasUsed = gasleft(); + // If no safeTxGas has been set and the gasPrice is 0 we assume that all available gas can be used + success = execute(to, value, data, operation, safeTxGas == 0 && gasPrice == 0 ? gasleft() : safeTxGas); + gasUsed = gasUsed.sub(gasleft()); + // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls + uint256 payment = 0; + if (gasPrice > 0) { + payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver); + } + if (success) emit ExecutionSuccess(txHash, payment); + else emit ExecutionFailure(txHash, payment); + } + } + + function handlePayment( + uint256 gasUsed, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address payable refundReceiver + ) + private + returns (uint256 payment) + { + // solium-disable-next-line security/no-tx-origin + address payable receiver = refundReceiver == address(0) ? tx.origin : refundReceiver; + if (gasToken == address(0)) { + // For ETH we will only adjust the gas price to not be higher than the actual used gas price + payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice); + // solium-disable-next-line security/no-send + require(receiver.send(payment), "Could not pay gas costs with ether"); + } else { + payment = gasUsed.add(baseGas).mul(gasPrice); + require(transferToken(gasToken, receiver, payment), "Could not pay gas costs with token"); + } + } + + /** + * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise. + * @param dataHash Hash of the data (could be either a message hash or transaction hash) + * @param data That should be signed (this is passed to an external validator contract) + * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash. + * @param consumeHash Indicates that in case of an approved hash the storage can be freed to save gas + */ + function checkSignatures(bytes32 dataHash, bytes memory data, bytes memory signatures, bool consumeHash) + internal + { + // Load threshold to avoid multiple storage loads + uint256 _threshold = threshold; + // Check that a threshold is set + require(_threshold > 0, "Threshold needs to be defined!"); + // Check that the provided signature data is not too short + require(signatures.length >= _threshold.mul(65), "Signatures data too short"); + // There cannot be an owner with address 0. + address lastOwner = address(0); + address currentOwner; + uint8 v; + bytes32 r; + bytes32 s; + uint256 i; + for (i = 0; i < _threshold; i++) { + (v, r, s) = signatureSplit(signatures, i); + // If v is 0 then it is a contract signature + if (v == 0) { + // When handling contract signatures the address of the contract is encoded into r + currentOwner = address(uint256(r)); + + // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes + // This check is not completely accurate, since it is possible that more signatures than the threshold are send. + // Here we only check that the pointer is not pointing inside the part that is being processed + require(uint256(s) >= _threshold.mul(65), "Invalid contract signature location: inside static part"); + + // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes) + require(uint256(s).add(32) <= signatures.length, "Invalid contract signature location: length not present"); + + // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length + uint256 contractSignatureLen; + // solium-disable-next-line security/no-inline-assembly + assembly { + contractSignatureLen := mload(add(add(signatures, s), 0x20)) + } + require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, "Invalid contract signature location: data not complete"); + + // Check signature + bytes memory contractSignature; + // solium-disable-next-line security/no-inline-assembly + assembly { + // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s + contractSignature := add(add(signatures, s), 0x20) + } + require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, "Invalid contract signature provided"); + // If v is 1 then it is an approved hash + } else if (v == 1) { + // When handling approved hashes the address of the approver is encoded into r + currentOwner = address(uint256(r)); + // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction + require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, "Hash has not been approved"); + // Hash has been marked for consumption. If this hash was pre-approved free storage + if (consumeHash && msg.sender != currentOwner) { + approvedHashes[currentOwner][dataHash] = 0; + } + } else if (v > 30) { + // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover + currentOwner = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", dataHash)), v - 4, r, s); + } else { + // Use ecrecover with the messageHash for EOA signatures + currentOwner = ecrecover(dataHash, v, r, s); + } + require ( + currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, + "Invalid owner provided" + ); + lastOwner = currentOwner; + } + } + + /// @dev Allows to estimate a Safe transaction. + /// This method is only meant for estimation purpose, therefore two different protection mechanism against execution in a transaction have been made: + /// 1.) The method can only be called from the safe itself + /// 2.) The response is returned with a revert + /// When estimating set `from` to the address of the safe. + /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction` + /// @param to Destination address of Safe transaction. + /// @param value Ether value of Safe transaction. + /// @param data Data payload of Safe transaction. + /// @param operation Operation type of Safe transaction. + /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs). + function requiredTxGas(address to, uint256 value, bytes calldata data, Enum.Operation operation) + external + authorized + returns (uint256) + { + uint256 startGas = gasleft(); + // We don't provide an error message here, as we use it to return the estimate + // solium-disable-next-line error-reason + require(execute(to, value, data, operation, gasleft())); + uint256 requiredGas = startGas - gasleft(); + // Convert response to string and return via error message + revert(string(abi.encodePacked(requiredGas))); + } + + /** + * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature. + * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract. + */ + function approveHash(bytes32 hashToApprove) + external + { + require(owners[msg.sender] != address(0), "Only owners can approve a hash"); + approvedHashes[msg.sender][hashToApprove] = 1; + emit ApproveHash(hashToApprove, msg.sender); + } + + /** + * @dev Marks a message as signed + * @param _data Arbitrary length data that should be marked as signed on the behalf of address(this) + */ + function signMessage(bytes calldata _data) + external + authorized + { + bytes32 msgHash = getMessageHash(_data); + signedMessages[msgHash] = 1; + emit SignMsg(msgHash); + } + + /** + * Implementation of ISignatureValidator (see `interfaces/ISignatureValidator.sol`) + * @dev Should return whether the signature provided is valid for the provided data. + * The save does not implement the interface since `checkSignatures` is not a view method. + * The method will not perform any state changes (see parameters of `checkSignatures`) + * @param _data Arbitrary length data signed on the behalf of address(this) + * @param _signature Signature byte array associated with _data + * @return a bool upon valid or invalid signature with corresponding _data + */ + function isValidSignature(bytes calldata _data, bytes calldata _signature) + external + returns (bytes4) + { + bytes32 messageHash = getMessageHash(_data); + if (_signature.length == 0) { + require(signedMessages[messageHash] != 0, "Hash not approved"); + } else { + // consumeHash needs to be false, as the state should not be changed + checkSignatures(messageHash, _data, _signature, false); + } + return EIP1271_MAGIC_VALUE; + } + + /// @dev Returns hash of a message that can be signed by owners. + /// @param message Message that should be hashed + /// @return Message hash. + function getMessageHash( + bytes memory message + ) + public + view + returns (bytes32) + { + bytes32 safeMessageHash = keccak256( + abi.encode(SAFE_MSG_TYPEHASH, keccak256(message)) + ); + return keccak256( + abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeMessageHash) + ); + } + + /// @dev Returns the bytes that are hashed to be signed by owners. + /// @param to Destination address. + /// @param value Ether value. + /// @param data Data payload. + /// @param operation Operation type. + /// @param safeTxGas Fas that should be used for the safe transaction. + /// @param baseGas Gas costs for data used to trigger the safe transaction. + /// @param gasPrice Maximum gas price that should be used for this transaction. + /// @param gasToken Token address (or 0 if ETH) that is used for the payment. + /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). + /// @param _nonce Transaction nonce. + /// @return Transaction hash bytes. + function encodeTransactionData( + address to, + uint256 value, + bytes memory data, + Enum.Operation operation, + uint256 safeTxGas, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address refundReceiver, + uint256 _nonce + ) + public + view + returns (bytes memory) + { + bytes32 safeTxHash = keccak256( + abi.encode(SAFE_TX_TYPEHASH, to, value, keccak256(data), operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce) + ); + return abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeTxHash); + } + + /// @dev Returns hash to be signed by owners. + /// @param to Destination address. + /// @param value Ether value. + /// @param data Data payload. + /// @param operation Operation type. + /// @param safeTxGas Fas that should be used for the safe transaction. + /// @param baseGas Gas costs for data used to trigger the safe transaction. + /// @param gasPrice Maximum gas price that should be used for this transaction. + /// @param gasToken Token address (or 0 if ETH) that is used for the payment. + /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). + /// @param _nonce Transaction nonce. + /// @return Transaction hash. + function getTransactionHash( + address to, + uint256 value, + bytes memory data, + Enum.Operation operation, + uint256 safeTxGas, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address refundReceiver, + uint256 _nonce + ) + public + view + returns (bytes32) + { + return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce)); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/Migrations.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/Migrations.sol new file mode 100644 index 000000000..9ffe9a1d5 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/Migrations.sol @@ -0,0 +1,31 @@ +pragma solidity >=0.5.0 <0.7.0; + +contract Migrations { + address public owner; + uint public last_completed_migration; + + modifier restricted() { + if (msg.sender == owner) _; + } + + constructor() + public + { + owner = msg.sender; + } + + function setCompleted(uint completed) + public + restricted + { + last_completed_migration = completed; + } + + function upgrade(address new_address) + public + restricted + { + Migrations upgraded = Migrations(new_address); + upgraded.setCompleted(last_completed_migration); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/Executor.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/base/Executor.sol new file mode 100644 index 000000000..293c74799 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/base/Executor.sol @@ -0,0 +1,40 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../common/Enum.sol"; + + +/// @title Executor - A contract that can execute transactions +/// @author Richard Meissner - +contract Executor { + + function execute(address to, uint256 value, bytes memory data, Enum.Operation operation, uint256 txGas) + internal + returns (bool success) + { + if (operation == Enum.Operation.Call) + success = executeCall(to, value, data, txGas); + else if (operation == Enum.Operation.DelegateCall) + success = executeDelegateCall(to, data, txGas); + else + success = false; + } + + function executeCall(address to, uint256 value, bytes memory data, uint256 txGas) + internal + returns (bool success) + { + // solium-disable-next-line security/no-inline-assembly + assembly { + success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0) + } + } + + function executeDelegateCall(address to, bytes memory data, uint256 txGas) + internal + returns (bool success) + { + // solium-disable-next-line security/no-inline-assembly + assembly { + success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0) + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/FallbackManager.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/base/FallbackManager.sol new file mode 100644 index 000000000..8de981c45 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/base/FallbackManager.sol @@ -0,0 +1,57 @@ +pragma solidity >=0.5.0 <0.7.0; + +import "../common/SelfAuthorized.sol"; + +/// @title Fallback Manager - A contract that manages fallback calls made to this contract +/// @author Richard Meissner - +contract FallbackManager is SelfAuthorized { + + // keccak256("fallback_manager.handler.address") + bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5; + + function internalSetFallbackHandler(address handler) internal { + bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT; + // solium-disable-next-line security/no-inline-assembly + assembly { + sstore(slot, handler) + } + } + + /// @dev Allows to add a contract to handle fallback calls. + /// Only fallback calls without value and with data will be forwarded. + /// This can only be done via a Safe transaction. + /// @param handler contract to handle fallbacks calls. + function setFallbackHandler(address handler) + public + authorized + { + internalSetFallbackHandler(handler); + } + + function () + external + payable + { + // Only calls without value and with data will be forwarded + if (msg.value > 0 || msg.data.length == 0) { + return; + } + bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT; + address handler; + // solium-disable-next-line security/no-inline-assembly + assembly { + handler := sload(slot) + } + + if (handler != address(0)) { + // solium-disable-next-line security/no-inline-assembly + assembly { + calldatacopy(0, 0, calldatasize()) + let success := call(gas, handler, 0, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + if eq(success, 0) { revert(0, returndatasize()) } + return(0, returndatasize()) + } + } + } +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/Module.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/base/Module.sol new file mode 100644 index 000000000..298fc41ca --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/base/Module.sol @@ -0,0 +1,26 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../common/MasterCopy.sol"; +import "./ModuleManager.sol"; + + +/// @title Module - Base class for modules. +/// @author Stefan George - +/// @author Richard Meissner - +contract Module is MasterCopy { + + ModuleManager public manager; + + modifier authorized() { + require(msg.sender == address(manager), "Method can only be called from manager"); + _; + } + + function setManager() + internal + { + // manager can only be 0 at initalization of contract. + // Check ensures that setup function can only be called once. + require(address(manager) == address(0), "Manager has already been set"); + manager = ModuleManager(msg.sender); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/ModuleManager.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/base/ModuleManager.sol new file mode 100644 index 000000000..747b391e3 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/base/ModuleManager.sol @@ -0,0 +1,145 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../common/Enum.sol"; +import "../common/SelfAuthorized.sol"; +import "./Executor.sol"; +import "./Module.sol"; + + +/// @title Module Manager - A contract that manages modules that can execute transactions via this contract +/// @author Stefan George - +/// @author Richard Meissner - +contract ModuleManager is SelfAuthorized, Executor { + + event EnabledModule(Module module); + event DisabledModule(Module module); + event ExecutionFromModuleSuccess(address indexed module); + event ExecutionFromModuleFailure(address indexed module); + + address internal constant SENTINEL_MODULES = address(0x1); + + mapping (address => address) internal modules; + + function setupModules(address to, bytes memory data) + internal + { + require(modules[SENTINEL_MODULES] == address(0), "Modules have already been initialized"); + modules[SENTINEL_MODULES] = SENTINEL_MODULES; + if (to != address(0)) + // Setup has to complete successfully or transaction fails. + require(executeDelegateCall(to, data, gasleft()), "Could not finish initialization"); + } + + /// @dev Allows to add a module to the whitelist. + /// This can only be done via a Safe transaction. + /// @param module Module to be whitelisted. + function enableModule(Module module) + public + authorized + { + // Module address cannot be null or sentinel. + require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); + // Module cannot be added twice. + require(modules[address(module)] == address(0), "Module has already been added"); + modules[address(module)] = modules[SENTINEL_MODULES]; + modules[SENTINEL_MODULES] = address(module); + emit EnabledModule(module); + } + + /// @dev Allows to remove a module from the whitelist. + /// This can only be done via a Safe transaction. + /// @param prevModule Module that pointed to the module to be removed in the linked list + /// @param module Module to be removed. + function disableModule(Module prevModule, Module module) + public + authorized + { + // Validate module address and check that it corresponds to module index. + require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); + require(modules[address(prevModule)] == address(module), "Invalid prevModule, module pair provided"); + modules[address(prevModule)] = modules[address(module)]; + modules[address(module)] = address(0); + emit DisabledModule(module); + } + + /// @dev Allows a Module to execute a Safe transaction without any further confirmations. + /// @param to Destination address of module transaction. + /// @param value Ether value of module transaction. + /// @param data Data payload of module transaction. + /// @param operation Operation type of module transaction. + function execTransactionFromModule(address to, uint256 value, bytes memory data, Enum.Operation operation) + public + returns (bool success) + { + // Only whitelisted modules are allowed. + require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), "Method can only be called from an enabled module"); + // Execute transaction without further confirmations. + success = execute(to, value, data, operation, gasleft()); + if (success) emit ExecutionFromModuleSuccess(msg.sender); + else emit ExecutionFromModuleFailure(msg.sender); + } + + /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data + /// @param to Destination address of module transaction. + /// @param value Ether value of module transaction. + /// @param data Data payload of module transaction. + /// @param operation Operation type of module transaction. + function execTransactionFromModuleReturnData(address to, uint256 value, bytes memory data, Enum.Operation operation) + public + returns (bool success, bytes memory returnData) + { + success = execTransactionFromModule(to, value, data, operation); + // solium-disable-next-line security/no-inline-assembly + assembly { + // Load free memory location + let ptr := mload(0x40) + // We allocate memory for the return data by setting the free memory location to + // current free memory location + data size + 32 bytes for data size value + mstore(0x40, add(ptr, add(returndatasize(), 0x20))) + // Store the size + mstore(ptr, returndatasize()) + // Store the data + returndatacopy(add(ptr, 0x20), 0, returndatasize()) + // Point the return data to the correct memory location + returnData := ptr + } + } + + /// @dev Returns array of first 10 modules. + /// @return Array of modules. + function getModules() + public + view + returns (address[] memory) + { + (address[] memory array,) = getModulesPaginated(SENTINEL_MODULES, 10); + return array; + } + + /// @dev Returns array of modules. + /// @param start Start of the page. + /// @param pageSize Maximum number of modules that should be returned. + /// @return Array of modules. + function getModulesPaginated(address start, uint256 pageSize) + public + view + returns (address[] memory array, address next) + { + // Init array with max page size + array = new address[](pageSize); + + // Populate return array + uint256 moduleCount = 0; + address currentModule = modules[start]; + while(currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) { + array[moduleCount] = currentModule; + currentModule = modules[currentModule]; + moduleCount++; + } + next = currentModule; + // Set correct size of returned array + // solium-disable-next-line security/no-inline-assembly + assembly { + mstore(array, moduleCount) + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/OwnerManager.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/base/OwnerManager.sol new file mode 100644 index 000000000..4e99e4ea1 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/base/OwnerManager.sol @@ -0,0 +1,165 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../common/SelfAuthorized.sol"; + +/// @title OwnerManager - Manages a set of owners and a threshold to perform actions. +/// @author Stefan George - +/// @author Richard Meissner - +contract OwnerManager is SelfAuthorized { + + event AddedOwner(address owner); + event RemovedOwner(address owner); + event ChangedThreshold(uint256 threshold); + + address internal constant SENTINEL_OWNERS = address(0x1); + + mapping(address => address) internal owners; + uint256 ownerCount; + uint256 internal threshold; + + /// @dev Setup function sets initial storage of contract. + /// @param _owners List of Safe owners. + /// @param _threshold Number of required confirmations for a Safe transaction. + function setupOwners(address[] memory _owners, uint256 _threshold) + internal + { + // Threshold can only be 0 at initialization. + // Check ensures that setup function can only be called once. + require(threshold == 0, "Owners have already been setup"); + // Validate that threshold is smaller than number of added owners. + require(_threshold <= _owners.length, "Threshold cannot exceed owner count"); + // There has to be at least one Safe owner. + require(_threshold >= 1, "Threshold needs to be greater than 0"); + // Initializing Safe owners. + address currentOwner = SENTINEL_OWNERS; + for (uint256 i = 0; i < _owners.length; i++) { + // Owner address cannot be null. + address owner = _owners[i]; + require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); + // No duplicate owners allowed. + require(owners[owner] == address(0), "Duplicate owner address provided"); + owners[currentOwner] = owner; + currentOwner = owner; + } + owners[currentOwner] = SENTINEL_OWNERS; + ownerCount = _owners.length; + threshold = _threshold; + } + + /// @dev Allows to add a new owner to the Safe and update the threshold at the same time. + /// This can only be done via a Safe transaction. + /// @param owner New owner address. + /// @param _threshold New threshold. + function addOwnerWithThreshold(address owner, uint256 _threshold) + public + authorized + { + // Owner address cannot be null. + require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); + // No duplicate owners allowed. + require(owners[owner] == address(0), "Address is already an owner"); + owners[owner] = owners[SENTINEL_OWNERS]; + owners[SENTINEL_OWNERS] = owner; + ownerCount++; + emit AddedOwner(owner); + // Change threshold if threshold was changed. + if (threshold != _threshold) + changeThreshold(_threshold); + } + + /// @dev Allows to remove an owner from the Safe and update the threshold at the same time. + /// This can only be done via a Safe transaction. + /// @param prevOwner Owner that pointed to the owner to be removed in the linked list + /// @param owner Owner address to be removed. + /// @param _threshold New threshold. + function removeOwner(address prevOwner, address owner, uint256 _threshold) + public + authorized + { + // Only allow to remove an owner, if threshold can still be reached. + require(ownerCount - 1 >= _threshold, "New owner count needs to be larger than new threshold"); + // Validate owner address and check that it corresponds to owner index. + require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); + require(owners[prevOwner] == owner, "Invalid prevOwner, owner pair provided"); + owners[prevOwner] = owners[owner]; + owners[owner] = address(0); + ownerCount--; + emit RemovedOwner(owner); + // Change threshold if threshold was changed. + if (threshold != _threshold) + changeThreshold(_threshold); + } + + /// @dev Allows to swap/replace an owner from the Safe with another address. + /// This can only be done via a Safe transaction. + /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list + /// @param oldOwner Owner address to be replaced. + /// @param newOwner New owner address. + function swapOwner(address prevOwner, address oldOwner, address newOwner) + public + authorized + { + // Owner address cannot be null. + require(newOwner != address(0) && newOwner != SENTINEL_OWNERS, "Invalid owner address provided"); + // No duplicate owners allowed. + require(owners[newOwner] == address(0), "Address is already an owner"); + // Validate oldOwner address and check that it corresponds to owner index. + require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, "Invalid owner address provided"); + require(owners[prevOwner] == oldOwner, "Invalid prevOwner, owner pair provided"); + owners[newOwner] = owners[oldOwner]; + owners[prevOwner] = newOwner; + owners[oldOwner] = address(0); + emit RemovedOwner(oldOwner); + emit AddedOwner(newOwner); + } + + /// @dev Allows to update the number of required confirmations by Safe owners. + /// This can only be done via a Safe transaction. + /// @param _threshold New threshold. + function changeThreshold(uint256 _threshold) + public + authorized + { + // Validate that threshold is smaller than number of owners. + require(_threshold <= ownerCount, "Threshold cannot exceed owner count"); + // There has to be at least one Safe owner. + require(_threshold >= 1, "Threshold needs to be greater than 0"); + threshold = _threshold; + emit ChangedThreshold(threshold); + } + + function getThreshold() + public + view + returns (uint256) + { + return threshold; + } + + function isOwner(address owner) + public + view + returns (bool) + { + return owner != SENTINEL_OWNERS && owners[owner] != address(0); + } + + /// @dev Returns array of owners. + /// @return Array of Safe owners. + function getOwners() + public + view + returns (address[] memory) + { + address[] memory array = new address[](ownerCount); + + // populate return array + uint256 index = 0; + address currentOwner = owners[SENTINEL_OWNERS]; + while(currentOwner != SENTINEL_OWNERS) { + array[index] = currentOwner; + currentOwner = owners[currentOwner]; + index ++; + } + return array; + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/Enum.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/Enum.sol new file mode 100644 index 000000000..3288682a4 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/common/Enum.sol @@ -0,0 +1,11 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title Enum - Collection of enums +/// @author Richard Meissner - +contract Enum { + enum Operation { + Call, + DelegateCall + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol new file mode 100644 index 000000000..7fddb9a28 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol @@ -0,0 +1,15 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments +/// @author Richard Meissner - +contract EtherPaymentFallback { + + /// @dev Fallback function accepts Ether transactions. + function () + external + payable + { + + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/MasterCopy.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/MasterCopy.sol new file mode 100644 index 000000000..1fa27b3e5 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/common/MasterCopy.sol @@ -0,0 +1,27 @@ +pragma solidity >=0.5.0 <0.7.0; +import "./SelfAuthorized.sol"; + + +/// @title MasterCopy - Base for master copy contracts (should always be first super contract) +/// This contract is tightly coupled to our proxy contract (see `proxies/Proxy.sol`) +/// @author Richard Meissner - +contract MasterCopy is SelfAuthorized { + + event ChangedMasterCopy(address masterCopy); + + // masterCopy always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract. + // It should also always be ensured that the address is stored alone (uses a full word) + address private masterCopy; + + /// @dev Allows to upgrade the contract. This can only be done via a Safe transaction. + /// @param _masterCopy New contract address. + function changeMasterCopy(address _masterCopy) + public + authorized + { + // Master copy address cannot be null. + require(_masterCopy != address(0), "Invalid master copy address provided"); + masterCopy = _masterCopy; + emit ChangedMasterCopy(_masterCopy); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol new file mode 100644 index 000000000..1ba688e9f --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol @@ -0,0 +1,33 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title SecuredTokenTransfer - Secure token transfer +/// @author Richard Meissner - +contract SecuredTokenTransfer { + + /// @dev Transfers a token and returns if it was a success + /// @param token Token that should be transferred + /// @param receiver Receiver to whom the token should be transferred + /// @param amount The amount of tokens that should be transferred + function transferToken ( + address token, + address receiver, + uint256 amount + ) + internal + returns (bool transferred) + { + bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", receiver, amount); + // solium-disable-next-line security/no-inline-assembly + assembly { + let success := call(sub(gas, 10000), token, 0, add(data, 0x20), mload(data), 0, 0) + let ptr := mload(0x40) + mstore(0x40, add(ptr, returndatasize())) + returndatacopy(ptr, 0, returndatasize()) + switch returndatasize() + case 0 { transferred := success } + case 0x20 { transferred := iszero(or(iszero(success), iszero(mload(ptr)))) } + default { transferred := 0 } + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/SelfAuthorized.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/SelfAuthorized.sol new file mode 100644 index 000000000..d5892fcf9 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/common/SelfAuthorized.sol @@ -0,0 +1,11 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title SelfAuthorized - authorizes current contract to perform actions +/// @author Richard Meissner - +contract SelfAuthorized { + modifier authorized() { + require(msg.sender == address(this), "Method can only be called from this contract"); + _; + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/SignatureDecoder.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/SignatureDecoder.sol new file mode 100644 index 000000000..87020c465 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/common/SignatureDecoder.sol @@ -0,0 +1,54 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title SignatureDecoder - Decodes signatures that a encoded as bytes +/// @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) +/// @author Richard Meissner - +contract SignatureDecoder { + + /// @dev Recovers address who signed the message + /// @param messageHash operation ethereum signed message hash + /// @param messageSignature message `txHash` signature + /// @param pos which signature to read + function recoverKey ( + bytes32 messageHash, + bytes memory messageSignature, + uint256 pos + ) + internal + pure + returns (address) + { + uint8 v; + bytes32 r; + bytes32 s; + (v, r, s) = signatureSplit(messageSignature, pos); + return ecrecover(messageHash, v, r, s); + } + + /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`. + /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures + /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access + /// @param signatures concatenated rsv signatures + function signatureSplit(bytes memory signatures, uint256 pos) + internal + pure + returns (uint8 v, bytes32 r, bytes32 s) + { + // The signature format is a compact form of: + // {bytes32 r}{bytes32 s}{uint8 v} + // Compact means, uint8 is not padded to 32 bytes. + // solium-disable-next-line security/no-inline-assembly + assembly { + let signaturePos := mul(0x41, pos) + r := mload(add(signatures, add(signaturePos, 0x20))) + s := mload(add(signatures, add(signaturePos, 0x40))) + // Here we are loading the last 32 bytes, including 31 bytes + // of 's'. There is no 'mload8' to do this. + // + // 'byte' is not working due to the Solidity parser, so lets + // use the second best option, 'and' + v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff) + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/external/SafeMath.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/external/SafeMath.sol new file mode 100644 index 000000000..ed3f10406 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/external/SafeMath.sol @@ -0,0 +1,66 @@ +pragma solidity >=0.5.0 <0.7.0; + +/** + * @title SafeMath + * @dev Math operations with safety checks that revert on error + * TODO: remove once open zeppelin update to solc 0.5.0 + */ +library SafeMath { + + /** + * @dev Multiplies two numbers, reverts on overflow. + */ + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + // Gas optimization: this is cheaper than requiring 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (a == 0) { + return 0; + } + + uint256 c = a * b; + require(c / a == b); + + return c; + } + + /** + * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. + */ + function div(uint256 a, uint256 b) internal pure returns (uint256) { + require(b > 0); // Solidity only automatically asserts when dividing by 0 + uint256 c = a / b; + // assert(a == b * c + a % b); // There is no case in which this doesn't hold + + return c; + } + + /** + * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). + */ + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + require(b <= a); + uint256 c = a - b; + + return c; + } + + /** + * @dev Adds two numbers, reverts on overflow. + */ + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c >= a); + + return c; + } + + /** + * @dev Divides two numbers and returns the remainder (unsigned integer modulo), + * reverts when dividing by zero. + */ + function mod(uint256 a, uint256 b) internal pure returns (uint256) { + require(b != 0); + return a % b; + } +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol new file mode 100644 index 000000000..03058d1b0 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol @@ -0,0 +1,40 @@ +pragma solidity >=0.5.0 <0.7.0; + +import "../interfaces/ERC1155TokenReceiver.sol"; +import "../interfaces/ERC721TokenReceiver.sol"; +import "../interfaces/ERC777TokensRecipient.sol"; + +/// @title Default Callback Handler - returns true for known token callbacks +/// @author Richard Meissner - +contract DefaultCallbackHandler is ERC1155TokenReceiver, ERC777TokensRecipient, ERC721TokenReceiver { + + string public constant NAME = "Default Callback Handler"; + string public constant VERSION = "1.0.0"; + + function onERC1155Received(address, address, uint256, uint256, bytes calldata) + external + returns(bytes4) + { + return 0xf23a6e61; + } + + function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) + external + returns(bytes4) + { + return 0xbc197c81; + } + + function onERC721Received(address, address, uint256, bytes calldata) + external + returns(bytes4) + { + return 0x150b7a02; + } + + // solium-disable-next-line no-empty-blocks + function tokensReceived(address, address, address, uint256, bytes calldata, bytes calldata) external { + // We implement this for completeness, doesn't really have any value + } + +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol new file mode 100644 index 000000000..56c72cdff --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol @@ -0,0 +1,36 @@ +pragma solidity >=0.5.0 <0.7.0; + +/** + Note: The ERC-165 identifier for this interface is 0x4e2312e0. +*/ +interface ERC1155TokenReceiver { + /** + @notice Handle the receipt of a single ERC1155 token type. + @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeTransferFrom` after the balance has been updated. + This function MUST return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61) if it accepts the transfer. + This function MUST revert if it rejects the transfer. + Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. + @param _operator The address which initiated the transfer (i.e. msg.sender) + @param _from The address which previously owned the token + @param _id The ID of the token being transferred + @param _value The amount of tokens being transferred + @param _data Additional data with no specified format + @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` + */ + function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _value, bytes calldata _data) external returns(bytes4); + + /** + @notice Handle the receipt of multiple ERC1155 token types. + @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated. + This function MUST return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81) if it accepts the transfer(s). + This function MUST revert if it rejects the transfer(s). + Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. + @param _operator The address which initiated the batch transfer (i.e. msg.sender) + @param _from The address which previously owned the token + @param _ids An array containing ids of each token being transferred (order and length must match _values array) + @param _values An array containing amounts of each token being transferred (order and length must match _ids array) + @param _data Additional data with no specified format + @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` + */ + function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external returns(bytes4); +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol new file mode 100644 index 000000000..2bf050bac --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol @@ -0,0 +1,18 @@ +pragma solidity >=0.5.0 <0.7.0; + +/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02. +interface ERC721TokenReceiver { + /// @notice Handle the receipt of an NFT + /// @dev The ERC721 smart contract calls this function on the recipient + /// after a `transfer`. This function MAY throw to revert and reject the + /// transfer. Return of other than the magic value MUST result in the + /// transaction being reverted. + /// Note: the contract address is always the message sender. + /// @param _operator The address which called `safeTransferFrom` function + /// @param _from The address which previously owned the token + /// @param _tokenId The NFT identifier which is being transferred + /// @param _data Additional data with no specified format + /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` + /// unless throwing + function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external returns(bytes4); +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol new file mode 100644 index 000000000..b8c471377 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol @@ -0,0 +1,12 @@ +pragma solidity >=0.5.0 <0.7.0; + +interface ERC777TokensRecipient { + function tokensReceived( + address operator, + address from, + address to, + uint256 amount, + bytes calldata data, + bytes calldata operatorData + ) external; +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol new file mode 100644 index 000000000..ff8a7478f --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol @@ -0,0 +1,25 @@ +pragma solidity >=0.5.0 <0.7.0; + +contract ISignatureValidatorConstants { + // bytes4(keccak256("isValidSignature(bytes,bytes)") + bytes4 constant internal EIP1271_MAGIC_VALUE = 0x20c13b0b; +} + +contract ISignatureValidator is ISignatureValidatorConstants { + + /** + * @dev Should return whether the signature provided is valid for the provided data + * @param _data Arbitrary length data signed on the behalf of address(this) + * @param _signature Signature byte array associated with _data + * + * MUST return the bytes4 magic value 0x20c13b0b when function passes. + * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5) + * MUST allow external calls + */ + function isValidSignature( + bytes memory _data, + bytes memory _signature) + public + view + returns (bytes4); +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol new file mode 100644 index 000000000..f0ca1d8a9 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol @@ -0,0 +1,43 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../base/Module.sol"; + + +/// @title Create and Add Modules - Allows to create and add multiple module in one transaction. +/// @author Stefan George - +/// @author Richard Meissner - +contract CreateAndAddModules { + + /// @dev Function required to compile contract. Gnosis Safe function is called instead. + /// @param module Not used. + function enableModule(Module module) + public + { + revert(); + } + + /// @dev Allows to create and add multiple module in one transaction. + /// @param proxyFactory Module proxy factory contract. + /// @param data Modules constructor payload. This is the data for each proxy factory call concatinated. (e.g. ) + function createAndAddModules(address proxyFactory, bytes memory data) + public + { + uint256 length = data.length; + Module module; + uint256 i = 0; + while (i < length) { + // solium-disable-next-line security/no-inline-assembly + assembly { + let createBytesLength := mload(add(0x20, add(data, i))) + let createBytes := add(0x40, add(data, i)) + + let output := mload(0x40) + if eq(delegatecall(gas, proxyFactory, createBytes, createBytesLength, output, 0x20), 0) { revert(0, 0) } + module := and(mload(output), 0xffffffffffffffffffffffffffffffffffffffff) + + // Data is always padded to 32 bytes + i := add(i, add(0x20, mul(div(add(createBytesLength, 0x1f), 0x20), 0x20))) + } + this.enableModule(module); + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateCall.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateCall.sol new file mode 100644 index 000000000..9e1564557 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateCall.sol @@ -0,0 +1,26 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title Create Call - Allows to use the different create opcodes to deploy a contract +/// @author Richard Meissner - +contract CreateCall { + event ContractCreation(address newContract); + + function performCreate2(uint256 value, bytes memory deploymentData, bytes32 salt) public returns(address newContract) { + // solium-disable-next-line security/no-inline-assembly + assembly { + newContract := create2(value, add(0x20, deploymentData), mload(deploymentData), salt) + } + require(newContract != address(0), "Could not deploy contract"); + emit ContractCreation(newContract); + } + + function performCreate(uint256 value, bytes memory deploymentData) public returns(address newContract) { + // solium-disable-next-line security/no-inline-assembly + assembly { + newContract := create(value, add(deploymentData, 0x20), mload(deploymentData)) + } + require(newContract != address(0), "Could not deploy contract"); + emit ContractCreation(newContract); + } +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/MultiSend.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/MultiSend.sol new file mode 100644 index 000000000..8bfe010ca --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/MultiSend.sol @@ -0,0 +1,59 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title Multi Send - Allows to batch multiple transactions into one. +/// @author Nick Dodson - +/// @author Gonçalo Sá - +/// @author Stefan George - +/// @author Richard Meissner - +contract MultiSend { + + bytes32 constant private GUARD_VALUE = keccak256("multisend.guard.bytes32"); + + bytes32 guard; + + constructor() public { + guard = GUARD_VALUE; + } + + /// @dev Sends multiple transactions and reverts all if one fails. + /// @param transactions Encoded transactions. Each transaction is encoded as a packed bytes of + /// operation as a uint8 with 0 for a call or 1 for a delegatecall (=> 1 byte), + /// to as a address (=> 20 bytes), + /// value as a uint256 (=> 32 bytes), + /// data length as a uint256 (=> 32 bytes), + /// data as bytes. + /// see abi.encodePacked for more information on packed encoding + function multiSend(bytes memory transactions) + public + { + require(guard != GUARD_VALUE, "MultiSend should only be called via delegatecall"); + // solium-disable-next-line security/no-inline-assembly + assembly { + let length := mload(transactions) + let i := 0x20 + for { } lt(i, length) { } { + // First byte of the data is the operation. + // We shift by 248 bits (256 - 8 [operation byte]) it right since mload will always load 32 bytes (a word). + // This will also zero out unused data. + let operation := shr(0xf8, mload(add(transactions, i))) + // We offset the load address by 1 byte (operation byte) + // We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data. + let to := shr(0x60, mload(add(transactions, add(i, 0x01)))) + // We offset the load address by 21 byte (operation byte + 20 address bytes) + let value := mload(add(transactions, add(i, 0x15))) + // We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes) + let dataLength := mload(add(transactions, add(i, 0x35))) + // We offset the load address by 85 byte (operation byte + 20 address bytes + 32 value bytes + 32 data length bytes) + let data := add(transactions, add(i, 0x55)) + let success := 0 + switch operation + case 0 { success := call(gas, to, value, data, dataLength, 0, 0) } + case 1 { success := delegatecall(gas, to, data, dataLength, 0, 0) } + if eq(success, 0) { revert(0, 0) } + // Next entry starts at 85 byte + data length + i := add(i, add(0x55, dataLength)) + } + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol new file mode 100644 index 000000000..fd7b006e2 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol @@ -0,0 +1,27 @@ +pragma solidity >=0.5.0 <0.7.0; +import "./Proxy.sol"; + + +/// @title Delegate Constructor Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. +/// @author Stefan George - +/// @author Richard Meissner - +contract DelegateConstructorProxy is Proxy { + + /// @dev Constructor function sets address of master copy contract. + /// @param _masterCopy Master copy address. + /// @param initializer Data used for a delegate call to initialize the contract. + constructor(address _masterCopy, bytes memory initializer) Proxy(_masterCopy) + public + { + if (initializer.length > 0) { + // solium-disable-next-line security/no-inline-assembly + assembly { + let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) + let success := delegatecall(sub(gas, 10000), masterCopy, add(initializer, 0x20), mload(initializer), 0, 0) + let ptr := mload(0x40) + returndatacopy(ptr, 0, returndatasize()) + if eq(success, 0) { revert(ptr, returndatasize()) } + } + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol new file mode 100644 index 000000000..bc01952aa --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol @@ -0,0 +1,6 @@ +pragma solidity ^0.5.3; +import "./Proxy.sol"; + +interface IProxyCreationCallback { + function proxyCreated(Proxy proxy, address _mastercopy, bytes calldata initializer, uint256 saltNonce) external; +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/PayingProxy.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/PayingProxy.sol new file mode 100644 index 000000000..0db92a558 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/PayingProxy.sol @@ -0,0 +1,29 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../common/SecuredTokenTransfer.sol"; +import "./DelegateConstructorProxy.sol"; + +/// @title Paying Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. And sends funds after creation to a specified account. +/// @author Stefan George - +/// @author Richard Meissner - +contract PayingProxy is DelegateConstructorProxy, SecuredTokenTransfer { + + /// @dev Constructor function sets address of master copy contract. + /// @param _masterCopy Master copy address. + /// @param initializer Data used for a delegate call to initialize the contract. + /// @param funder Address that should be paid for the execution of this call + /// @param paymentToken Token that should be used for the payment (0 is ETH) + /// @param payment Value that should be paid + constructor(address _masterCopy, bytes memory initializer, address payable funder, address paymentToken, uint256 payment) + DelegateConstructorProxy(_masterCopy, initializer) + public + { + if (payment > 0) { + if (paymentToken == address(0)) { + // solium-disable-next-line security/no-send + require(funder.send(payment), "Could not pay safe creation with ether"); + } else { + require(transferToken(paymentToken, funder, payment), "Could not pay safe creation with token"); + } + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/Proxy.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/Proxy.sol new file mode 100644 index 000000000..c5b6e39bc --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/Proxy.sol @@ -0,0 +1,47 @@ +pragma solidity >=0.5.0 <0.7.0; + +/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain +/// @author Richard Meissner - +interface IProxy { + function masterCopy() external view returns (address); +} + +/// @title Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. +/// @author Stefan George - +/// @author Richard Meissner - +contract Proxy { + + // masterCopy always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. + // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` + address internal masterCopy; + + /// @dev Constructor function sets address of master copy contract. + /// @param _masterCopy Master copy address. + constructor(address _masterCopy) + public + { + require(_masterCopy != address(0), "Invalid master copy address provided"); + masterCopy = _masterCopy; + } + + /// @dev Fallback function forwards all transactions and returns all received return data. + function () + external + payable + { + // solium-disable-next-line security/no-inline-assembly + assembly { + let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) + // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s + if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { + mstore(0, masterCopy) + return(0, 0x20) + } + calldatacopy(0, 0, calldatasize()) + let success := delegatecall(gas, masterCopy, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + if eq(success, 0) { revert(0, returndatasize()) } + return(0, returndatasize()) + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/ProxyFactory.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/ProxyFactory.sol new file mode 100644 index 000000000..0f194e20a --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/ProxyFactory.sol @@ -0,0 +1,102 @@ +pragma solidity ^0.5.3; +import "./Proxy.sol"; +import "./IProxyCreationCallback.sol"; + +/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. +/// @author Stefan George - +contract ProxyFactory { + + event ProxyCreation(Proxy proxy); + + /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. + /// @param masterCopy Address of master copy. + /// @param data Payload for message call sent to new proxy contract. + function createProxy(address masterCopy, bytes memory data) + public + returns (Proxy proxy) + { + proxy = new Proxy(masterCopy); + if (data.length > 0) + // solium-disable-next-line security/no-inline-assembly + assembly { + if eq(call(gas, proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } + } + emit ProxyCreation(proxy); + } + + /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. + function proxyRuntimeCode() public pure returns (bytes memory) { + return type(Proxy).runtimeCode; + } + + /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. + function proxyCreationCode() public pure returns (bytes memory) { + return type(Proxy).creationCode; + } + + /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. + /// This method is only meant as an utility to be called from other methods + /// @param _mastercopy Address of master copy. + /// @param initializer Payload for message call sent to new proxy contract. + /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. + function deployProxyWithNonce(address _mastercopy, bytes memory initializer, uint256 saltNonce) + internal + returns (Proxy proxy) + { + // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it + bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); + bytes memory deploymentData = abi.encodePacked(type(Proxy).creationCode, uint256(_mastercopy)); + // solium-disable-next-line security/no-inline-assembly + assembly { + proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) + } + require(address(proxy) != address(0), "Create2 call failed"); + } + + /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. + /// @param _mastercopy Address of master copy. + /// @param initializer Payload for message call sent to new proxy contract. + /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. + function createProxyWithNonce(address _mastercopy, bytes memory initializer, uint256 saltNonce) + public + returns (Proxy proxy) + { + proxy = deployProxyWithNonce(_mastercopy, initializer, saltNonce); + if (initializer.length > 0) + // solium-disable-next-line security/no-inline-assembly + assembly { + if eq(call(gas, proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0,0) } + } + emit ProxyCreation(proxy); + } + + /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction + /// @param _mastercopy Address of master copy. + /// @param initializer Payload for message call sent to new proxy contract. + /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. + /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. + function createProxyWithCallback(address _mastercopy, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback) + public + returns (Proxy proxy) + { + uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); + proxy = createProxyWithNonce(_mastercopy, initializer, saltNonceWithCallback); + if (address(callback) != address(0)) + callback.proxyCreated(proxy, _mastercopy, initializer, saltNonce); + } + + /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` + /// This method is only meant for address calculation purpose when you use an initializer that would revert, + /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. + /// @param _mastercopy Address of master copy. + /// @param initializer Payload for message call sent to new proxy contract. + /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. + function calculateCreateProxyWithNonceAddress(address _mastercopy, bytes calldata initializer, uint256 saltNonce) + external + returns (Proxy proxy) + { + proxy = deployProxyWithNonce(_mastercopy, initializer, saltNonce); + revert(string(abi.encodePacked(proxy))); + } + +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/GnosisSafe.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/GnosisSafe.sol new file mode 100644 index 000000000..a0d6eff4f --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/GnosisSafe.sol @@ -0,0 +1,421 @@ +pragma solidity >=0.5.0 <0.7.0; +import "./base/ModuleManager.sol"; +import "./base/OwnerManager.sol"; +import "./base/FallbackManager.sol"; +import "./common/MasterCopy.sol"; +import "./common/SignatureDecoder.sol"; +import "./common/SecuredTokenTransfer.sol"; +import "./interfaces/ISignatureValidator.sol"; +import "./external/GnosisSafeMath.sol"; + +/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191. +/// @author Stefan George - +/// @author Richard Meissner - +/// @author Ricardo Guilherme Schmidt - (Status Research & Development GmbH) - Gas Token Payment +contract GnosisSafe + is MasterCopy, ModuleManager, OwnerManager, SignatureDecoder, SecuredTokenTransfer, ISignatureValidatorConstants, FallbackManager { + + using GnosisSafeMath for uint256; + + string public constant NAME = "Gnosis Safe"; + string public constant VERSION = "1.2.0"; + + //keccak256( + // "EIP712Domain(address verifyingContract)" + //); + bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x035aff83d86937d35b32e04f0ddc6ff469290eef2f1b692d8a815c89404d4749; + + //keccak256( + // "SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)" + //); + bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8; + + //keccak256( + // "SafeMessage(bytes message)" + //); + bytes32 private constant SAFE_MSG_TYPEHASH = 0x60b3cbf8b4a223d68d641b3b6ddf9a298e7f33710cf3d3a9d1146b5a6150fbca; + + event ApproveHash( + bytes32 indexed approvedHash, + address indexed owner + ); + event SignMsg( + bytes32 indexed msgHash + ); + event ExecutionFailure( + bytes32 txHash, uint256 payment + ); + event ExecutionSuccess( + bytes32 txHash, uint256 payment + ); + + uint256 public nonce; + bytes32 public domainSeparator; + // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners + mapping(bytes32 => uint256) public signedMessages; + // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners + mapping(address => mapping(bytes32 => uint256)) public approvedHashes; + + // This constructor ensures that this contract can only be used as a master copy for Proxy contracts + constructor() public { + // By setting the threshold it is not possible to call setup anymore, + // so we create a Safe with 0 owners and threshold 1. + // This is an unusable Safe, perfect for the mastercopy + threshold = 1; + } + + /// @dev Setup function sets initial storage of contract. + /// @param _owners List of Safe owners. + /// @param _threshold Number of required confirmations for a Safe transaction. + /// @param to Contract address for optional delegate call. + /// @param data Data payload for optional delegate call. + /// @param fallbackHandler Handler for fallback calls to this contract + /// @param paymentToken Token that should be used for the payment (0 is ETH) + /// @param payment Value that should be paid + /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin) + function setup( + address[] calldata _owners, + uint256 _threshold, + address to, + bytes calldata data, + address fallbackHandler, + address paymentToken, + uint256 payment, + address payable paymentReceiver + ) + external + { + require(domainSeparator == 0, "Domain Separator already set!"); + domainSeparator = keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, this)); + setupOwners(_owners, _threshold); + if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler); + // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules + setupModules(to, data); + + if (payment > 0) { + // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself) + // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment + handlePayment(payment, 0, 1, paymentToken, paymentReceiver); + } + } + + /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction. + /// Note: The fees are always transfered, even if the user transaction fails. + /// @param to Destination address of Safe transaction. + /// @param value Ether value of Safe transaction. + /// @param data Data payload of Safe transaction. + /// @param operation Operation type of Safe transaction. + /// @param safeTxGas Gas that should be used for the Safe transaction. + /// @param baseGas Gas costs for that are indipendent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund) + /// @param gasPrice Gas price that should be used for the payment calculation. + /// @param gasToken Token address (or 0 if ETH) that is used for the payment. + /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). + /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v}) + function execTransaction( + address to, + uint256 value, + bytes calldata data, + Enum.Operation operation, + uint256 safeTxGas, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address payable refundReceiver, + bytes calldata signatures + ) + external + payable + returns (bool success) + { + bytes32 txHash; + // Use scope here to limit variable lifetime and prevent `stack too deep` errors + { + bytes memory txHashData = encodeTransactionData( + to, value, data, operation, // Transaction info + safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, // Payment info + nonce + ); + // Increase nonce and execute transaction. + nonce++; + txHash = keccak256(txHashData); + checkSignatures(txHash, txHashData, signatures, true); + } + // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500) + // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150 + require(gasleft() >= (safeTxGas * 64 / 63).max(safeTxGas + 2500) + 500, "Not enough gas to execute safe transaction"); + // Use scope here to limit variable lifetime and prevent `stack too deep` errors + { + uint256 gasUsed = gasleft(); + // If the gasPrice is 0 we assume that nearly all available gas can be used (it is always more than safeTxGas) + // We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas + success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas); + gasUsed = gasUsed.sub(gasleft()); + // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls + uint256 payment = 0; + if (gasPrice > 0) { + payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver); + } + if (success) emit ExecutionSuccess(txHash, payment); + else emit ExecutionFailure(txHash, payment); + } + } + + function handlePayment( + uint256 gasUsed, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address payable refundReceiver + ) + private + returns (uint256 payment) + { + // solium-disable-next-line security/no-tx-origin + address payable receiver = refundReceiver == address(0) ? tx.origin : refundReceiver; + if (gasToken == address(0)) { + // For ETH we will only adjust the gas price to not be higher than the actual used gas price + payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice); + // solium-disable-next-line security/no-send + require(receiver.send(payment), "Could not pay gas costs with ether"); + } else { + payment = gasUsed.add(baseGas).mul(gasPrice); + require(transferToken(gasToken, receiver, payment), "Could not pay gas costs with token"); + } + } + + /** + * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise. + * @param dataHash Hash of the data (could be either a message hash or transaction hash) + * @param data That should be signed (this is passed to an external validator contract) + * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash. + * @param consumeHash Indicates that in case of an approved hash the storage can be freed to save gas + */ + function checkSignatures(bytes32 dataHash, bytes memory data, bytes memory signatures, bool consumeHash) + internal + { + // Load threshold to avoid multiple storage loads + uint256 _threshold = threshold; + // Check that a threshold is set + require(_threshold > 0, "Threshold needs to be defined!"); + // Check that the provided signature data is not too short + require(signatures.length >= _threshold.mul(65), "Signatures data too short"); + // There cannot be an owner with address 0. + address lastOwner = address(0); + address currentOwner; + uint8 v; + bytes32 r; + bytes32 s; + uint256 i; + for (i = 0; i < _threshold; i++) { + (v, r, s) = signatureSplit(signatures, i); + // If v is 0 then it is a contract signature + if (v == 0) { + // When handling contract signatures the address of the contract is encoded into r + currentOwner = address(uint256(r)); + + // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes + // This check is not completely accurate, since it is possible that more signatures than the threshold are send. + // Here we only check that the pointer is not pointing inside the part that is being processed + require(uint256(s) >= _threshold.mul(65), "Invalid contract signature location: inside static part"); + + // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes) + require(uint256(s).add(32) <= signatures.length, "Invalid contract signature location: length not present"); + + // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length + uint256 contractSignatureLen; + // solium-disable-next-line security/no-inline-assembly + assembly { + contractSignatureLen := mload(add(add(signatures, s), 0x20)) + } + require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, "Invalid contract signature location: data not complete"); + + // Check signature + bytes memory contractSignature; + // solium-disable-next-line security/no-inline-assembly + assembly { + // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s + contractSignature := add(add(signatures, s), 0x20) + } + require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, "Invalid contract signature provided"); + // If v is 1 then it is an approved hash + } else if (v == 1) { + // When handling approved hashes the address of the approver is encoded into r + currentOwner = address(uint256(r)); + // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction + require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, "Hash has not been approved"); + // Hash has been marked for consumption. If this hash was pre-approved free storage + if (consumeHash && msg.sender != currentOwner) { + approvedHashes[currentOwner][dataHash] = 0; + } + } else if (v > 30) { + // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover + currentOwner = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", dataHash)), v - 4, r, s); + } else { + // Use ecrecover with the messageHash for EOA signatures + currentOwner = ecrecover(dataHash, v, r, s); + } + require ( + currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, + "Invalid owner provided" + ); + lastOwner = currentOwner; + } + } + + /// @dev Allows to estimate a Safe transaction. + /// This method is only meant for estimation purpose, therefore two different protection mechanism against execution in a transaction have been made: + /// 1.) The method can only be called from the safe itself + /// 2.) The response is returned with a revert + /// When estimating set `from` to the address of the safe. + /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction` + /// @param to Destination address of Safe transaction. + /// @param value Ether value of Safe transaction. + /// @param data Data payload of Safe transaction. + /// @param operation Operation type of Safe transaction. + /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs). + function requiredTxGas(address to, uint256 value, bytes calldata data, Enum.Operation operation) + external + authorized + returns (uint256) + { + uint256 startGas = gasleft(); + // We don't provide an error message here, as we use it to return the estimate + // solium-disable-next-line error-reason + require(execute(to, value, data, operation, gasleft())); + uint256 requiredGas = startGas - gasleft(); + // Convert response to string and return via error message + revert(string(abi.encodePacked(requiredGas))); + } + + /** + * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature. + * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract. + */ + function approveHash(bytes32 hashToApprove) + external + { + require(owners[msg.sender] != address(0), "Only owners can approve a hash"); + approvedHashes[msg.sender][hashToApprove] = 1; + emit ApproveHash(hashToApprove, msg.sender); + } + + /** + * @dev Marks a message as signed, so that it can be used with EIP-1271 + * @notice Marks a message (`_data`) as signed. + * @param _data Arbitrary length data that should be marked as signed on the behalf of address(this) + */ + function signMessage(bytes calldata _data) + external + authorized + { + bytes32 msgHash = getMessageHash(_data); + signedMessages[msgHash] = 1; + emit SignMsg(msgHash); + } + + /** + * Implementation of ISignatureValidator (see `interfaces/ISignatureValidator.sol`) + * @dev Should return whether the signature provided is valid for the provided data. + * The save does not implement the interface since `checkSignatures` is not a view method. + * The method will not perform any state changes (see parameters of `checkSignatures`) + * @param _data Arbitrary length data signed on the behalf of address(this) + * @param _signature Signature byte array associated with _data + * @return a bool upon valid or invalid signature with corresponding _data + */ + function isValidSignature(bytes calldata _data, bytes calldata _signature) + external + returns (bytes4) + { + bytes32 messageHash = getMessageHash(_data); + if (_signature.length == 0) { + require(signedMessages[messageHash] != 0, "Hash not approved"); + } else { + // consumeHash needs to be false, as the state should not be changed + checkSignatures(messageHash, _data, _signature, false); + } + return EIP1271_MAGIC_VALUE; + } + + /// @dev Returns hash of a message that can be signed by owners. + /// @param message Message that should be hashed + /// @return Message hash. + function getMessageHash( + bytes memory message + ) + public + view + returns (bytes32) + { + bytes32 safeMessageHash = keccak256( + abi.encode(SAFE_MSG_TYPEHASH, keccak256(message)) + ); + return keccak256( + abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeMessageHash) + ); + } + + /// @dev Returns the bytes that are hashed to be signed by owners. + /// @param to Destination address. + /// @param value Ether value. + /// @param data Data payload. + /// @param operation Operation type. + /// @param safeTxGas Fas that should be used for the safe transaction. + /// @param baseGas Gas costs for data used to trigger the safe transaction. + /// @param gasPrice Maximum gas price that should be used for this transaction. + /// @param gasToken Token address (or 0 if ETH) that is used for the payment. + /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). + /// @param _nonce Transaction nonce. + /// @return Transaction hash bytes. + function encodeTransactionData( + address to, + uint256 value, + bytes memory data, + Enum.Operation operation, + uint256 safeTxGas, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address refundReceiver, + uint256 _nonce + ) + public + view + returns (bytes memory) + { + bytes32 safeTxHash = keccak256( + abi.encode(SAFE_TX_TYPEHASH, to, value, keccak256(data), operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce) + ); + return abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeTxHash); + } + + /// @dev Returns hash to be signed by owners. + /// @param to Destination address. + /// @param value Ether value. + /// @param data Data payload. + /// @param operation Operation type. + /// @param safeTxGas Fas that should be used for the safe transaction. + /// @param baseGas Gas costs for data used to trigger the safe transaction. + /// @param gasPrice Maximum gas price that should be used for this transaction. + /// @param gasToken Token address (or 0 if ETH) that is used for the payment. + /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). + /// @param _nonce Transaction nonce. + /// @return Transaction hash. + function getTransactionHash( + address to, + uint256 value, + bytes memory data, + Enum.Operation operation, + uint256 safeTxGas, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address refundReceiver, + uint256 _nonce + ) + public + view + returns (bytes32) + { + return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce)); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/Migrations.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/Migrations.sol new file mode 100644 index 000000000..9ffe9a1d5 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/Migrations.sol @@ -0,0 +1,31 @@ +pragma solidity >=0.5.0 <0.7.0; + +contract Migrations { + address public owner; + uint public last_completed_migration; + + modifier restricted() { + if (msg.sender == owner) _; + } + + constructor() + public + { + owner = msg.sender; + } + + function setCompleted(uint completed) + public + restricted + { + last_completed_migration = completed; + } + + function upgrade(address new_address) + public + restricted + { + Migrations upgraded = Migrations(new_address); + upgraded.setCompleted(last_completed_migration); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/Executor.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/base/Executor.sol new file mode 100644 index 000000000..293c74799 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/base/Executor.sol @@ -0,0 +1,40 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../common/Enum.sol"; + + +/// @title Executor - A contract that can execute transactions +/// @author Richard Meissner - +contract Executor { + + function execute(address to, uint256 value, bytes memory data, Enum.Operation operation, uint256 txGas) + internal + returns (bool success) + { + if (operation == Enum.Operation.Call) + success = executeCall(to, value, data, txGas); + else if (operation == Enum.Operation.DelegateCall) + success = executeDelegateCall(to, data, txGas); + else + success = false; + } + + function executeCall(address to, uint256 value, bytes memory data, uint256 txGas) + internal + returns (bool success) + { + // solium-disable-next-line security/no-inline-assembly + assembly { + success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0) + } + } + + function executeDelegateCall(address to, bytes memory data, uint256 txGas) + internal + returns (bool success) + { + // solium-disable-next-line security/no-inline-assembly + assembly { + success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0) + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/FallbackManager.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/base/FallbackManager.sol new file mode 100644 index 000000000..8de981c45 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/base/FallbackManager.sol @@ -0,0 +1,57 @@ +pragma solidity >=0.5.0 <0.7.0; + +import "../common/SelfAuthorized.sol"; + +/// @title Fallback Manager - A contract that manages fallback calls made to this contract +/// @author Richard Meissner - +contract FallbackManager is SelfAuthorized { + + // keccak256("fallback_manager.handler.address") + bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5; + + function internalSetFallbackHandler(address handler) internal { + bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT; + // solium-disable-next-line security/no-inline-assembly + assembly { + sstore(slot, handler) + } + } + + /// @dev Allows to add a contract to handle fallback calls. + /// Only fallback calls without value and with data will be forwarded. + /// This can only be done via a Safe transaction. + /// @param handler contract to handle fallbacks calls. + function setFallbackHandler(address handler) + public + authorized + { + internalSetFallbackHandler(handler); + } + + function () + external + payable + { + // Only calls without value and with data will be forwarded + if (msg.value > 0 || msg.data.length == 0) { + return; + } + bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT; + address handler; + // solium-disable-next-line security/no-inline-assembly + assembly { + handler := sload(slot) + } + + if (handler != address(0)) { + // solium-disable-next-line security/no-inline-assembly + assembly { + calldatacopy(0, 0, calldatasize()) + let success := call(gas, handler, 0, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + if eq(success, 0) { revert(0, returndatasize()) } + return(0, returndatasize()) + } + } + } +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/Module.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/base/Module.sol new file mode 100644 index 000000000..298fc41ca --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/base/Module.sol @@ -0,0 +1,26 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../common/MasterCopy.sol"; +import "./ModuleManager.sol"; + + +/// @title Module - Base class for modules. +/// @author Stefan George - +/// @author Richard Meissner - +contract Module is MasterCopy { + + ModuleManager public manager; + + modifier authorized() { + require(msg.sender == address(manager), "Method can only be called from manager"); + _; + } + + function setManager() + internal + { + // manager can only be 0 at initalization of contract. + // Check ensures that setup function can only be called once. + require(address(manager) == address(0), "Manager has already been set"); + manager = ModuleManager(msg.sender); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/ModuleManager.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/base/ModuleManager.sol new file mode 100644 index 000000000..b8a2a0243 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/base/ModuleManager.sol @@ -0,0 +1,157 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../common/Enum.sol"; +import "../common/SelfAuthorized.sol"; +import "./Executor.sol"; +import "./Module.sol"; + + +/// @title Module Manager - A contract that manages modules that can execute transactions via this contract +/// @author Stefan George - +/// @author Richard Meissner - +contract ModuleManager is SelfAuthorized, Executor { + + event EnabledModule(Module module); + event DisabledModule(Module module); + event ExecutionFromModuleSuccess(address indexed module); + event ExecutionFromModuleFailure(address indexed module); + + address internal constant SENTINEL_MODULES = address(0x1); + + mapping (address => address) internal modules; + + function setupModules(address to, bytes memory data) + internal + { + require(modules[SENTINEL_MODULES] == address(0), "Modules have already been initialized"); + modules[SENTINEL_MODULES] = SENTINEL_MODULES; + if (to != address(0)) + // Setup has to complete successfully or transaction fails. + require(executeDelegateCall(to, data, gasleft()), "Could not finish initialization"); + } + + /// @dev Allows to add a module to the whitelist. + /// This can only be done via a Safe transaction. + /// @notice Enables the module `module` for the Safe. + /// @param module Module to be whitelisted. + function enableModule(Module module) + public + authorized + { + // Module address cannot be null or sentinel. + require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); + // Module cannot be added twice. + require(modules[address(module)] == address(0), "Module has already been added"); + modules[address(module)] = modules[SENTINEL_MODULES]; + modules[SENTINEL_MODULES] = address(module); + emit EnabledModule(module); + } + + /// @dev Allows to remove a module from the whitelist. + /// This can only be done via a Safe transaction. + /// @notice Disables the module `module` for the Safe. + /// @param prevModule Module that pointed to the module to be removed in the linked list + /// @param module Module to be removed. + function disableModule(Module prevModule, Module module) + public + authorized + { + // Validate module address and check that it corresponds to module index. + require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); + require(modules[address(prevModule)] == address(module), "Invalid prevModule, module pair provided"); + modules[address(prevModule)] = modules[address(module)]; + modules[address(module)] = address(0); + emit DisabledModule(module); + } + + /// @dev Allows a Module to execute a Safe transaction without any further confirmations. + /// @param to Destination address of module transaction. + /// @param value Ether value of module transaction. + /// @param data Data payload of module transaction. + /// @param operation Operation type of module transaction. + function execTransactionFromModule(address to, uint256 value, bytes memory data, Enum.Operation operation) + public + returns (bool success) + { + // Only whitelisted modules are allowed. + require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), "Method can only be called from an enabled module"); + // Execute transaction without further confirmations. + success = execute(to, value, data, operation, gasleft()); + if (success) emit ExecutionFromModuleSuccess(msg.sender); + else emit ExecutionFromModuleFailure(msg.sender); + } + + /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data + /// @param to Destination address of module transaction. + /// @param value Ether value of module transaction. + /// @param data Data payload of module transaction. + /// @param operation Operation type of module transaction. + function execTransactionFromModuleReturnData(address to, uint256 value, bytes memory data, Enum.Operation operation) + public + returns (bool success, bytes memory returnData) + { + success = execTransactionFromModule(to, value, data, operation); + // solium-disable-next-line security/no-inline-assembly + assembly { + // Load free memory location + let ptr := mload(0x40) + // We allocate memory for the return data by setting the free memory location to + // current free memory location + data size + 32 bytes for data size value + mstore(0x40, add(ptr, add(returndatasize(), 0x20))) + // Store the size + mstore(ptr, returndatasize()) + // Store the data + returndatacopy(add(ptr, 0x20), 0, returndatasize()) + // Point the return data to the correct memory location + returnData := ptr + } + } + + /// @dev Returns if an module is enabled + /// @return True if the module is enabled + function isModuleEnabled(Module module) + public + view + returns (bool) + { + return SENTINEL_MODULES != address(module) && modules[address(module)] != address(0); + } + + /// @dev Returns array of first 10 modules. + /// @return Array of modules. + function getModules() + public + view + returns (address[] memory) + { + (address[] memory array,) = getModulesPaginated(SENTINEL_MODULES, 10); + return array; + } + + /// @dev Returns array of modules. + /// @param start Start of the page. + /// @param pageSize Maximum number of modules that should be returned. + /// @return Array of modules. + function getModulesPaginated(address start, uint256 pageSize) + public + view + returns (address[] memory array, address next) + { + // Init array with max page size + array = new address[](pageSize); + + // Populate return array + uint256 moduleCount = 0; + address currentModule = modules[start]; + while(currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) { + array[moduleCount] = currentModule; + currentModule = modules[currentModule]; + moduleCount++; + } + next = currentModule; + // Set correct size of returned array + // solium-disable-next-line security/no-inline-assembly + assembly { + mstore(array, moduleCount) + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/OwnerManager.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/base/OwnerManager.sol new file mode 100644 index 000000000..647b7b6b1 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/base/OwnerManager.sol @@ -0,0 +1,169 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../common/SelfAuthorized.sol"; + +/// @title OwnerManager - Manages a set of owners and a threshold to perform actions. +/// @author Stefan George - +/// @author Richard Meissner - +contract OwnerManager is SelfAuthorized { + + event AddedOwner(address owner); + event RemovedOwner(address owner); + event ChangedThreshold(uint256 threshold); + + address internal constant SENTINEL_OWNERS = address(0x1); + + mapping(address => address) internal owners; + uint256 ownerCount; + uint256 internal threshold; + + /// @dev Setup function sets initial storage of contract. + /// @param _owners List of Safe owners. + /// @param _threshold Number of required confirmations for a Safe transaction. + function setupOwners(address[] memory _owners, uint256 _threshold) + internal + { + // Threshold can only be 0 at initialization. + // Check ensures that setup function can only be called once. + require(threshold == 0, "Owners have already been setup"); + // Validate that threshold is smaller than number of added owners. + require(_threshold <= _owners.length, "Threshold cannot exceed owner count"); + // There has to be at least one Safe owner. + require(_threshold >= 1, "Threshold needs to be greater than 0"); + // Initializing Safe owners. + address currentOwner = SENTINEL_OWNERS; + for (uint256 i = 0; i < _owners.length; i++) { + // Owner address cannot be null. + address owner = _owners[i]; + require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); + // No duplicate owners allowed. + require(owners[owner] == address(0), "Duplicate owner address provided"); + owners[currentOwner] = owner; + currentOwner = owner; + } + owners[currentOwner] = SENTINEL_OWNERS; + ownerCount = _owners.length; + threshold = _threshold; + } + + /// @dev Allows to add a new owner to the Safe and update the threshold at the same time. + /// This can only be done via a Safe transaction. + /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`. + /// @param owner New owner address. + /// @param _threshold New threshold. + function addOwnerWithThreshold(address owner, uint256 _threshold) + public + authorized + { + // Owner address cannot be null. + require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); + // No duplicate owners allowed. + require(owners[owner] == address(0), "Address is already an owner"); + owners[owner] = owners[SENTINEL_OWNERS]; + owners[SENTINEL_OWNERS] = owner; + ownerCount++; + emit AddedOwner(owner); + // Change threshold if threshold was changed. + if (threshold != _threshold) + changeThreshold(_threshold); + } + + /// @dev Allows to remove an owner from the Safe and update the threshold at the same time. + /// This can only be done via a Safe transaction. + /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`. + /// @param prevOwner Owner that pointed to the owner to be removed in the linked list + /// @param owner Owner address to be removed. + /// @param _threshold New threshold. + function removeOwner(address prevOwner, address owner, uint256 _threshold) + public + authorized + { + // Only allow to remove an owner, if threshold can still be reached. + require(ownerCount - 1 >= _threshold, "New owner count needs to be larger than new threshold"); + // Validate owner address and check that it corresponds to owner index. + require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); + require(owners[prevOwner] == owner, "Invalid prevOwner, owner pair provided"); + owners[prevOwner] = owners[owner]; + owners[owner] = address(0); + ownerCount--; + emit RemovedOwner(owner); + // Change threshold if threshold was changed. + if (threshold != _threshold) + changeThreshold(_threshold); + } + + /// @dev Allows to swap/replace an owner from the Safe with another address. + /// This can only be done via a Safe transaction. + /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`. + /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list + /// @param oldOwner Owner address to be replaced. + /// @param newOwner New owner address. + function swapOwner(address prevOwner, address oldOwner, address newOwner) + public + authorized + { + // Owner address cannot be null. + require(newOwner != address(0) && newOwner != SENTINEL_OWNERS, "Invalid owner address provided"); + // No duplicate owners allowed. + require(owners[newOwner] == address(0), "Address is already an owner"); + // Validate oldOwner address and check that it corresponds to owner index. + require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, "Invalid owner address provided"); + require(owners[prevOwner] == oldOwner, "Invalid prevOwner, owner pair provided"); + owners[newOwner] = owners[oldOwner]; + owners[prevOwner] = newOwner; + owners[oldOwner] = address(0); + emit RemovedOwner(oldOwner); + emit AddedOwner(newOwner); + } + + /// @dev Allows to update the number of required confirmations by Safe owners. + /// This can only be done via a Safe transaction. + /// @notice Changes the threshold of the Safe to `_threshold`. + /// @param _threshold New threshold. + function changeThreshold(uint256 _threshold) + public + authorized + { + // Validate that threshold is smaller than number of owners. + require(_threshold <= ownerCount, "Threshold cannot exceed owner count"); + // There has to be at least one Safe owner. + require(_threshold >= 1, "Threshold needs to be greater than 0"); + threshold = _threshold; + emit ChangedThreshold(threshold); + } + + function getThreshold() + public + view + returns (uint256) + { + return threshold; + } + + function isOwner(address owner) + public + view + returns (bool) + { + return owner != SENTINEL_OWNERS && owners[owner] != address(0); + } + + /// @dev Returns array of owners. + /// @return Array of Safe owners. + function getOwners() + public + view + returns (address[] memory) + { + address[] memory array = new address[](ownerCount); + + // populate return array + uint256 index = 0; + address currentOwner = owners[SENTINEL_OWNERS]; + while(currentOwner != SENTINEL_OWNERS) { + array[index] = currentOwner; + currentOwner = owners[currentOwner]; + index ++; + } + return array; + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/Enum.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/Enum.sol new file mode 100644 index 000000000..3288682a4 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/common/Enum.sol @@ -0,0 +1,11 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title Enum - Collection of enums +/// @author Richard Meissner - +contract Enum { + enum Operation { + Call, + DelegateCall + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol new file mode 100644 index 000000000..7fddb9a28 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol @@ -0,0 +1,15 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments +/// @author Richard Meissner - +contract EtherPaymentFallback { + + /// @dev Fallback function accepts Ether transactions. + function () + external + payable + { + + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/MasterCopy.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/MasterCopy.sol new file mode 100644 index 000000000..d98cd3776 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/common/MasterCopy.sol @@ -0,0 +1,27 @@ +pragma solidity >=0.5.0 <0.7.0; +import "./SelfAuthorized.sol"; + + +/// @title MasterCopy - Base for master copy contracts (should always be first super contract) +/// This contract is tightly coupled to our proxy contract (see `proxies/GnosisSafeProxy.sol`) +/// @author Richard Meissner - +contract MasterCopy is SelfAuthorized { + + event ChangedMasterCopy(address masterCopy); + + // masterCopy always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract. + // It should also always be ensured that the address is stored alone (uses a full word) + address private masterCopy; + + /// @dev Allows to upgrade the contract. This can only be done via a Safe transaction. + /// @param _masterCopy New contract address. + function changeMasterCopy(address _masterCopy) + public + authorized + { + // Master copy address cannot be null. + require(_masterCopy != address(0), "Invalid master copy address provided"); + masterCopy = _masterCopy; + emit ChangedMasterCopy(_masterCopy); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol new file mode 100644 index 000000000..1ba688e9f --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol @@ -0,0 +1,33 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title SecuredTokenTransfer - Secure token transfer +/// @author Richard Meissner - +contract SecuredTokenTransfer { + + /// @dev Transfers a token and returns if it was a success + /// @param token Token that should be transferred + /// @param receiver Receiver to whom the token should be transferred + /// @param amount The amount of tokens that should be transferred + function transferToken ( + address token, + address receiver, + uint256 amount + ) + internal + returns (bool transferred) + { + bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", receiver, amount); + // solium-disable-next-line security/no-inline-assembly + assembly { + let success := call(sub(gas, 10000), token, 0, add(data, 0x20), mload(data), 0, 0) + let ptr := mload(0x40) + mstore(0x40, add(ptr, returndatasize())) + returndatacopy(ptr, 0, returndatasize()) + switch returndatasize() + case 0 { transferred := success } + case 0x20 { transferred := iszero(or(iszero(success), iszero(mload(ptr)))) } + default { transferred := 0 } + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/SelfAuthorized.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/SelfAuthorized.sol new file mode 100644 index 000000000..d5892fcf9 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/common/SelfAuthorized.sol @@ -0,0 +1,11 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title SelfAuthorized - authorizes current contract to perform actions +/// @author Richard Meissner - +contract SelfAuthorized { + modifier authorized() { + require(msg.sender == address(this), "Method can only be called from this contract"); + _; + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/SignatureDecoder.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/SignatureDecoder.sol new file mode 100644 index 000000000..87020c465 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/common/SignatureDecoder.sol @@ -0,0 +1,54 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title SignatureDecoder - Decodes signatures that a encoded as bytes +/// @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) +/// @author Richard Meissner - +contract SignatureDecoder { + + /// @dev Recovers address who signed the message + /// @param messageHash operation ethereum signed message hash + /// @param messageSignature message `txHash` signature + /// @param pos which signature to read + function recoverKey ( + bytes32 messageHash, + bytes memory messageSignature, + uint256 pos + ) + internal + pure + returns (address) + { + uint8 v; + bytes32 r; + bytes32 s; + (v, r, s) = signatureSplit(messageSignature, pos); + return ecrecover(messageHash, v, r, s); + } + + /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`. + /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures + /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access + /// @param signatures concatenated rsv signatures + function signatureSplit(bytes memory signatures, uint256 pos) + internal + pure + returns (uint8 v, bytes32 r, bytes32 s) + { + // The signature format is a compact form of: + // {bytes32 r}{bytes32 s}{uint8 v} + // Compact means, uint8 is not padded to 32 bytes. + // solium-disable-next-line security/no-inline-assembly + assembly { + let signaturePos := mul(0x41, pos) + r := mload(add(signatures, add(signaturePos, 0x20))) + s := mload(add(signatures, add(signaturePos, 0x40))) + // Here we are loading the last 32 bytes, including 31 bytes + // of 's'. There is no 'mload8' to do this. + // + // 'byte' is not working due to the Solidity parser, so lets + // use the second best option, 'and' + v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff) + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/external/GnosisSafeMath.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/external/GnosisSafeMath.sol new file mode 100644 index 000000000..1f884de6b --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/external/GnosisSafeMath.sol @@ -0,0 +1,75 @@ +pragma solidity >=0.5.0 <0.7.0; + +/** + * @title GnosisSafeMath + * @dev Math operations with safety checks that revert on error + * Renamed from SafeMath to GnosisSafeMath to avoid conflicts + * TODO: remove once open zeppelin update to solc 0.5.0 + */ +library GnosisSafeMath { + + /** + * @dev Multiplies two numbers, reverts on overflow. + */ + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + // Gas optimization: this is cheaper than requiring 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (a == 0) { + return 0; + } + + uint256 c = a * b; + require(c / a == b); + + return c; + } + + /** + * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. + */ + function div(uint256 a, uint256 b) internal pure returns (uint256) { + require(b > 0); // Solidity only automatically asserts when dividing by 0 + uint256 c = a / b; + // assert(a == b * c + a % b); // There is no case in which this doesn't hold + + return c; + } + + /** + * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). + */ + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + require(b <= a); + uint256 c = a - b; + + return c; + } + + /** + * @dev Adds two numbers, reverts on overflow. + */ + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c >= a); + + return c; + } + + /** + * @dev Divides two numbers and returns the remainder (unsigned integer modulo), + * reverts when dividing by zero. + */ + function mod(uint256 a, uint256 b) internal pure returns (uint256) { + require(b != 0); + return a % b; + } + + + /** + * @dev Returns the largest of two numbers. + */ + function max(uint256 a, uint256 b) internal pure returns (uint256) { + return a >= b ? a : b; + } +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol new file mode 100644 index 000000000..03058d1b0 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol @@ -0,0 +1,40 @@ +pragma solidity >=0.5.0 <0.7.0; + +import "../interfaces/ERC1155TokenReceiver.sol"; +import "../interfaces/ERC721TokenReceiver.sol"; +import "../interfaces/ERC777TokensRecipient.sol"; + +/// @title Default Callback Handler - returns true for known token callbacks +/// @author Richard Meissner - +contract DefaultCallbackHandler is ERC1155TokenReceiver, ERC777TokensRecipient, ERC721TokenReceiver { + + string public constant NAME = "Default Callback Handler"; + string public constant VERSION = "1.0.0"; + + function onERC1155Received(address, address, uint256, uint256, bytes calldata) + external + returns(bytes4) + { + return 0xf23a6e61; + } + + function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) + external + returns(bytes4) + { + return 0xbc197c81; + } + + function onERC721Received(address, address, uint256, bytes calldata) + external + returns(bytes4) + { + return 0x150b7a02; + } + + // solium-disable-next-line no-empty-blocks + function tokensReceived(address, address, address, uint256, bytes calldata, bytes calldata) external { + // We implement this for completeness, doesn't really have any value + } + +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol new file mode 100644 index 000000000..56c72cdff --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol @@ -0,0 +1,36 @@ +pragma solidity >=0.5.0 <0.7.0; + +/** + Note: The ERC-165 identifier for this interface is 0x4e2312e0. +*/ +interface ERC1155TokenReceiver { + /** + @notice Handle the receipt of a single ERC1155 token type. + @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeTransferFrom` after the balance has been updated. + This function MUST return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61) if it accepts the transfer. + This function MUST revert if it rejects the transfer. + Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. + @param _operator The address which initiated the transfer (i.e. msg.sender) + @param _from The address which previously owned the token + @param _id The ID of the token being transferred + @param _value The amount of tokens being transferred + @param _data Additional data with no specified format + @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` + */ + function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _value, bytes calldata _data) external returns(bytes4); + + /** + @notice Handle the receipt of multiple ERC1155 token types. + @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated. + This function MUST return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81) if it accepts the transfer(s). + This function MUST revert if it rejects the transfer(s). + Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. + @param _operator The address which initiated the batch transfer (i.e. msg.sender) + @param _from The address which previously owned the token + @param _ids An array containing ids of each token being transferred (order and length must match _values array) + @param _values An array containing amounts of each token being transferred (order and length must match _ids array) + @param _data Additional data with no specified format + @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` + */ + function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external returns(bytes4); +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol new file mode 100644 index 000000000..2bf050bac --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol @@ -0,0 +1,18 @@ +pragma solidity >=0.5.0 <0.7.0; + +/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02. +interface ERC721TokenReceiver { + /// @notice Handle the receipt of an NFT + /// @dev The ERC721 smart contract calls this function on the recipient + /// after a `transfer`. This function MAY throw to revert and reject the + /// transfer. Return of other than the magic value MUST result in the + /// transaction being reverted. + /// Note: the contract address is always the message sender. + /// @param _operator The address which called `safeTransferFrom` function + /// @param _from The address which previously owned the token + /// @param _tokenId The NFT identifier which is being transferred + /// @param _data Additional data with no specified format + /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` + /// unless throwing + function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external returns(bytes4); +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol new file mode 100644 index 000000000..b8c471377 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol @@ -0,0 +1,12 @@ +pragma solidity >=0.5.0 <0.7.0; + +interface ERC777TokensRecipient { + function tokensReceived( + address operator, + address from, + address to, + uint256 amount, + bytes calldata data, + bytes calldata operatorData + ) external; +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol new file mode 100644 index 000000000..ff8a7478f --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol @@ -0,0 +1,25 @@ +pragma solidity >=0.5.0 <0.7.0; + +contract ISignatureValidatorConstants { + // bytes4(keccak256("isValidSignature(bytes,bytes)") + bytes4 constant internal EIP1271_MAGIC_VALUE = 0x20c13b0b; +} + +contract ISignatureValidator is ISignatureValidatorConstants { + + /** + * @dev Should return whether the signature provided is valid for the provided data + * @param _data Arbitrary length data signed on the behalf of address(this) + * @param _signature Signature byte array associated with _data + * + * MUST return the bytes4 magic value 0x20c13b0b when function passes. + * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5) + * MUST allow external calls + */ + function isValidSignature( + bytes memory _data, + bytes memory _signature) + public + view + returns (bytes4); +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol new file mode 100644 index 000000000..f0ca1d8a9 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol @@ -0,0 +1,43 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../base/Module.sol"; + + +/// @title Create and Add Modules - Allows to create and add multiple module in one transaction. +/// @author Stefan George - +/// @author Richard Meissner - +contract CreateAndAddModules { + + /// @dev Function required to compile contract. Gnosis Safe function is called instead. + /// @param module Not used. + function enableModule(Module module) + public + { + revert(); + } + + /// @dev Allows to create and add multiple module in one transaction. + /// @param proxyFactory Module proxy factory contract. + /// @param data Modules constructor payload. This is the data for each proxy factory call concatinated. (e.g. ) + function createAndAddModules(address proxyFactory, bytes memory data) + public + { + uint256 length = data.length; + Module module; + uint256 i = 0; + while (i < length) { + // solium-disable-next-line security/no-inline-assembly + assembly { + let createBytesLength := mload(add(0x20, add(data, i))) + let createBytes := add(0x40, add(data, i)) + + let output := mload(0x40) + if eq(delegatecall(gas, proxyFactory, createBytes, createBytesLength, output, 0x20), 0) { revert(0, 0) } + module := and(mload(output), 0xffffffffffffffffffffffffffffffffffffffff) + + // Data is always padded to 32 bytes + i := add(i, add(0x20, mul(div(add(createBytesLength, 0x1f), 0x20), 0x20))) + } + this.enableModule(module); + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateCall.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateCall.sol new file mode 100644 index 000000000..9e1564557 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateCall.sol @@ -0,0 +1,26 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title Create Call - Allows to use the different create opcodes to deploy a contract +/// @author Richard Meissner - +contract CreateCall { + event ContractCreation(address newContract); + + function performCreate2(uint256 value, bytes memory deploymentData, bytes32 salt) public returns(address newContract) { + // solium-disable-next-line security/no-inline-assembly + assembly { + newContract := create2(value, add(0x20, deploymentData), mload(deploymentData), salt) + } + require(newContract != address(0), "Could not deploy contract"); + emit ContractCreation(newContract); + } + + function performCreate(uint256 value, bytes memory deploymentData) public returns(address newContract) { + // solium-disable-next-line security/no-inline-assembly + assembly { + newContract := create(value, add(deploymentData, 0x20), mload(deploymentData)) + } + require(newContract != address(0), "Could not deploy contract"); + emit ContractCreation(newContract); + } +} \ No newline at end of file diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/MultiSend.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/MultiSend.sol new file mode 100644 index 000000000..8bfe010ca --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/MultiSend.sol @@ -0,0 +1,59 @@ +pragma solidity >=0.5.0 <0.7.0; + + +/// @title Multi Send - Allows to batch multiple transactions into one. +/// @author Nick Dodson - +/// @author Gonçalo Sá - +/// @author Stefan George - +/// @author Richard Meissner - +contract MultiSend { + + bytes32 constant private GUARD_VALUE = keccak256("multisend.guard.bytes32"); + + bytes32 guard; + + constructor() public { + guard = GUARD_VALUE; + } + + /// @dev Sends multiple transactions and reverts all if one fails. + /// @param transactions Encoded transactions. Each transaction is encoded as a packed bytes of + /// operation as a uint8 with 0 for a call or 1 for a delegatecall (=> 1 byte), + /// to as a address (=> 20 bytes), + /// value as a uint256 (=> 32 bytes), + /// data length as a uint256 (=> 32 bytes), + /// data as bytes. + /// see abi.encodePacked for more information on packed encoding + function multiSend(bytes memory transactions) + public + { + require(guard != GUARD_VALUE, "MultiSend should only be called via delegatecall"); + // solium-disable-next-line security/no-inline-assembly + assembly { + let length := mload(transactions) + let i := 0x20 + for { } lt(i, length) { } { + // First byte of the data is the operation. + // We shift by 248 bits (256 - 8 [operation byte]) it right since mload will always load 32 bytes (a word). + // This will also zero out unused data. + let operation := shr(0xf8, mload(add(transactions, i))) + // We offset the load address by 1 byte (operation byte) + // We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data. + let to := shr(0x60, mload(add(transactions, add(i, 0x01)))) + // We offset the load address by 21 byte (operation byte + 20 address bytes) + let value := mload(add(transactions, add(i, 0x15))) + // We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes) + let dataLength := mload(add(transactions, add(i, 0x35))) + // We offset the load address by 85 byte (operation byte + 20 address bytes + 32 value bytes + 32 data length bytes) + let data := add(transactions, add(i, 0x55)) + let success := 0 + switch operation + case 0 { success := call(gas, to, value, data, dataLength, 0, 0) } + case 1 { success := delegatecall(gas, to, data, dataLength, 0, 0) } + if eq(success, 0) { revert(0, 0) } + // Next entry starts at 85 byte + data length + i := add(i, add(0x55, dataLength)) + } + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/DailyLimitModule.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/DailyLimitModule.sol new file mode 100644 index 000000000..eb1945747 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/DailyLimitModule.sol @@ -0,0 +1,92 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../base/Module.sol"; +import "../base/ModuleManager.sol"; +import "../base/OwnerManager.sol"; +import "../common/Enum.sol"; + + +/// @title Daily Limit Module - Allows to transfer limited amounts of ERC20 tokens and Ether without confirmations. +/// @author Stefan George - +contract DailyLimitModule is Module { + + string public constant NAME = "Daily Limit Module"; + string public constant VERSION = "0.1.0"; + + // dailyLimits mapping maps token address to daily limit settings. + mapping (address => DailyLimit) public dailyLimits; + + struct DailyLimit { + uint256 dailyLimit; + uint256 spentToday; + uint256 lastDay; + } + + /// @dev Setup function sets initial storage of contract. + /// @param tokens List of token addresses. Ether is represented with address 0x0. + /// @param _dailyLimits List of daily limits in smalles units (e.g. Wei for Ether). + function setup(address[] memory tokens, uint256[] memory _dailyLimits) + public + { + setManager(); + for (uint256 i = 0; i < tokens.length; i++) + dailyLimits[tokens[i]].dailyLimit = _dailyLimits[i]; + } + + /// @dev Allows to update the daily limit for a specified token. This can only be done via a Safe transaction. + /// @param token Token contract address. + /// @param dailyLimit Daily limit in smallest token unit. + function changeDailyLimit(address token, uint256 dailyLimit) + public + authorized + { + dailyLimits[token].dailyLimit = dailyLimit; + } + + /// @dev Returns if Safe transaction is a valid daily limit transaction. + /// @param token Address of the token that should be transfered (0 for Ether) + /// @param to Address to which the tokens should be transfered + /// @param amount Amount of tokens (or Ether) that should be transfered + /// @return Returns if transaction can be executed. + function executeDailyLimit(address token, address to, uint256 amount) + public + { + // Only Safe owners are allowed to execute daily limit transactions. + require(OwnerManager(address(manager)).isOwner(msg.sender), "Method can only be called by an owner"); + require(to != address(0), "Invalid to address provided"); + require(amount > 0, "Invalid amount provided"); + // Validate that transfer is not exceeding daily limit. + require(isUnderLimit(token, amount), "Daily limit has been reached"); + dailyLimits[token].spentToday += amount; + if (token == address(0)) { + require(manager.execTransactionFromModule(to, amount, "", Enum.Operation.Call), "Could not execute ether transfer"); + } else { + bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", to, amount); + require(manager.execTransactionFromModule(token, 0, data, Enum.Operation.Call), "Could not execute token transfer"); + } + } + + function isUnderLimit(address token, uint256 amount) + internal + returns (bool) + { + DailyLimit storage dailyLimit = dailyLimits[token]; + if (today() > dailyLimit.lastDay) { + dailyLimit.lastDay = today(); + dailyLimit.spentToday = 0; + } + if (dailyLimit.spentToday + amount <= dailyLimit.dailyLimit && + dailyLimit.spentToday + amount > dailyLimit.spentToday) + return true; + return false; + } + + /// @dev Returns last midnight as Unix timestamp. + /// @return Unix timestamp. + function today() + public + view + returns (uint) + { + return now - (now % 1 days); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol new file mode 100644 index 000000000..63f211b3c --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol @@ -0,0 +1,105 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../base/Module.sol"; +import "../base/ModuleManager.sol"; +import "../base/OwnerManager.sol"; +import "../common/Enum.sol"; + + +/// @title Social Recovery Module - Allows to replace an owner without Safe confirmations if friends approve the replacement. +/// @author Stefan George - +contract SocialRecoveryModule is Module { + + string public constant NAME = "Social Recovery Module"; + string public constant VERSION = "0.1.0"; + + uint256 public threshold; + address[] public friends; + + // isFriend mapping maps friend's address to friend status. + mapping (address => bool) public isFriend; + // isExecuted mapping maps data hash to execution status. + mapping (bytes32 => bool) public isExecuted; + // isConfirmed mapping maps data hash to friend's address to confirmation status. + mapping (bytes32 => mapping (address => bool)) public isConfirmed; + + modifier onlyFriend() { + require(isFriend[msg.sender], "Method can only be called by a friend"); + _; + } + + /// @dev Setup function sets initial storage of contract. + /// @param _friends List of friends' addresses. + /// @param _threshold Required number of friends to confirm replacement. + function setup(address[] memory _friends, uint256 _threshold) + public + { + require(_threshold <= _friends.length, "Threshold cannot exceed friends count"); + require(_threshold >= 2, "At least 2 friends required"); + setManager(); + // Set allowed friends. + for (uint256 i = 0; i < _friends.length; i++) { + address friend = _friends[i]; + require(friend != address(0), "Invalid friend address provided"); + require(!isFriend[friend], "Duplicate friend address provided"); + isFriend[friend] = true; + } + friends = _friends; + threshold = _threshold; + } + + /// @dev Allows a friend to confirm a Safe transaction. + /// @param dataHash Safe transaction hash. + function confirmTransaction(bytes32 dataHash) + public + onlyFriend + { + require(!isExecuted[dataHash], "Recovery already executed"); + isConfirmed[dataHash][msg.sender] = true; + } + + /// @dev Returns if Safe transaction is a valid owner replacement transaction. + /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list + /// @param oldOwner Owner address to be replaced. + /// @param newOwner New owner address. + /// @return Returns if transaction can be executed. + function recoverAccess(address prevOwner, address oldOwner, address newOwner) + public + onlyFriend + { + bytes memory data = abi.encodeWithSignature("swapOwner(address,address,address)", prevOwner, oldOwner, newOwner); + bytes32 dataHash = getDataHash(data); + require(!isExecuted[dataHash], "Recovery already executed"); + require(isConfirmedByRequiredFriends(dataHash), "Recovery has not enough confirmations"); + isExecuted[dataHash] = true; + require(manager.execTransactionFromModule(address(manager), 0, data, Enum.Operation.Call), "Could not execute recovery"); + } + + /// @dev Returns if Safe transaction is a valid owner replacement transaction. + /// @param dataHash Data hash. + /// @return Confirmation status. + function isConfirmedByRequiredFriends(bytes32 dataHash) + public + view + returns (bool) + { + uint256 confirmationCount; + for (uint256 i = 0; i < friends.length; i++) { + if (isConfirmed[dataHash][friends[i]]) + confirmationCount++; + if (confirmationCount == threshold) + return true; + } + return false; + } + + /// @dev Returns hash of data encoding owner replacement. + /// @param data Data payload. + /// @return Data hash. + function getDataHash(bytes memory data) + public + pure + returns (bytes32) + { + return keccak256(data); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/StateChannelModule.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/StateChannelModule.sol new file mode 100644 index 000000000..68a8e1bd0 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/StateChannelModule.sol @@ -0,0 +1,89 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../base/Module.sol"; +import "../base/OwnerManager.sol"; +import "../common/Enum.sol"; +import "../common/SignatureDecoder.sol"; + + +/// @title Gnosis Safe State Module - A module that allows interaction with statechannels. +/// @author Stefan George - +/// @author Richard Meissner - +contract StateChannelModule is Module, SignatureDecoder { + + string public constant NAME = "State Channel Module"; + string public constant VERSION = "0.1.0"; + + // isExecuted mapping allows to check if a transaction (by hash) was already executed. + mapping (bytes32 => uint256) public isExecuted; + + /// @dev Setup function sets manager + function setup() + public + { + setManager(); + } + + /// @dev Allows to execute a Safe transaction confirmed by required number of owners. + /// @param to Destination address of Safe transaction. + /// @param value Ether value of Safe transaction. + /// @param data Data payload of Safe transaction. + /// @param operation Operation type of Safe transaction. + /// @param nonce Nonce used for this Safe transaction. + /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v}) + function execTransaction( + address to, + uint256 value, + bytes memory data, + Enum.Operation operation, + uint256 nonce, + bytes memory signatures + ) + public + { + bytes32 transactionHash = getTransactionHash(to, value, data, operation, nonce); + require(isExecuted[transactionHash] == 0, "Transaction already executed"); + checkHash(transactionHash, signatures); + // Mark as executed and execute transaction. + isExecuted[transactionHash] = 1; + require(manager.execTransactionFromModule(to, value, data, operation), "Could not execute transaction"); + } + + function checkHash(bytes32 transactionHash, bytes memory signatures) + internal + view + { + // There cannot be an owner with address 0. + address lastOwner = address(0); + address currentOwner; + uint256 i; + uint256 threshold = OwnerManager(address(manager)).getThreshold(); + // Validate threshold is reached. + for (i = 0; i < threshold; i++) { + currentOwner = recoverKey(transactionHash, signatures, i); + require(OwnerManager(address(manager)).isOwner(currentOwner), "Signature not provided by owner"); + require(currentOwner > lastOwner, "Signatures are not ordered by owner address"); + lastOwner = currentOwner; + } + } + + /// @dev Returns hash to be signed by owners. + /// @param to Destination address. + /// @param value Ether value. + /// @param data Data payload. + /// @param operation Operation type. + /// @param nonce Transaction nonce. + /// @return Transaction hash. + function getTransactionHash( + address to, + uint256 value, + bytes memory data, + Enum.Operation operation, + uint256 nonce + ) + public + view + returns (bytes32) + { + return keccak256(abi.encodePacked(byte(0x19), byte(0), this, to, value, data, operation, nonce)); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/WhitelistModule.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/WhitelistModule.sol new file mode 100644 index 000000000..e1bbd17f2 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/WhitelistModule.sol @@ -0,0 +1,66 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../base/Module.sol"; +import "../base/ModuleManager.sol"; +import "../base/OwnerManager.sol"; +import "../common/Enum.sol"; + + +/// @title Whitelist Module - Allows to execute transactions to whitelisted addresses without confirmations. +/// @author Stefan George - +contract WhitelistModule is Module { + + string public constant NAME = "Whitelist Module"; + string public constant VERSION = "0.1.0"; + + // isWhitelisted mapping maps destination address to boolean. + mapping (address => bool) public isWhitelisted; + + /// @dev Setup function sets initial storage of contract. + /// @param accounts List of whitelisted accounts. + function setup(address[] memory accounts) + public + { + setManager(); + for (uint256 i = 0; i < accounts.length; i++) { + address account = accounts[i]; + require(account != address(0), "Invalid account provided"); + isWhitelisted[account] = true; + } + } + + /// @dev Allows to add destination to whitelist. This can only be done via a Safe transaction. + /// @param account Destination address. + function addToWhitelist(address account) + public + authorized + { + require(account != address(0), "Invalid account provided"); + require(!isWhitelisted[account], "Account is already whitelisted"); + isWhitelisted[account] = true; + } + + /// @dev Allows to remove destination from whitelist. This can only be done via a Safe transaction. + /// @param account Destination address. + function removeFromWhitelist(address account) + public + authorized + { + require(isWhitelisted[account], "Account is not whitelisted"); + isWhitelisted[account] = false; + } + + /// @dev Returns if Safe transaction is to a whitelisted destination. + /// @param to Whitelisted destination address. + /// @param value Not checked. + /// @param data Not checked. + /// @return Returns if transaction can be executed. + function executeWhitelisted(address to, uint256 value, bytes memory data) + public + returns (bool) + { + // Only Safe owners are allowed to execute transactions to whitelisted accounts. + require(OwnerManager(address(manager)).isOwner(msg.sender), "Method can only be called by an owner"); + require(isWhitelisted[to], "Target account is not whitelisted"); + require(manager.execTransactionFromModule(to, value, data, Enum.Operation.Call), "Could not execute transaction"); + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol new file mode 100644 index 000000000..5eb686b14 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol @@ -0,0 +1,27 @@ +pragma solidity >=0.5.0 <0.7.0; +import "./GnosisSafeProxy.sol"; + + +/// @title Delegate Constructor Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. +/// @author Stefan George - +/// @author Richard Meissner - +contract DelegateConstructorProxy is GnosisSafeProxy { + + /// @dev Constructor function sets address of master copy contract. + /// @param _masterCopy Master copy address. + /// @param initializer Data used for a delegate call to initialize the contract. + constructor(address _masterCopy, bytes memory initializer) GnosisSafeProxy(_masterCopy) + public + { + if (initializer.length > 0) { + // solium-disable-next-line security/no-inline-assembly + assembly { + let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) + let success := delegatecall(sub(gas, 10000), masterCopy, add(initializer, 0x20), mload(initializer), 0, 0) + let ptr := mload(0x40) + returndatacopy(ptr, 0, returndatasize()) + if eq(success, 0) { revert(ptr, returndatasize()) } + } + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol new file mode 100644 index 000000000..e78216740 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol @@ -0,0 +1,47 @@ +pragma solidity >=0.5.0 <0.7.0; + +/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain +/// @author Richard Meissner - +interface IProxy { + function masterCopy() external view returns (address); +} + +/// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. +/// @author Stefan George - +/// @author Richard Meissner - +contract GnosisSafeProxy { + + // masterCopy always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. + // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` + address internal masterCopy; + + /// @dev Constructor function sets address of master copy contract. + /// @param _masterCopy Master copy address. + constructor(address _masterCopy) + public + { + require(_masterCopy != address(0), "Invalid master copy address provided"); + masterCopy = _masterCopy; + } + + /// @dev Fallback function forwards all transactions and returns all received return data. + function () + external + payable + { + // solium-disable-next-line security/no-inline-assembly + assembly { + let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) + // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s + if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { + mstore(0, masterCopy) + return(0, 0x20) + } + calldatacopy(0, 0, calldatasize()) + let success := delegatecall(gas, masterCopy, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + if eq(success, 0) { revert(0, returndatasize()) } + return(0, returndatasize()) + } + } +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol new file mode 100644 index 000000000..574f5e85b --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol @@ -0,0 +1,102 @@ +pragma solidity ^0.5.3; +import "./GnosisSafeProxy.sol"; +import "./IProxyCreationCallback.sol"; + +/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. +/// @author Stefan George - +contract GnosisSafeProxyFactory { + + event ProxyCreation(GnosisSafeProxy proxy); + + /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. + /// @param masterCopy Address of master copy. + /// @param data Payload for message call sent to new proxy contract. + function createProxy(address masterCopy, bytes memory data) + public + returns (GnosisSafeProxy proxy) + { + proxy = new GnosisSafeProxy(masterCopy); + if (data.length > 0) + // solium-disable-next-line security/no-inline-assembly + assembly { + if eq(call(gas, proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } + } + emit ProxyCreation(proxy); + } + + /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. + function proxyRuntimeCode() public pure returns (bytes memory) { + return type(GnosisSafeProxy).runtimeCode; + } + + /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. + function proxyCreationCode() public pure returns (bytes memory) { + return type(GnosisSafeProxy).creationCode; + } + + /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. + /// This method is only meant as an utility to be called from other methods + /// @param _mastercopy Address of master copy. + /// @param initializer Payload for message call sent to new proxy contract. + /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. + function deployProxyWithNonce(address _mastercopy, bytes memory initializer, uint256 saltNonce) + internal + returns (GnosisSafeProxy proxy) + { + // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it + bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); + bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(_mastercopy)); + // solium-disable-next-line security/no-inline-assembly + assembly { + proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) + } + require(address(proxy) != address(0), "Create2 call failed"); + } + + /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. + /// @param _mastercopy Address of master copy. + /// @param initializer Payload for message call sent to new proxy contract. + /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. + function createProxyWithNonce(address _mastercopy, bytes memory initializer, uint256 saltNonce) + public + returns (GnosisSafeProxy proxy) + { + proxy = deployProxyWithNonce(_mastercopy, initializer, saltNonce); + if (initializer.length > 0) + // solium-disable-next-line security/no-inline-assembly + assembly { + if eq(call(gas, proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0,0) } + } + emit ProxyCreation(proxy); + } + + /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction + /// @param _mastercopy Address of master copy. + /// @param initializer Payload for message call sent to new proxy contract. + /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. + /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. + function createProxyWithCallback(address _mastercopy, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback) + public + returns (GnosisSafeProxy proxy) + { + uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); + proxy = createProxyWithNonce(_mastercopy, initializer, saltNonceWithCallback); + if (address(callback) != address(0)) + callback.proxyCreated(proxy, _mastercopy, initializer, saltNonce); + } + + /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` + /// This method is only meant for address calculation purpose when you use an initializer that would revert, + /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. + /// @param _mastercopy Address of master copy. + /// @param initializer Payload for message call sent to new proxy contract. + /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. + function calculateCreateProxyWithNonceAddress(address _mastercopy, bytes calldata initializer, uint256 saltNonce) + external + returns (GnosisSafeProxy proxy) + { + proxy = deployProxyWithNonce(_mastercopy, initializer, saltNonce); + revert(string(abi.encodePacked(proxy))); + } + +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol new file mode 100644 index 000000000..15d9a54a7 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol @@ -0,0 +1,6 @@ +pragma solidity ^0.5.3; +import "./GnosisSafeProxy.sol"; + +interface IProxyCreationCallback { + function proxyCreated(GnosisSafeProxy proxy, address _mastercopy, bytes calldata initializer, uint256 saltNonce) external; +} diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/PayingProxy.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/PayingProxy.sol new file mode 100644 index 000000000..0db92a558 --- /dev/null +++ b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/PayingProxy.sol @@ -0,0 +1,29 @@ +pragma solidity >=0.5.0 <0.7.0; +import "../common/SecuredTokenTransfer.sol"; +import "./DelegateConstructorProxy.sol"; + +/// @title Paying Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. And sends funds after creation to a specified account. +/// @author Stefan George - +/// @author Richard Meissner - +contract PayingProxy is DelegateConstructorProxy, SecuredTokenTransfer { + + /// @dev Constructor function sets address of master copy contract. + /// @param _masterCopy Master copy address. + /// @param initializer Data used for a delegate call to initialize the contract. + /// @param funder Address that should be paid for the execution of this call + /// @param paymentToken Token that should be used for the payment (0 is ETH) + /// @param payment Value that should be paid + constructor(address _masterCopy, bytes memory initializer, address payable funder, address paymentToken, uint256 payment) + DelegateConstructorProxy(_masterCopy, initializer) + public + { + if (payment > 0) { + if (paymentToken == address(0)) { + // solium-disable-next-line security/no-send + require(funder.send(payment), "Could not pay safe creation with ether"); + } else { + require(transferToken(paymentToken, funder, payment), "Could not pay safe creation with token"); + } + } + } +} diff --git a/packages/testing-kit/src/deploy/deploy-contracts.ts b/packages/testing-kit/src/deploy/deploy-contracts.ts new file mode 100644 index 000000000..cce7a44ec --- /dev/null +++ b/packages/testing-kit/src/deploy/deploy-contracts.ts @@ -0,0 +1,249 @@ +import { SafeVersion } from '@safe-global/safe-core-sdk-types' +import { DeployFunction } from 'hardhat-deploy/types' +import { HardhatRuntimeEnvironment } from 'hardhat/types' + +export const safeVersionDeployed = process.env.SAFE_VERSION as SafeVersion + +type SafeVersions = { [key: string]: { name: string } } + +const safeContracts: SafeVersions = { + '1.4.1': { name: 'Safe_SV1_4_1' }, + '1.3.0': { name: 'Safe_SV1_3_0' }, + '1.2.0': { name: 'Safe_SV1_2_0' }, + '1.1.1': { name: 'Safe_SV1_1_1' }, + '1.0.0': { name: 'Safe_SV1_0_0' } +} + +const proxyFactoryContracts: SafeVersions = { + '1.4.1': { name: 'SafeProxyFactory_SV1_4_1' }, + '1.3.0': { name: 'SafeProxyFactory_SV1_3_0' }, + '1.2.0': { name: 'SafeProxyFactory_SV1_2_0' }, + '1.1.1': { name: 'SafeProxyFactory_SV1_1_1' }, + '1.0.0': { name: 'SafeProxyFactory_SV1_0_0' } +} + +const multiSendContracts: SafeVersions = { + '1.4.1': { name: 'MultiSend_SV1_4_1' }, + '1.3.0': { name: 'MultiSend_SV1_3_0' }, + '1.2.0': { name: 'MultiSend_SV1_2_0' }, + '1.1.1': { name: 'MultiSend_SV1_2_0' }, + '1.0.0': { name: 'MultiSend_SV1_2_0' } +} + +const multiSendCallOnlyContracts: SafeVersions = { + '1.4.1': { name: 'MultiSendCallOnly_SV1_4_1' }, + '1.3.0': { name: 'MultiSendCallOnly_SV1_3_0' }, + '1.2.0': { name: 'MultiSendCallOnly_SV1_3_0' }, + '1.1.1': { name: 'MultiSendCallOnly_SV1_3_0' }, + '1.0.0': { name: 'MultiSendCallOnly_SV1_3_0' } +} + +const compatibilityFallbackHandlerContracts: SafeVersions = { + '1.4.1': { name: 'CompatibilityFallbackHandler_SV1_4_1' }, + '1.3.0': { name: 'CompatibilityFallbackHandler_SV1_3_0' }, + '1.2.0': { name: 'CompatibilityFallbackHandler_SV1_3_0' }, + '1.1.1': { name: 'CompatibilityFallbackHandler_SV1_3_0' }, + '1.0.0': { name: 'CompatibilityFallbackHandler_SV1_3_0' } +} + +const signMessageLibContracts: SafeVersions = { + '1.4.1': { name: 'SignMessageLib_SV1_4_1' }, + '1.3.0': { name: 'SignMessageLib_SV1_3_0' }, + '1.2.0': { name: 'SignMessageLib_SV1_3_0' }, + '1.1.1': { name: 'SignMessageLib_SV1_3_0' }, + '1.0.0': { name: 'SignMessageLib_SV1_3_0' } +} + +const createCallContracts: SafeVersions = { + '1.4.1': { name: 'CreateCall_SV1_4_1' }, + '1.3.0': { name: 'CreateCall_SV1_3_0' }, + '1.2.0': { name: 'CreateCall_SV1_3_0' }, + '1.1.1': { name: 'CreateCall_SV1_3_0' }, + '1.0.0': { name: 'CreateCall_SV1_3_0' } +} + +const simulateTxAccessorContracts: SafeVersions = { + '1.4.1': { name: 'SimulateTxAccessor_SV1_4_1' }, + '1.3.0': { name: 'SimulateTxAccessor_SV1_3_0' }, + '1.2.0': { name: 'SimulateTxAccessor_SV1_3_0' }, + '1.1.1': { name: 'SimulateTxAccessor_SV1_3_0' }, + '1.0.0': { name: 'SimulateTxAccessor_SV1_3_0' } +} + +const safeWebAuthnSignerFactoryContracts: SafeVersions = { + '1.4.1': { name: 'SafeWebAuthnSignerFactory_SV1_4_1' }, + '1.3.0': { name: 'SafeWebAuthnSignerFactory_SV1_4_1' }, + '1.2.0': { name: 'SafeWebAuthnSignerFactory_SV1_4_1' }, + '1.1.1': { name: 'SafeWebAuthnSignerFactory_SV1_4_1' }, + '1.0.0': { name: 'SafeWebAuthnSignerFactory_SV1_4_1' } +} + +const safeWebAuthnSharedSignerContracts: SafeVersions = { + '1.4.1': { name: 'SafeWebAuthnSharedSigner' }, + '1.3.0': { name: 'SafeWebAuthnSharedSigner' }, + '1.2.0': { name: 'SafeWebAuthnSharedSigner' }, + '1.1.1': { name: 'SafeWebAuthnSharedSigner' }, + '1.0.0': { name: 'SafeWebAuthnSharedSigner' } +} + +export const safeDeployed = safeContracts[safeVersionDeployed] +export const proxyFactoryDeployed = proxyFactoryContracts[safeVersionDeployed] +export const multiSendDeployed = multiSendContracts[safeVersionDeployed] +export const multiSendCallOnlyDeployed = multiSendCallOnlyContracts[safeVersionDeployed] +export const compatibilityFallbackHandlerDeployed = + compatibilityFallbackHandlerContracts[safeVersionDeployed] +export const signMessageLibDeployed = signMessageLibContracts[safeVersionDeployed] +export const createCallDeployed = createCallContracts[safeVersionDeployed] +export const simulateTxAccessorDeployed = simulateTxAccessorContracts[safeVersionDeployed] +export const safeWebAuthnSignerFactoryDeployed = + safeWebAuthnSignerFactoryContracts[safeVersionDeployed] +export const safeWebAuthnSharedSignerDeployed = + safeWebAuthnSharedSignerContracts[safeVersionDeployed] + +const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment): Promise => { + const { deployments, getNamedAccounts } = hre + + const { deployer } = await getNamedAccounts() + const { deploy } = deployments + + await deploy(safeDeployed.name, { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy(proxyFactoryDeployed.name, { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy(multiSendDeployed.name, { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy(multiSendCallOnlyDeployed.name, { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy(signMessageLibDeployed.name, { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy(createCallDeployed.name, { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy(compatibilityFallbackHandlerDeployed.name, { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy(simulateTxAccessorDeployed.name, { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy(safeWebAuthnSignerFactoryDeployed.name, { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy(safeWebAuthnSharedSignerDeployed.name, { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy('WebAuthnContract', { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy('DailyLimitModule', { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy('SocialRecoveryModule', { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy('ERC20Mintable', { + from: deployer, + args: [], + log: true + }) + + await deploy('DebugTransactionGuard_SV1_3_0', { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy('DefaultCallbackHandler_SV1_3_0', { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy('DebugTransactionGuard_SV1_4_1', { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy('TokenCallbackHandler_SV1_4_1', { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy('StateChannelModule', { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) + + await deploy('WhitelistModule', { + from: deployer, + args: [], + log: true, + deterministicDeployment: true + }) +} + +export default deploy diff --git a/packages/testing-kit/src/index.ts b/packages/testing-kit/src/index.ts new file mode 100644 index 000000000..1cf3ff561 --- /dev/null +++ b/packages/testing-kit/src/index.ts @@ -0,0 +1 @@ +export { getHardHatConfig } from './config' diff --git a/packages/testing-kit/tsconfig.build.json b/packages/testing-kit/tsconfig.build.json new file mode 100644 index 000000000..c05e497c4 --- /dev/null +++ b/packages/testing-kit/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "composite": true, + "outDir": "dist" + }, + "include": ["src/**/*"] +} diff --git a/packages/testing-kit/tsconfig.json b/packages/testing-kit/tsconfig.json new file mode 100644 index 000000000..59278cec0 --- /dev/null +++ b/packages/testing-kit/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "composite": true, + "outDir": "dist" + }, + "include": ["src/**/*", "./hardhat.config.ts"] +} diff --git a/tsconfig.json b/tsconfig.json index abba2f963..6d158fb70 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "files": [], "references": [ + { "path": "packages/testing-kit" }, { "path": "packages/api-kit" }, { "path": "packages/protocol-kit" }, { "path": "packages/relay-kit" }, diff --git a/yarn.lock b/yarn.lock index 5a56697e6..26e5583c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2871,6 +2871,14 @@ ansi-styles@^6.0.0, ansi-styles@^6.1.0, ansi-styles@^6.2.1: resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== +anymatch@^1.3.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" + integrity sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA== + dependencies: + micromatch "^2.1.5" + normalize-path "^2.0.0" + anymatch@^3.0.3, anymatch@~3.1.2: version "3.1.3" resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz" @@ -2921,6 +2929,28 @@ argparse@^2.0.1: resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + integrity sha512-dtXTVMkh6VkEEA7OhXnN1Ecb8aAGFdZ1LFxtOCoqj4qkyOJMt7+qs6Ahdy6p/NQCPYsRSXXivhSB/J5E9jmYKA== + dependencies: + arr-flatten "^1.0.1" + +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha512-YVIQ82gZPGBebQV/a8dar4AitzCQs0jjXwMPZllpXMaGjXPYVUawSxQrRsjhjupyVxEvbHgUmIhKVlND+j02kA== + +arr-flatten@^1.0.1, arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q== + array-differ@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz" @@ -2936,6 +2966,16 @@ array-union@^2.1.0: resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + integrity sha512-G2n5bG5fSUCpnsXz4+8FUkYsGPkNfLn9YvS66U5qbTIXI2Ynnlo4Bi42bWv+omKUCqz+ejzfClwne0alJWJPhg== + +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ== + arrify@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" @@ -2951,6 +2991,16 @@ assertion-error@^1.1.0: resolved "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw== + +async-each@^1.0.0: + version "1.0.6" + resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.6.tgz#52f1d9403818c179b7561e11a5d1b77eb2160e77" + integrity sha512-c646jH1avxr+aVpndVMeAfYw7wAa6idufrlN3LPA4PmKS0QEGp6PIC9nwz0WQkkvBGAMEki3pFdtxaF39J9vvg== + async-mutex@^0.4.0: version "0.4.0" resolved "https://registry.npmjs.org/async-mutex/-/async-mutex-0.4.0.tgz" @@ -2968,6 +3018,11 @@ asynckit@^0.4.0: resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== +atob@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + available-typed-arrays@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz" @@ -3057,6 +3112,14 @@ babel-preset-jest@^29.6.3: babel-plugin-jest-hoist "^29.6.3" babel-preset-current-node-syntax "^1.0.0" +babel-runtime@^6.9.2: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g== + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" @@ -3079,6 +3142,19 @@ base64url@^3.0.1: resolved "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz" integrity sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A== +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + bech32@1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz" @@ -3099,11 +3175,23 @@ bignumber.js@^9.1.2: resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== +binary-extensions@^1.0.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" + integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== + binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== +bindings@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + bl@^4.0.3, bl@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz" @@ -3162,6 +3250,31 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + integrity sha512-xU7bpz2ytJl1bH9cgIurjpg/n8Gohy9GTw81heDYLJQ4RU60dlyJsa+atVF2pI0yMMvKxI9HkKwjePCj5XI1hw== + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + +braces@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + braces@^3.0.3, braces@~3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" @@ -3316,6 +3429,21 @@ cacache@^18.0.0: tar "^6.1.11" unique-filename "^3.0.0" +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + caching-transform@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz" @@ -3453,6 +3581,22 @@ chokidar@3.5.3, chokidar@^3.4.0, chokidar@^3.5.2, chokidar@^3.5.3: optionalDependencies: fsevents "~2.3.2" +chokidar@^1.6.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" + integrity sha512-mk8fAWcRUOxY7btlLtitj3A45jOwSAxH4tOFOoEGbVsl6cL6pPMWUy7dwZ/canfj3QEdP6FHSnf/l1c6/WkzVg== + dependencies: + anymatch "^1.3.0" + async-each "^1.0.0" + glob-parent "^2.0.0" + inherits "^2.0.1" + is-binary-path "^1.0.0" + is-glob "^2.0.0" + path-is-absolute "^1.0.0" + readdirp "^2.0.0" + optionalDependencies: + fsevents "^1.0.0" + chownr@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz" @@ -3481,6 +3625,16 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz" integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz" @@ -3584,6 +3738,14 @@ collect-v8-coverage@^1.0.0: resolved "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz" integrity sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg== +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha512-lNkKvzEeMBBjUGHZ+q6z9pSJla0KWAQPvtzhEV9+iGyQYG+pBpl7xKDhxoNSOZH2hhv0v5k0y2yAM4o4SjoSkw== + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + color-convert@^1.9.0: version "1.9.3" resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" @@ -3671,6 +3833,11 @@ compare-func@^2.0.0: array-ify "^1.0.0" dot-prop "^5.1.0" +component-emitter@^1.2.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.1.tgz#ef1d5796f7d93f135ee6fb684340b26403c97d17" + integrity sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" @@ -3779,6 +3946,16 @@ cookie@^0.4.1: resolved "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz" integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha512-XgZ0pFcakEUlbwQEVNg3+QAis1FyTL3Qel9FYy8pSkQqoG3PNoT0bOCQtOXcOkur21r2Eq2kI+IE+gsmAEVlYw== + +core-js@^2.4.0: + version "2.6.12" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" + integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== + core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz" @@ -3794,6 +3971,23 @@ cosmiconfig@^8.2.0: parse-json "^5.2.0" path-type "^4.0.0" +cpx@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/cpx/-/cpx-1.5.0.tgz#185be018511d87270dedccc293171e37655ab88f" + integrity sha512-jHTjZhsbg9xWgsP2vuNW2jnnzBX+p4T+vNI9Lbjzs1n4KhOfa22bQppiFYLsWQKd8TzmL5aSP/Me3yfsCwXbDA== + dependencies: + babel-runtime "^6.9.2" + chokidar "^1.6.0" + duplexer "^0.1.1" + glob "^7.0.5" + glob2base "^0.0.12" + minimatch "^3.0.2" + mkdirp "^0.5.1" + resolve "^1.1.7" + safe-buffer "^5.0.1" + shell-quote "^1.6.1" + subarg "^1.0.0" + crc-32@^1.2.0, crc-32@^1.2.2: version "1.2.2" resolved "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz" @@ -3916,6 +4110,13 @@ debug@4.3.4: dependencies: ms "2.1.2" +debug@^2.2.0, debug@^2.3.3: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + decamelize-keys@^1.1.0: version "1.1.1" resolved "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz" @@ -3939,6 +4140,11 @@ decimal.js@^10.4.2: resolved "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz" integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== +decode-uri-component@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" + integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== + dedent@0.7.0: version "0.7.0" resolved "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz" @@ -3994,6 +4200,28 @@ define-lazy-prop@^2.0.0: resolved "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz" integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og== +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA== + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha512-cZTYKFWspt9jZsMscWo8sc/5lbPC9Q0N5nBLgb+Yd915iL3udB1uFgS3B8YCx66UVHq018DAVFoee7x+gxggeA== + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" @@ -4431,7 +4659,7 @@ ethers@6.7.0: tslib "2.4.0" ws "8.5.0" -ethers@^5.7.0: +ethers@^5.7.0, ethers@~5.7.0: version "5.7.2" resolved "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -4566,6 +4794,33 @@ exit@^0.1.2: resolved "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + integrity sha512-hxx03P2dJxss6ceIeri9cmYOT4SRs3Zk3afZwWpOsRqLqprhTR8u++SlC+sFGsQr7WGFPdMF7Gjc1njDLDK6UA== + dependencies: + is-posix-bracket "^0.1.0" + +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha512-w/ozOKR9Obk3qoWeY/WDi6MFta9AoMR+zud60mdnbniMcBxRuFJyDt2LdX/14A1UABeqk+Uk+LDfUpvoGKppZA== + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + integrity sha512-AFASGfIlnIbkKPQwX1yHaDjFvh/1gyKJODme52V6IORh69uEYgZp0o9C+qsIGNVEiuuhQU0CSSl++Rlegg1qvA== + dependencies: + fill-range "^2.1.0" + expect@^29.0.0, expect@^29.7.0: version "29.7.0" resolved "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz" @@ -4582,6 +4837,21 @@ exponential-backoff@^3.1.1: resolved "https://registry.yarnpkg.com/exponential-backoff/-/exponential-backoff-3.1.1.tgz#64ac7526fe341ab18a39016cd22c787d01e00bf6" integrity sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw== +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug== + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha512-BwY5b5Ql4+qZoefgMj2NUmx+tehVTH/Kf4k1ZEtOHNFcm2wSxMRo992l6X3TIgni2eZVTZ85xMOjF31fwZAj6Q== + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + external-editor@^3.0.3: version "3.1.0" resolved "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz" @@ -4591,6 +4861,27 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + integrity sha512-1FOj1LOwn42TMrruOHGt18HemVnbwAmAak7krWk+wa93KXxGbK+2jpezm+ytJYDaBX0/SPLZFHKM7m+tKobWGg== + dependencies: + is-extglob "^1.0.0" + +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" @@ -4660,6 +4951,11 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + filelist@^1.0.1: version "1.0.4" resolved "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz" @@ -4667,6 +4963,32 @@ filelist@^1.0.1: dependencies: minimatch "^5.0.1" +filename-regex@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + integrity sha512-BTCqyBaWBTsauvnHiE8i562+EdJj+oUpkqWp2R1iCoR8f6oo8STRu3of7WJJ0TqWtxN50a5YFpzYK4Jj9esYfQ== + +fill-range@^2.1.0: + version "2.2.4" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q== + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^3.0.0" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha512-VcpLTWqWDiTerugjj8e3+esbg+skS3M9e54UuR3iCeIDMXCLTsAH8hTSzDQU/X6/6t3eYkOKoZSef2PlU6U1XQ== + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + fill-range@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" @@ -4683,6 +5005,11 @@ find-cache-dir@^3.2.0: make-dir "^3.0.2" pkg-dir "^4.1.0" +find-index@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4" + integrity sha512-uJ5vWrfBKMcE6y2Z8834dwEZj9mNGxYa3t3I53OwFeuZ8D9oc2E5zcsrkuhX6h4iYrjhiv0T3szQmxlAV9uxDg== + find-up@5.0.0, find-up@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" @@ -4743,6 +5070,18 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" +for-in@^1.0.1, for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ== + +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + integrity sha512-SKmowqGTJoPzLO1T0BBJpkfp3EMacCMOuH40hOUbrbzElVktk4DioXVM99QkLCyKoiuOmyjgcWMpVz2xjE7LZw== + dependencies: + for-in "^1.0.1" + foreground-child@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz" @@ -4778,6 +5117,13 @@ fp-ts@^1.0.0: resolved "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.5.tgz" integrity sha512-wDNqTimnzs8QqpldiId9OavWK2NptormjXnRJTQecNjzwfyp6P/8s/zG8e4h3ja3oqkKaY72UlTjQYt/1yXf9A== +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha512-GMBAbW9antB8iZRHLoGw0b3HANt57diZYFO/HL1JGIC1MjKrdmhxvrJbupnVvpys0zsz7yBApXdQyfepKly2kA== + dependencies: + map-cache "^0.2.2" + fromentries@^1.2.0: version "1.3.2" resolved "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz" @@ -4852,6 +5198,14 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== +fsevents@^1.0.0: + version "1.2.13" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.13.tgz#f325cb0455592428bcf11b383370ef70e3bfcc38" + integrity sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw== + dependencies: + bindings "^1.5.0" + nan "^2.12.1" + fsevents@^2.3.2, fsevents@~2.3.2: version "2.3.2" resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" @@ -4941,6 +5295,11 @@ get-stream@^8.0.1: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-8.0.1.tgz#def9dfd71742cd7754a7761ed43749a27d02eca2" integrity sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA== +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA== + git-raw-commits@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-3.0.0.tgz#5432f053a9744f67e8db03dbc48add81252cfdeb" @@ -4988,6 +5347,14 @@ gitconfiglocal@^1.0.0: dependencies: ini "^1.3.2" +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + integrity sha512-ab1S1g1EbO7YzauaJLkgLp7DZVAqj9M/dvKlTt8DkXA2tiOIcSMrlVI2J1RZyB5iJVccEscjGn+kpOG9788MHA== + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + glob-parent@5.1.2, glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" @@ -4995,6 +5362,13 @@ glob-parent@5.1.2, glob-parent@^5.1.2, glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + integrity sha512-JDYOvfxio/t42HKdxkAYaCiBN7oYiuxykOxKxdaUW5Qn0zaYN3gRQWolrwdnf0shM9/EP0ebuuTmyoXNr1cC5w== + dependencies: + is-glob "^2.0.0" + glob-parent@^6.0.2: version "6.0.2" resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" @@ -5002,6 +5376,13 @@ glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" +glob2base@^0.0.12: + version "0.0.12" + resolved "https://registry.yarnpkg.com/glob2base/-/glob2base-0.0.12.tgz#9d419b3e28f12e83a362164a277055922c9c0d56" + integrity sha512-ZyqlgowMbfj2NPjxaZZ/EtsXlOch28FRXgMd64vqZWk1bT9+wvSRLYD1om9M7QfQru51zJPAT17qXm4/zd+9QA== + dependencies: + find-index "^0.1.1" + glob@7.2.0: version "7.2.0" resolved "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz" @@ -5026,7 +5407,7 @@ glob@^10.2.2, glob@^10.3.10: package-json-from-dist "^1.0.0" path-scurry "^1.11.1" -glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: +glob@^7.0.5, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.2.3" resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -5117,10 +5498,10 @@ hard-rejection@^2.1.0: resolved "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz" integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== -hardhat-deploy@^0.11.45: - version "0.11.45" - resolved "https://registry.yarnpkg.com/hardhat-deploy/-/hardhat-deploy-0.11.45.tgz#bed86118175a38a03bb58aba2ce1ed5e80a20bc8" - integrity sha512-aC8UNaq3JcORnEUIwV945iJuvBwi65tjHVDU3v6mOcqik7WAzHVCJ7cwmkkipsHrWysrB5YvGF1q9S1vIph83w== +hardhat-deploy@^0.12.4: + version "0.12.4" + resolved "https://registry.yarnpkg.com/hardhat-deploy/-/hardhat-deploy-0.12.4.tgz#5ebef37f1004f52a74987213b0465ad7c9433fb2" + integrity sha512-bYO8DIyeGxZWlhnMoCBon9HNZb6ji0jQn7ngP1t5UmGhC8rQYhji7B73qETMOFhzt5ECZPr+U52duj3nubsqdQ== dependencies: "@ethersproject/abi" "^5.7.0" "@ethersproject/abstract-signer" "^5.7.0" @@ -5145,7 +5526,7 @@ hardhat-deploy@^0.11.45: match-all "^1.2.6" murmur-128 "^0.2.1" qs "^6.9.4" - zksync-web3 "^0.14.3" + zksync-ethers "^5.0.0" hardhat@2.20.1: version "2.20.1" @@ -5291,6 +5672,37 @@ has-unicode@2.0.1, has-unicode@^2.0.1: resolved "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz" integrity sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ== +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha512-gpG936j8/MzaeID5Yif+577c17TxaDmhuyVgSwtnL/q8UUTySg8Mecb+8Cf1otgLoD7DDH75axp86ER7LFsf3Q== + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha512-IBXk4GTsLYdQ7Rvt+GRBrFSVEkmuOUy4re0Xjd9kJSUQpnTrWR4/y9RpfexN9vkAPMFuQoeWKwqzPozRTlasGw== + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha512-J8S0cEdWuQbqD9//tlZxiMuMNmxB8PlEwvYwuxsTmR1G5RXUePEX/SJn7aD0GMLieuZYSwNH0cQuJGwnYunXRQ== + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha512-ODYZC64uqzmtfGMEAX/FvZiRyWLpAC3vYnNunURUnkGVTS+mI0smVsWaPydRBsE3g+ok7h960jChO8mFcWlHaQ== + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + has@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/has/-/has-1.0.3.tgz" @@ -5330,6 +5742,13 @@ hasown@^2.0.0: dependencies: function-bind "^1.1.2" +hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + he@1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz" @@ -5601,6 +6020,13 @@ ip-address@^9.0.5: jsbn "1.1.0" sprintf-js "^1.1.3" +is-accessor-descriptor@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.1.tgz#3223b10628354644b86260db29b3e693f5ceedd4" + integrity sha512-YBUanLI8Yoihw923YeFUS5fs0fF2f5TSFTNiYAAzhhDscDa3lEqYuz1pDOEP5KvX94I9ey3vsqjJcLVFVU+3QA== + dependencies: + hasown "^2.0.0" + is-arguments@^1.0.4: version "1.1.1" resolved "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz" @@ -5614,6 +6040,13 @@ is-arrayish@^0.2.1: resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== +is-binary-path@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + integrity sha512-9fRVlXc0uCxEDj1nQzaWONSpbTfx0FmJfzHF7pwlI8DkWGoHBBea4Pg5Ky0ojwwxQmnSifgbKkI06Qv0Ljgj+Q== + dependencies: + binary-extensions "^1.0.0" + is-binary-path@~2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz" @@ -5621,6 +6054,11 @@ is-binary-path@~2.1.0: dependencies: binary-extensions "^2.0.0" +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + is-callable@^1.1.3: version "1.2.7" resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz" @@ -5640,11 +6078,70 @@ is-core-module@^2.11.0, is-core-module@^2.5.0, is-core-module@^2.8.1: dependencies: has "^1.0.3" +is-core-module@^2.13.0: + version "2.15.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.1.tgz#a7363a25bee942fefab0de13bf6aa372c82dcc37" + integrity sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ== + dependencies: + hasown "^2.0.2" + +is-data-descriptor@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.1.tgz#2109164426166d32ea38c405c1e0945d9e6a4eeb" + integrity sha512-bc4NlCDiCr28U4aEsQ3Qs2491gVq4V8G7MQyws968ImqjKuYtTJXrl7Vq7jsN7Ly/C3xj5KWFrY7sHNeDkAzXw== + dependencies: + hasown "^2.0.0" + +is-descriptor@^0.1.0: + version "0.1.7" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.7.tgz#2727eb61fd789dcd5bdf0ed4569f551d2fe3be33" + integrity sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg== + dependencies: + is-accessor-descriptor "^1.0.1" + is-data-descriptor "^1.0.1" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.3.tgz#92d27cb3cd311c4977a4db47df457234a13cb306" + integrity sha512-JCNNGbwWZEVaSPtS45mdtrneRWJFp07LLmykxeFV5F6oBvNF8vHSfJuJgoT472pSfk+Mf8VnlrspaFBHWM8JAw== + dependencies: + is-accessor-descriptor "^1.0.1" + is-data-descriptor "^1.0.1" + is-docker@^2.0.0, is-docker@^2.1.1: version "2.2.1" resolved "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz" integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== +is-dotfile@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + integrity sha512-9YclgOGtN/f8zx0Pr4FQYMdibBiTaH3sn52vjYip4ZSf6C4/6RfTEZ+MR4GvKhCxdPh21Bg42/WL55f6KSnKpg== + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + integrity sha512-0EygVC5qPvIyb+gSz7zdD5/AAoS6Qrx1e//6N4yv4oNm30kqvdmG66oZFWVlQHUWe5OjP08FuTw2IdT0EOTcYA== + dependencies: + is-primitive "^2.0.0" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw== + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== + dependencies: + is-plain-object "^2.0.4" + +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + integrity sha512-7Q+VbVafe6x2T+Tu6NcOf6sRklazEPmBoB3IWk3WdGZM2iGUwU/Oe3Wtq5lSEkDTTlpp8yx+5t4pzO/i9Ty1ww== + is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" @@ -5679,6 +6176,13 @@ is-generator-function@^1.0.7: dependencies: has-tostringtag "^1.0.0" +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + integrity sha512-a1dBeB19NXsf/E0+FHqkagizel/LQw2DjSQpvQrj3zT+jYPpaUCryPnrQajXKFLCMuf4I6FhRpaGtw4lPrG6Eg== + dependencies: + is-extglob "^1.0.0" + is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" @@ -5701,6 +6205,25 @@ is-lambda@^1.0.1: resolved "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz" integrity sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ== +is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + integrity sha512-QUzH43Gfb9+5yckcrSA0VBDwEtDUchrk4F6tfJZQuNzDJbEDB9cZNzSfXGQ1jqmdDY/kl41lUOWM9syA8z8jlg== + dependencies: + kind-of "^3.0.2" + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg== + dependencies: + kind-of "^3.0.2" + +is-number@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== + is-number@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" @@ -5726,7 +6249,7 @@ is-plain-obj@^2.1.0: resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz" integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== -is-plain-object@^2.0.4: +is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz" integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== @@ -5738,11 +6261,21 @@ is-plain-object@^5.0.0: resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz" integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + integrity sha512-Yu68oeXJ7LeWNmZ3Zov/xg/oDBnBK2RNxwYY1ilNJX+tKKZqgPK+qOn/Gs9jEu66KDY9Netf5XLKNGzas/vPfQ== + is-potential-custom-element-name@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz" integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + integrity sha512-N3w1tFaRfk3UrPfqeRyD+GYDASU3W5VinKhlORy8EWVf/sIdDL9GAcew85XmktCfH+ngG7SRXEVDoO18WMdB/Q== + is-ssh@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/is-ssh/-/is-ssh-1.4.0.tgz" @@ -5810,16 +6343,16 @@ isarray@0.0.1: resolved "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== +isarray@1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== + isarray@^2.0.5: version "2.0.5" resolved "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz" integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" - integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== - isexe@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" @@ -5830,7 +6363,14 @@ isexe@^3.1.1: resolved "https://registry.yarnpkg.com/isexe/-/isexe-3.1.1.tgz#4a407e2bd78ddfb14bea0c27c6f7072dde775f0d" integrity sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ== -isobject@^3.0.1: +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha512-+OUdGJlgjOBZDfxnDjYYG6zp487z0JGNQq3cYQYg5f5hKR+syHMsaztzGeml/4kGG55CSpKSpWTY+jYGgsHLgA== + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== @@ -6492,7 +7032,21 @@ keccak@^3.0.0, keccak@^3.0.2: node-gyp-build "^4.2.0" readable-stream "^3.6.0" -kind-of@^6.0.2, kind-of@^6.0.3: +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ== + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha512-24XsCxmEbRwEDbz/qz3stgin8TTzZ1ESR56OMCN0ujYg+vRutNSiOj9bHH9u85DKgXguraugV5sFuvbD4FW/hw== + dependencies: + is-buffer "^1.1.5" + +kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: version "6.0.3" resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== @@ -6887,6 +7441,11 @@ makeerror@1.0.12: dependencies: tmpl "1.0.5" +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg== + map-obj@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz" @@ -6897,11 +7456,23 @@ map-obj@^4.0.0: resolved "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz" integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha512-4y7uGv8bd2WdM9vpQsiQNo41Ln1NvhvDRuVt0k2JZQ+ezN2uaQes7lZeZ+QQUHOLQAtDaBJ+7wCbi+ab/KFs+w== + dependencies: + object-visit "^1.0.0" + match-all@^1.2.6: version "1.2.6" resolved "https://registry.npmjs.org/match-all/-/match-all-1.2.6.tgz" integrity sha512-0EESkXiTkWzrQQntBu2uzKvLu6vVkUGz40nGPbSZuegcfE5UuSzNjLaIu76zJWuaT/2I3Z/8M06OlUOZLGwLlQ== +math-random@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" + integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A== + md5.js@^1.3.4: version "1.3.5" resolved "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz" @@ -6948,6 +7519,44 @@ micro-ftch@^0.3.1: resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" integrity sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg== +micromatch@^2.1.5: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + integrity sha512-LnU2XFEk9xxSJ6rfgAry/ty5qwUTyHYOBU0g4R6tIw5ljwgGIBmiKhRWLw5NpMOnrgUNcDJ4WMp8rl3sYVHLNA== + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" + +micromatch@^3.1.10: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + micromatch@^4.0.4, micromatch@~4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5" @@ -7014,7 +7623,7 @@ minimatch@9.0.3: dependencies: brace-expansion "^2.0.1" -minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: +minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -7051,7 +7660,7 @@ minimist-options@4.1.0: is-plain-obj "^1.1.0" kind-of "^6.0.3" -minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: +minimist@^1.1.0, minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: version "1.2.8" resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== @@ -7140,6 +7749,21 @@ minizlib@^2.1.1, minizlib@^2.1.2: minipass "^3.0.0" yallist "^4.0.0" +mixin-deep@^1.2.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + +mkdirp@^0.5.1: + version "0.5.6" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" + integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== + dependencies: + minimist "^1.2.6" + mkdirp@^1.0.3: version "1.0.4" resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" @@ -7184,6 +7808,11 @@ modify-values@^1.0.1: resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== + ms@2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" @@ -7229,11 +7858,33 @@ mylas@^2.1.9: resolved "https://registry.npmjs.org/mylas/-/mylas-2.1.13.tgz" integrity sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg== +nan@^2.12.1: + version "2.20.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.20.0.tgz#08c5ea813dd54ed16e5bd6505bf42af4f7838ca3" + integrity sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw== + nanoid@3.3.3: version "3.3.3" resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz" integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" @@ -7374,6 +8025,13 @@ normalize-package-data@^6.0.0: semver "^7.3.5" validate-npm-package-license "^3.0.4" +normalize-path@^2.0.0, normalize-path@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w== + dependencies: + remove-trailing-separator "^1.0.1" + normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" @@ -7606,6 +8264,15 @@ nyc@^15.1.0: test-exclude "^6.0.0" yargs "^15.0.2" +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha512-79LYn6VAb63zgtmAteVOWo9Vdj71ZVBy3Pbse+VqxDpEP83XuujMrGqHIwAXJ5I/aM0zU7dIyIAhifVTPrNItQ== + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + object-inspect@^1.9.0: version "1.12.3" resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz" @@ -7616,6 +8283,28 @@ object-keys@^1.1.1: resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha512-GBaMwwAVK9qbQN3Scdo0OyvgPW7l3lnaVMj84uTOZlswkX0KpF6fyDBJhtTthf7pymztoN36/KEr1DyhF96zEA== + dependencies: + isobject "^3.0.0" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + integrity sha512-UiAM5mhmIuKLsOvrL+B0U2d1hXHF3bFYWIuH1LMpuV2EJEHG1Ntz06PgLEHjm6VFd87NpH8rastvPoyv6UW2fA== + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ== + dependencies: + isobject "^3.0.1" + obliterator@^2.0.0: version "2.0.4" resolved "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz" @@ -7868,6 +8557,16 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + integrity sha512-FC5TeK0AwXzq3tUBFtH74naWkPQCEWs4K+xMxWZBlKDWu0bVHXGZa+KKqxKidd7xwhdZ19ZNuF2uO1M/r196HA== + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + parse-json@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz" @@ -7907,6 +8606,11 @@ parse5@^7.0.0, parse5@^7.1.1: dependencies: entities "^4.4.0" +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha512-XHXfu/yOQRy9vYOtUDVMN60OEJjW013GoObG1o+xwQTpB9eYJX/BjXMsdW13ZDPruFhYYn0AG22w0xgQMwl3Nw== + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz" @@ -8039,6 +8743,11 @@ pony-cause@^2.1.10: resolved "https://registry.yarnpkg.com/pony-cause/-/pony-cause-2.1.10.tgz#828457ad6f13be401a075dbf14107a9057945174" integrity sha512-3IKLNXclQgkU++2fSi93sQ6BznFuxSLB11HdvZQ6JW/spahf/P1pAHBQEahr20rs0htZW0UDkM1HmA+nZkXKsw== +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha512-xTgYBc3fuo7Yt7JbiuFxSYGToMoz8fLoE6TC9Wx1P/u+LfeThMOAqmuyECnlBaaJb+u1m9hHiXUEtwW4OzfUJg== + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" @@ -8049,6 +8758,11 @@ prelude-ls@~1.1.2: resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz" integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha512-s/46sYeylUfHNjI+sA/78FAHlmIuKqI9wNnzEOGehAlUUYeObv5C2mOinXBjyUyWmJ2SfcS2/ydApH4hTF4WXQ== + prettier-linter-helpers@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz" @@ -8185,6 +8899,15 @@ quick-lru@^4.0.1: resolved "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== +randomatic@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" + integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw== + dependencies: + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" + randombytes@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz" @@ -8298,6 +9021,19 @@ read@^2.0.0: dependencies: mute-stream "~1.0.0" +readable-stream@^2.0.2, readable-stream@~2.3.6: + version "2.3.8" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz" + integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + readable-stream@^3.0.0, readable-stream@^3.0.2, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: version "3.6.2" resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz" @@ -8318,18 +9054,14 @@ readable-stream@^4.4.2: process "^0.11.10" string_decoder "^1.3.0" -readable-stream@~2.3.6: - version "2.3.8" - resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz" - integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== +readdirp@^2.0.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" + integrity sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ== dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" + graceful-fs "^4.1.11" + micromatch "^3.1.10" + readable-stream "^2.0.2" readdirp@~3.6.0: version "3.6.0" @@ -8346,11 +9078,31 @@ redent@^3.0.0: indent-string "^4.0.0" strip-indent "^3.0.0" +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + regenerator-runtime@^0.14.0: version "0.14.0" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== +regex-cache@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== + dependencies: + is-equal-shallow "^0.1.3" + +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + release-zalgo@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz" @@ -8358,6 +9110,21 @@ release-zalgo@^1.0.0: dependencies: es6-error "^4.0.1" +remove-trailing-separator@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw== + +repeat-element@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.4.tgz#be681520847ab58c7568ac75fbfad28ed42d39e9" + integrity sha512-LFiNfRcSu7KK3evMyYOuCzv3L10TW7yC1G2/+StMjK8Y6Vqd2MG7r/Qjw4ghtuCOjFvlnms/iMmLqpvW/ES/WQ== + +repeat-string@^1.5.2, repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w== + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" @@ -8395,6 +9162,11 @@ resolve-from@^4.0.0: resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha512-ZuF55hVUQaaczgOIwqWzkEcEidmlD/xl44x1UZnhOXcYuFN2S6+rcxpG+C1N3So0wvNI3DmJICUFfu2SxhBmvg== + resolve.exports@^2.0.0: version "2.0.2" resolved "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz" @@ -8407,6 +9179,15 @@ resolve@1.17.0: dependencies: path-parse "^1.0.6" +resolve@^1.1.7: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + resolve@^1.10.0, resolve@^1.20.0: version "1.22.2" resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz" @@ -8432,6 +9213,11 @@ restore-cursor@^4.0.0: onetime "^5.1.0" signal-exit "^3.0.2" +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== + retry@^0.12.0: version "0.12.0" resolved "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz" @@ -8524,6 +9310,13 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha512-aJXcif4xnaNUzvUuC5gcb46oTS7zvg4jpMTnuqtrEPlR3vFr4pxtdTwaF1Qs3Enjn9HK+ZlwQui+a7z0SywIzg== + dependencies: + ret "~0.1.10" + "safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" @@ -8594,6 +9387,16 @@ set-function-length@^1.1.1: gopd "^1.0.1" has-property-descriptors "^1.0.0" +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz" @@ -8631,6 +9434,11 @@ shebang-regex@^3.0.0: resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +shell-quote@^1.6.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.1.tgz#6dbf4db75515ad5bac63b4f1894c3a154c766680" + integrity sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA== + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz" @@ -8721,6 +9529,36 @@ smart-buffer@^4.2.0: resolved "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz" integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + socket.io-client@^4.7.2: version "4.7.2" resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-4.7.2.tgz#f2f13f68058bd4e40f94f2a1541f275157ff2c08" @@ -8800,6 +9638,17 @@ sort-keys@^2.0.0: dependencies: is-plain-obj "^1.0.0" +source-map-resolve@^0.5.0: + version "0.5.3" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" + integrity sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw== + dependencies: + atob "^2.1.2" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + source-map-support@0.5.13: version "0.5.13" resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz" @@ -8816,6 +9665,16 @@ source-map-support@^0.5.13: buffer-from "^1.0.0" source-map "^0.6.0" +source-map-url@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56" + integrity sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw== + +source-map@^0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== + source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" @@ -8859,6 +9718,13 @@ spdx-license-ids@^3.0.0: resolved "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz" integrity sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w== +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== + dependencies: + extend-shallow "^3.0.0" + split2@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" @@ -8911,6 +9777,14 @@ stacktrace-parser@^0.1.10: dependencies: type-fest "^0.7.1" +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha512-72E9+uLc27Mt718pMHt9VMNiAL4LMsmDbBva8mxWUCkT07fSzEGMYUCk0XWY6lp0j6RBAG4cJ3mWuZv2OE3s0g== + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + statuses@2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz" @@ -9048,6 +9922,13 @@ strong-log-transformer@2.1.0, strong-log-transformer@^2.1.0: minimist "^1.2.0" through "^2.3.4" +subarg@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" + integrity sha512-RIrIdRY0X1xojthNcVtgT9sjpOGagEUKpZdgBUi054OEPFo282yg+zE+t1Rj3+RqKq2xStL7uUHhY+AjbC4BXg== + dependencies: + minimist "^1.1.0" + superstruct@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.3.tgz#de626a5b49c6641ff4d37da3c7598e7a87697046" @@ -9176,6 +10057,21 @@ to-fast-properties@^2.0.0: resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz" integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha512-9mWHdnGRuh3onocaHzukyvCZhzvr6tiflAy/JRFXcJX0TjgfWA9pk9t8CMbzmBE4Jfw58pXbkngtBtqYxzNEyg== + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha512-ZZWNfCjUokXXDGXFpZehJIkZqq91BcULFq/Pi7M5i4JnxXdhMKAK682z8bCW3o8Hj1wuuzoKcW3DfVzaP6VuNg== + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range@^5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" @@ -9183,6 +10079,16 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + toidentifier@1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz" @@ -9410,6 +10316,16 @@ undici@^5.14.0: dependencies: "@fastify/busboy" "^2.0.0" +union-value@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^2.0.1" + unique-filename@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/unique-filename/-/unique-filename-3.0.0.tgz" @@ -9454,6 +10370,14 @@ unpipe@1.0.0: resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha512-PcA2tsuGSF9cnySLHTLSh2qrQiJ70mn+r+Glzxv2TWZblxsxCC52BDlZoPCsz7STd9pN7EZetkWZBAvk4cgZdQ== + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + upath@2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/upath/-/upath-2.0.1.tgz" @@ -9474,6 +10398,11 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha512-Am1ousAhSLBeB9cG/7k7r2R0zj50uDRlZHPGbazid5s9rlF1F/QKYObEKSIunSjIOkJZqwRRLpvewjEkM7pSqg== + url-parse@^1.5.3: version "1.5.10" resolved "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz" @@ -9482,6 +10411,11 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== + util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" @@ -10161,10 +11095,12 @@ yocto-queue@^0.1.0: resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== -zksync-web3@^0.14.3: - version "0.14.4" - resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.14.4.tgz#0b70a7e1a9d45cc57c0971736079185746d46b1f" - integrity sha512-kYehMD/S6Uhe1g434UnaMN+sBr9nQm23Ywn0EUP5BfQCsbjcr3ORuS68PosZw8xUTu3pac7G6YMSnNHk+fwzvg== +zksync-ethers@^5.0.0: + version "5.9.2" + resolved "https://registry.yarnpkg.com/zksync-ethers/-/zksync-ethers-5.9.2.tgz#1c5f34cb25ac0b040fd1a6118f2ba1c2c3bda090" + integrity sha512-Y2Mx6ovvxO6UdC2dePLguVzvNToOY8iLWeq5ne+jgGSJxAi/f4He/NF6FNsf6x1aWX0o8dy4Df8RcOQXAkj5qw== + dependencies: + ethers "~5.7.0" zod@^3.21.4: version "3.22.4" From cf7aece2397a6965bc52c892d862de366146dd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 13:15:52 +0200 Subject: [PATCH 02/55] Add passkeys files --- packages/testing-kit/bin/testing-kit.ts | 41 ++++++ .../{src => }/contracts/Deps_V1_0_0.sol | 0 .../{src => }/contracts/Deps_V1_1_1.sol | 0 .../{src => }/contracts/Deps_V1_2_0.sol | 0 .../{src => }/contracts/Deps_V1_3_0.sol | 0 .../{src => }/contracts/Deps_V1_4_1.sol | 0 .../{src => }/contracts/Deps_passkeys.sol | 0 .../contracts/safe_V1_0_0/GnosisSafe.sol | 0 .../contracts/safe_V1_0_0/Migrations.sol | 0 .../contracts/safe_V1_0_0/base/BaseSafe.sol | 0 .../contracts/safe_V1_0_0/base/Executor.sol | 0 .../contracts/safe_V1_0_0/base/Module.sol | 0 .../safe_V1_0_0/base/ModuleManager.sol | 0 .../safe_V1_0_0/base/OwnerManager.sol | 0 .../contracts/safe_V1_0_0/common/Enum.sol | 0 .../common/EtherPaymentFallback.sol | 0 .../safe_V1_0_0/common/MasterCopy.sol | 0 .../common/SecuredTokenTransfer.sol | 0 .../safe_V1_0_0/common/SelfAuthorized.sol | 0 .../safe_V1_0_0/common/SignatureDecoder.sol | 0 .../safe_V1_0_0/external/SafeMath.sol | 0 .../interfaces/ISignatureValidator.sol | 0 .../libraries/CreateAndAddModules.sol | 0 .../safe_V1_0_0/libraries/MultiSend.sol | 0 .../proxies/DelegateConstructorProxy.sol | 0 .../safe_V1_0_0/proxies/PayingProxy.sol | 0 .../contracts/safe_V1_0_0/proxies/Proxy.sol | 0 .../safe_V1_0_0/proxies/ProxyFactory.sol | 0 .../contracts/safe_V1_1_1/GnosisSafe.sol | 0 .../contracts/safe_V1_1_1/Migrations.sol | 0 .../contracts/safe_V1_1_1/base/Executor.sol | 0 .../safe_V1_1_1/base/FallbackManager.sol | 0 .../contracts/safe_V1_1_1/base/Module.sol | 0 .../safe_V1_1_1/base/ModuleManager.sol | 0 .../safe_V1_1_1/base/OwnerManager.sol | 0 .../contracts/safe_V1_1_1/common/Enum.sol | 0 .../common/EtherPaymentFallback.sol | 0 .../safe_V1_1_1/common/MasterCopy.sol | 0 .../common/SecuredTokenTransfer.sol | 0 .../safe_V1_1_1/common/SelfAuthorized.sol | 0 .../safe_V1_1_1/common/SignatureDecoder.sol | 0 .../safe_V1_1_1/external/SafeMath.sol | 0 .../handler/DefaultCallbackHandler.sol | 0 .../interfaces/ERC1155TokenReceiver.sol | 0 .../interfaces/ERC721TokenReceiver.sol | 0 .../interfaces/ERC777TokensRecipient.sol | 0 .../interfaces/ISignatureValidator.sol | 0 .../libraries/CreateAndAddModules.sol | 0 .../safe_V1_1_1/libraries/CreateCall.sol | 0 .../safe_V1_1_1/libraries/MultiSend.sol | 0 .../proxies/DelegateConstructorProxy.sol | 0 .../proxies/IProxyCreationCallback.sol | 0 .../safe_V1_1_1/proxies/PayingProxy.sol | 0 .../contracts/safe_V1_1_1/proxies/Proxy.sol | 0 .../safe_V1_1_1/proxies/ProxyFactory.sol | 0 .../contracts/safe_V1_2_0/GnosisSafe.sol | 0 .../contracts/safe_V1_2_0/Migrations.sol | 0 .../contracts/safe_V1_2_0/base/Executor.sol | 0 .../safe_V1_2_0/base/FallbackManager.sol | 0 .../contracts/safe_V1_2_0/base/Module.sol | 0 .../safe_V1_2_0/base/ModuleManager.sol | 0 .../safe_V1_2_0/base/OwnerManager.sol | 0 .../contracts/safe_V1_2_0/common/Enum.sol | 0 .../common/EtherPaymentFallback.sol | 0 .../safe_V1_2_0/common/MasterCopy.sol | 0 .../common/SecuredTokenTransfer.sol | 0 .../safe_V1_2_0/common/SelfAuthorized.sol | 0 .../safe_V1_2_0/common/SignatureDecoder.sol | 0 .../safe_V1_2_0/external/GnosisSafeMath.sol | 0 .../handler/DefaultCallbackHandler.sol | 0 .../interfaces/ERC1155TokenReceiver.sol | 0 .../interfaces/ERC721TokenReceiver.sol | 0 .../interfaces/ERC777TokensRecipient.sol | 0 .../interfaces/ISignatureValidator.sol | 0 .../libraries/CreateAndAddModules.sol | 0 .../safe_V1_2_0/libraries/CreateCall.sol | 0 .../safe_V1_2_0/libraries/MultiSend.sol | 0 .../safe_V1_2_0/modules/DailyLimitModule.sol | 0 .../modules/SocialRecoveryModule.sol | 0 .../modules/StateChannelModule.sol | 0 .../safe_V1_2_0/modules/WhitelistModule.sol | 0 .../proxies/DelegateConstructorProxy.sol | 0 .../safe_V1_2_0/proxies/GnosisSafeProxy.sol | 0 .../proxies/GnosisSafeProxyFactory.sol | 0 .../proxies/IProxyCreationCallback.sol | 0 .../safe_V1_2_0/proxies/PayingProxy.sol | 0 packages/testing-kit/hardhat.config.ts | 122 +++++++++++++++++- .../deploy/deploy-contracts.ts | 0 packages/testing-kit/package.json | 9 +- packages/testing-kit/src/config.ts | 118 ----------------- packages/testing-kit/src/index.ts | 1 - packages/testing-kit/tsconfig.build.json | 2 +- packages/testing-kit/tsconfig.json | 2 +- 93 files changed, 168 insertions(+), 127 deletions(-) create mode 100755 packages/testing-kit/bin/testing-kit.ts rename packages/testing-kit/{src => }/contracts/Deps_V1_0_0.sol (100%) rename packages/testing-kit/{src => }/contracts/Deps_V1_1_1.sol (100%) rename packages/testing-kit/{src => }/contracts/Deps_V1_2_0.sol (100%) rename packages/testing-kit/{src => }/contracts/Deps_V1_3_0.sol (100%) rename packages/testing-kit/{src => }/contracts/Deps_V1_4_1.sol (100%) rename packages/testing-kit/{src => }/contracts/Deps_passkeys.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/GnosisSafe.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/Migrations.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/base/BaseSafe.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/base/Executor.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/base/Module.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/base/ModuleManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/base/OwnerManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/Enum.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/MasterCopy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/SelfAuthorized.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/SignatureDecoder.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/external/SafeMath.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/libraries/MultiSend.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/proxies/PayingProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/proxies/Proxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/proxies/ProxyFactory.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/GnosisSafe.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/Migrations.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/base/Executor.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/base/FallbackManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/base/Module.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/base/ModuleManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/base/OwnerManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/Enum.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/MasterCopy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/SelfAuthorized.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/SignatureDecoder.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/external/SafeMath.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/libraries/CreateCall.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/libraries/MultiSend.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/proxies/PayingProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/proxies/Proxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/proxies/ProxyFactory.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/GnosisSafe.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/Migrations.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/base/Executor.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/base/FallbackManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/base/Module.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/base/ModuleManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/base/OwnerManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/Enum.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/MasterCopy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/SelfAuthorized.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/SignatureDecoder.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/external/GnosisSafeMath.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/libraries/CreateCall.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/libraries/MultiSend.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/modules/DailyLimitModule.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/modules/StateChannelModule.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/modules/WhitelistModule.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/proxies/PayingProxy.sol (100%) rename packages/testing-kit/{src => hardhat}/deploy/deploy-contracts.ts (100%) delete mode 100644 packages/testing-kit/src/config.ts delete mode 100644 packages/testing-kit/src/index.ts diff --git a/packages/testing-kit/bin/testing-kit.ts b/packages/testing-kit/bin/testing-kit.ts new file mode 100755 index 000000000..a8d4a1b4e --- /dev/null +++ b/packages/testing-kit/bin/testing-kit.ts @@ -0,0 +1,41 @@ +#!/usr/bin/env node + +import { execSync } from 'child_process' +import path from 'path' +import fs from 'fs' + +// Resolve the root directory of the package +const packageRoot = path.resolve(__dirname, '../../') + +// Capture the command and arguments +const args = process.argv.slice(2) +const command = args[0] + +if (!command) { + console.error('No command specified') + process.exit(1) +} + +const validCommands = ['compile', 'deploy'] + +if (!validCommands.includes(command)) { + console.error(`Invalid command: ${command}`) + process.exit(1) +} + +// Ensure the script always runs from the package root directory +process.chdir(packageRoot) + +const hardhatConfigPath = path.join(packageRoot, 'hardhat.config.ts') + +if (!fs.existsSync(hardhatConfigPath)) { + console.error('No Hardhat configuration file found in the target project') + process.exit(1) +} + +try { + execSync(`yarn ${command}`, { stdio: 'inherit' }) +} catch (error) { + console.error(`Failed to execute Hardhat command: ${(error as Error).message}`) + process.exit(1) +} diff --git a/packages/testing-kit/src/contracts/Deps_V1_0_0.sol b/packages/testing-kit/contracts/Deps_V1_0_0.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_V1_0_0.sol rename to packages/testing-kit/contracts/Deps_V1_0_0.sol diff --git a/packages/testing-kit/src/contracts/Deps_V1_1_1.sol b/packages/testing-kit/contracts/Deps_V1_1_1.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_V1_1_1.sol rename to packages/testing-kit/contracts/Deps_V1_1_1.sol diff --git a/packages/testing-kit/src/contracts/Deps_V1_2_0.sol b/packages/testing-kit/contracts/Deps_V1_2_0.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_V1_2_0.sol rename to packages/testing-kit/contracts/Deps_V1_2_0.sol diff --git a/packages/testing-kit/src/contracts/Deps_V1_3_0.sol b/packages/testing-kit/contracts/Deps_V1_3_0.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_V1_3_0.sol rename to packages/testing-kit/contracts/Deps_V1_3_0.sol diff --git a/packages/testing-kit/src/contracts/Deps_V1_4_1.sol b/packages/testing-kit/contracts/Deps_V1_4_1.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_V1_4_1.sol rename to packages/testing-kit/contracts/Deps_V1_4_1.sol diff --git a/packages/testing-kit/src/contracts/Deps_passkeys.sol b/packages/testing-kit/contracts/Deps_passkeys.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_passkeys.sol rename to packages/testing-kit/contracts/Deps_passkeys.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/GnosisSafe.sol b/packages/testing-kit/contracts/safe_V1_0_0/GnosisSafe.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/GnosisSafe.sol rename to packages/testing-kit/contracts/safe_V1_0_0/GnosisSafe.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/Migrations.sol b/packages/testing-kit/contracts/safe_V1_0_0/Migrations.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/Migrations.sol rename to packages/testing-kit/contracts/safe_V1_0_0/Migrations.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/BaseSafe.sol b/packages/testing-kit/contracts/safe_V1_0_0/base/BaseSafe.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/base/BaseSafe.sol rename to packages/testing-kit/contracts/safe_V1_0_0/base/BaseSafe.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/Executor.sol b/packages/testing-kit/contracts/safe_V1_0_0/base/Executor.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/base/Executor.sol rename to packages/testing-kit/contracts/safe_V1_0_0/base/Executor.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/Module.sol b/packages/testing-kit/contracts/safe_V1_0_0/base/Module.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/base/Module.sol rename to packages/testing-kit/contracts/safe_V1_0_0/base/Module.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/ModuleManager.sol b/packages/testing-kit/contracts/safe_V1_0_0/base/ModuleManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/base/ModuleManager.sol rename to packages/testing-kit/contracts/safe_V1_0_0/base/ModuleManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/OwnerManager.sol b/packages/testing-kit/contracts/safe_V1_0_0/base/OwnerManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/base/OwnerManager.sol rename to packages/testing-kit/contracts/safe_V1_0_0/base/OwnerManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/Enum.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/Enum.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/Enum.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/Enum.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/MasterCopy.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/MasterCopy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/MasterCopy.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/MasterCopy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/SelfAuthorized.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/SelfAuthorized.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/SelfAuthorized.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/SelfAuthorized.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/SignatureDecoder.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/SignatureDecoder.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/SignatureDecoder.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/SignatureDecoder.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/external/SafeMath.sol b/packages/testing-kit/contracts/safe_V1_0_0/external/SafeMath.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/external/SafeMath.sol rename to packages/testing-kit/contracts/safe_V1_0_0/external/SafeMath.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol b/packages/testing-kit/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol rename to packages/testing-kit/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol b/packages/testing-kit/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol rename to packages/testing-kit/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/MultiSend.sol b/packages/testing-kit/contracts/safe_V1_0_0/libraries/MultiSend.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/libraries/MultiSend.sol rename to packages/testing-kit/contracts/safe_V1_0_0/libraries/MultiSend.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol rename to packages/testing-kit/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/PayingProxy.sol b/packages/testing-kit/contracts/safe_V1_0_0/proxies/PayingProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/proxies/PayingProxy.sol rename to packages/testing-kit/contracts/safe_V1_0_0/proxies/PayingProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/Proxy.sol b/packages/testing-kit/contracts/safe_V1_0_0/proxies/Proxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/proxies/Proxy.sol rename to packages/testing-kit/contracts/safe_V1_0_0/proxies/Proxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/ProxyFactory.sol b/packages/testing-kit/contracts/safe_V1_0_0/proxies/ProxyFactory.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/proxies/ProxyFactory.sol rename to packages/testing-kit/contracts/safe_V1_0_0/proxies/ProxyFactory.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/GnosisSafe.sol b/packages/testing-kit/contracts/safe_V1_1_1/GnosisSafe.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/GnosisSafe.sol rename to packages/testing-kit/contracts/safe_V1_1_1/GnosisSafe.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/Migrations.sol b/packages/testing-kit/contracts/safe_V1_1_1/Migrations.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/Migrations.sol rename to packages/testing-kit/contracts/safe_V1_1_1/Migrations.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/Executor.sol b/packages/testing-kit/contracts/safe_V1_1_1/base/Executor.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/base/Executor.sol rename to packages/testing-kit/contracts/safe_V1_1_1/base/Executor.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/FallbackManager.sol b/packages/testing-kit/contracts/safe_V1_1_1/base/FallbackManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/base/FallbackManager.sol rename to packages/testing-kit/contracts/safe_V1_1_1/base/FallbackManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/Module.sol b/packages/testing-kit/contracts/safe_V1_1_1/base/Module.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/base/Module.sol rename to packages/testing-kit/contracts/safe_V1_1_1/base/Module.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/ModuleManager.sol b/packages/testing-kit/contracts/safe_V1_1_1/base/ModuleManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/base/ModuleManager.sol rename to packages/testing-kit/contracts/safe_V1_1_1/base/ModuleManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/OwnerManager.sol b/packages/testing-kit/contracts/safe_V1_1_1/base/OwnerManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/base/OwnerManager.sol rename to packages/testing-kit/contracts/safe_V1_1_1/base/OwnerManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/Enum.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/Enum.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/Enum.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/Enum.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/MasterCopy.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/MasterCopy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/MasterCopy.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/MasterCopy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/SelfAuthorized.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/SelfAuthorized.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/SelfAuthorized.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/SelfAuthorized.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/SignatureDecoder.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/SignatureDecoder.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/SignatureDecoder.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/SignatureDecoder.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/external/SafeMath.sol b/packages/testing-kit/contracts/safe_V1_1_1/external/SafeMath.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/external/SafeMath.sol rename to packages/testing-kit/contracts/safe_V1_1_1/external/SafeMath.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol b/packages/testing-kit/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol rename to packages/testing-kit/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol b/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol rename to packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol b/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol rename to packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol b/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol rename to packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol b/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol rename to packages/testing-kit/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol b/packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol rename to packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateCall.sol b/packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateCall.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateCall.sol rename to packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateCall.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/MultiSend.sol b/packages/testing-kit/contracts/safe_V1_1_1/libraries/MultiSend.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/libraries/MultiSend.sol rename to packages/testing-kit/contracts/safe_V1_1_1/libraries/MultiSend.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol rename to packages/testing-kit/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol b/packages/testing-kit/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol rename to packages/testing-kit/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/PayingProxy.sol b/packages/testing-kit/contracts/safe_V1_1_1/proxies/PayingProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/proxies/PayingProxy.sol rename to packages/testing-kit/contracts/safe_V1_1_1/proxies/PayingProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/Proxy.sol b/packages/testing-kit/contracts/safe_V1_1_1/proxies/Proxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/proxies/Proxy.sol rename to packages/testing-kit/contracts/safe_V1_1_1/proxies/Proxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/ProxyFactory.sol b/packages/testing-kit/contracts/safe_V1_1_1/proxies/ProxyFactory.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/proxies/ProxyFactory.sol rename to packages/testing-kit/contracts/safe_V1_1_1/proxies/ProxyFactory.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/GnosisSafe.sol b/packages/testing-kit/contracts/safe_V1_2_0/GnosisSafe.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/GnosisSafe.sol rename to packages/testing-kit/contracts/safe_V1_2_0/GnosisSafe.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/Migrations.sol b/packages/testing-kit/contracts/safe_V1_2_0/Migrations.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/Migrations.sol rename to packages/testing-kit/contracts/safe_V1_2_0/Migrations.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/Executor.sol b/packages/testing-kit/contracts/safe_V1_2_0/base/Executor.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/base/Executor.sol rename to packages/testing-kit/contracts/safe_V1_2_0/base/Executor.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/FallbackManager.sol b/packages/testing-kit/contracts/safe_V1_2_0/base/FallbackManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/base/FallbackManager.sol rename to packages/testing-kit/contracts/safe_V1_2_0/base/FallbackManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/Module.sol b/packages/testing-kit/contracts/safe_V1_2_0/base/Module.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/base/Module.sol rename to packages/testing-kit/contracts/safe_V1_2_0/base/Module.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/ModuleManager.sol b/packages/testing-kit/contracts/safe_V1_2_0/base/ModuleManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/base/ModuleManager.sol rename to packages/testing-kit/contracts/safe_V1_2_0/base/ModuleManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/OwnerManager.sol b/packages/testing-kit/contracts/safe_V1_2_0/base/OwnerManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/base/OwnerManager.sol rename to packages/testing-kit/contracts/safe_V1_2_0/base/OwnerManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/Enum.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/Enum.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/Enum.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/Enum.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/MasterCopy.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/MasterCopy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/MasterCopy.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/MasterCopy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/SelfAuthorized.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/SelfAuthorized.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/SelfAuthorized.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/SelfAuthorized.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/SignatureDecoder.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/SignatureDecoder.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/SignatureDecoder.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/SignatureDecoder.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/external/GnosisSafeMath.sol b/packages/testing-kit/contracts/safe_V1_2_0/external/GnosisSafeMath.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/external/GnosisSafeMath.sol rename to packages/testing-kit/contracts/safe_V1_2_0/external/GnosisSafeMath.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol b/packages/testing-kit/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol rename to packages/testing-kit/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol b/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol rename to packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol b/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol rename to packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol b/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol rename to packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol b/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol rename to packages/testing-kit/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol b/packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol rename to packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateCall.sol b/packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateCall.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateCall.sol rename to packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateCall.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/MultiSend.sol b/packages/testing-kit/contracts/safe_V1_2_0/libraries/MultiSend.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/libraries/MultiSend.sol rename to packages/testing-kit/contracts/safe_V1_2_0/libraries/MultiSend.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/DailyLimitModule.sol b/packages/testing-kit/contracts/safe_V1_2_0/modules/DailyLimitModule.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/modules/DailyLimitModule.sol rename to packages/testing-kit/contracts/safe_V1_2_0/modules/DailyLimitModule.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol b/packages/testing-kit/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol rename to packages/testing-kit/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/StateChannelModule.sol b/packages/testing-kit/contracts/safe_V1_2_0/modules/StateChannelModule.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/modules/StateChannelModule.sol rename to packages/testing-kit/contracts/safe_V1_2_0/modules/StateChannelModule.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/WhitelistModule.sol b/packages/testing-kit/contracts/safe_V1_2_0/modules/WhitelistModule.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/modules/WhitelistModule.sol rename to packages/testing-kit/contracts/safe_V1_2_0/modules/WhitelistModule.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol rename to packages/testing-kit/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol b/packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol rename to packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol b/packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol rename to packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol b/packages/testing-kit/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol rename to packages/testing-kit/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/PayingProxy.sol b/packages/testing-kit/contracts/safe_V1_2_0/proxies/PayingProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/proxies/PayingProxy.sol rename to packages/testing-kit/contracts/safe_V1_2_0/proxies/PayingProxy.sol diff --git a/packages/testing-kit/hardhat.config.ts b/packages/testing-kit/hardhat.config.ts index bcc13532f..10273de4d 100644 --- a/packages/testing-kit/hardhat.config.ts +++ b/packages/testing-kit/hardhat.config.ts @@ -1,12 +1,128 @@ import '@nomicfoundation/hardhat-viem' import 'hardhat-deploy' import 'tsconfig-paths/register' -import { HardhatUserConfig } from 'hardhat/types' +import dotenv from 'dotenv' +import { HardhatUserConfig, HttpNetworkUserConfig } from 'hardhat/types' +import yargs from 'yargs' -import { getHardHatConfig } from './src/config' +yargs + .option('network', { + type: 'string', + default: 'hardhat' + }) + .help(false) + .version(false).argv + +dotenv.config() +const { MNEMONIC, PK } = process.env +const DEFAULT_MNEMONIC = + 'myth like bonus scare over problem client lizard pioneer submit female collect' + +const sharedNetworkConfig: HttpNetworkUserConfig = {} +if (PK) { + sharedNetworkConfig.accounts = [PK] +} else { + sharedNetworkConfig.accounts = { + mnemonic: MNEMONIC || DEFAULT_MNEMONIC + } +} const config: HardhatUserConfig = { - ...getHardHatConfig() + defaultNetwork: 'hardhat', + solidity: { + compilers: [ + { version: '0.5.17' }, + { version: '0.5.3' }, + { version: '0.8.0' }, + { + version: '0.8.24', + settings: { + optimizer: { + enabled: true, + runs: 10_000_000 + }, + viaIR: false, + evmVersion: 'paris' + } + } + ], + overrides: { + '@gnosis.pm/safe-contracts-v1.3.0/contracts/handler/CompatibilityFallbackHandler.sol': { + version: '0.8.0' + } + } + }, + paths: { + artifacts: 'artifacts', + deploy: 'hardhat/deploy', + sources: 'contracts', + tests: 'tests/e2e' + }, + networks: { + localhost: { + url: 'http://127.0.0.1:8545' + }, + hardhat: { + allowUnlimitedContractSize: true, + blockGasLimit: 100000000, + gas: 100000000, + accounts: [ + { + balance: '100000000000000000000', + privateKey: '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d' + }, + { + balance: '100000000000000000000', + privateKey: '0x6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1' + }, + { + balance: '100000000000000000000', + privateKey: '0x6370fd033278c143179d81c5526140625662b8daa446c22ee2d73db3707e620c' + }, + { + balance: '100000000000000000000', + privateKey: '0x646f1ce2fdad0e6deeeb5c7e8e5543bdde65e86029e2fd9fc169899c440a7913' + }, + { + balance: '100000000000000000000', + privateKey: '0xadd53f9a7e588d003326d1cbf9e4a43c061aadd9bc938c843a79e7b4fd2ad743' + }, + { + balance: '100000000000000000000', + privateKey: '0x395df67f0c2d2d9fe1ad08d1bc8b6627011959b79c53d7dd6a3536a33ab8a4fd' + }, + { + balance: '100000000000000000000', + privateKey: '0xe485d098507f54e7733a205420dfddbe58db035fa577fc294ebd14db90767a52' + }, + { + balance: '100000000000000000000', + privateKey: '0xa453611d9419d0e56f499079478fd72c37b251a94bfde4d19872c44cf65386e3' + }, + { + balance: '100000000000000000000', + privateKey: '0x829e924fdf021ba3dbbc4225edfece9aca04b929d6e75613329ca6f1d31c0bb4' + }, + { + balance: '100000000000000000000', + privateKey: '0xb0057716d5917badaf911b193b12b910811c1497b5bada8d7711f758981c3773' + } + ] + }, + sepolia: { + ...sharedNetworkConfig, + url: 'https://sepolia.gateway.tenderly.co' + } + }, + //@ts-expect-error Type not found + compilerOptions: { + paths: { '^@safe-global/protocol-kit/(.*)$': ['../protocol-kit/src/*'] } + }, + namedAccounts: { + deployer: { + default: 0 + } + } } export default config diff --git a/packages/testing-kit/src/deploy/deploy-contracts.ts b/packages/testing-kit/hardhat/deploy/deploy-contracts.ts similarity index 100% rename from packages/testing-kit/src/deploy/deploy-contracts.ts rename to packages/testing-kit/hardhat/deploy/deploy-contracts.ts diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index bcd2a4ddc..c9de4fff7 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -2,8 +2,8 @@ "name": "@safe-global/testing-kit", "version": "1.0.0", "description": "Helper package providing testing utilities", - "main": "dist/src/index.js", - "types": "dist/src/index.d.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", "keywords": [ "Ethereum", "Wallet", @@ -16,7 +16,7 @@ "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", "unbuild": "rimraf dist artifacts deployments cache .nyc_output *.tsbuildinfo", - "build": "yarn unbuild && hardhat compile && NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && yarn copy-files", + "build": "yarn unbuild && hardhat compile && NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && yarn copy-files && chmod +x dist/bin/testing-kit.js", "copy-files": "cpx 'artifacts/**/*' dist/artifacts", "deploy": "hardhat deploy", "compile": "hardhat compile" @@ -44,5 +44,8 @@ "hardhat": "^2.19.3", "hardhat-deploy": "^0.12.4", "tsconfig-paths": "^4.2.0" + }, + "bin": { + "testing-kit": "./dist/bin/testing-kit.js" } } diff --git a/packages/testing-kit/src/config.ts b/packages/testing-kit/src/config.ts deleted file mode 100644 index a0a9539fe..000000000 --- a/packages/testing-kit/src/config.ts +++ /dev/null @@ -1,118 +0,0 @@ -import path from 'path' -import '@nomicfoundation/hardhat-viem' -import 'hardhat-deploy' -import 'tsconfig-paths/register' -import { HardhatUserConfig, HardhatNetworkAccountsUserConfig } from 'hardhat/types' - -type GetHardHatConfig = { - testsDir?: string - testAccounts?: HardhatNetworkAccountsUserConfig - hardhatAccounts?: HardhatNetworkAccountsUserConfig -} - -const HARDHAT_ACCOUNTS = [ - { - balance: '100000000000000000000', - privateKey: '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d' - }, - { - balance: '100000000000000000000', - privateKey: '0x6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1' - }, - { - balance: '100000000000000000000', - privateKey: '0x6370fd033278c143179d81c5526140625662b8daa446c22ee2d73db3707e620c' - }, - { - balance: '100000000000000000000', - privateKey: '0x646f1ce2fdad0e6deeeb5c7e8e5543bdde65e86029e2fd9fc169899c440a7913' - }, - { - balance: '100000000000000000000', - privateKey: '0xadd53f9a7e588d003326d1cbf9e4a43c061aadd9bc938c843a79e7b4fd2ad743' - }, - { - balance: '100000000000000000000', - privateKey: '0x395df67f0c2d2d9fe1ad08d1bc8b6627011959b79c53d7dd6a3536a33ab8a4fd' - }, - { - balance: '100000000000000000000', - privateKey: '0xe485d098507f54e7733a205420dfddbe58db035fa577fc294ebd14db90767a52' - }, - { - balance: '100000000000000000000', - privateKey: '0xa453611d9419d0e56f499079478fd72c37b251a94bfde4d19872c44cf65386e3' - }, - { - balance: '100000000000000000000', - privateKey: '0x829e924fdf021ba3dbbc4225edfece9aca04b929d6e75613329ca6f1d31c0bb4' - }, - { - balance: '100000000000000000000', - privateKey: '0xb0057716d5917badaf911b193b12b910811c1497b5bada8d7711f758981c3773' - } -] - -export function getHardHatConfig({ - testsDir, - testAccounts, - hardhatAccounts = HARDHAT_ACCOUNTS -}: GetHardHatConfig = {}): HardhatUserConfig { - console.log(__dirname) - return { - defaultNetwork: 'hardhat', - solidity: { - compilers: [ - { version: '0.5.17' }, - { version: '0.5.3' }, - { version: '0.8.0' }, - { - version: '0.8.24', - settings: { - optimizer: { - enabled: true, - runs: 10_000_000 - }, - viaIR: false, - evmVersion: 'paris' - } - } - ], - overrides: { - '@gnosis.pm/safe-contracts-v1.3.0/contracts/handler/CompatibilityFallbackHandler.sol': { - version: '0.8.0' - } - } - }, - paths: { - artifacts: path.resolve(__dirname, '../artifacts'), - deploy: path.resolve(__dirname, './deploy'), - sources: path.resolve(__dirname, './contracts'), - tests: testsDir - }, - networks: { - localhost: { - url: 'http://127.0.0.1:8545' - }, - hardhat: { - allowUnlimitedContractSize: true, - blockGasLimit: 100000000, - gas: 100000000, - accounts: hardhatAccounts - }, - sepolia: { - accounts: testAccounts, - url: 'https://sepolia.gateway.tenderly.co' - } - }, - //@ts-expect-error Type not found - compilerOptions: { - paths: { '^@safe-global/testing-kit/(.*)$': ['../testing-kit/src/*'] } - }, - namedAccounts: { - deployer: { - default: 0 - } - } - } -} diff --git a/packages/testing-kit/src/index.ts b/packages/testing-kit/src/index.ts deleted file mode 100644 index 1cf3ff561..000000000 --- a/packages/testing-kit/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { getHardHatConfig } from './config' diff --git a/packages/testing-kit/tsconfig.build.json b/packages/testing-kit/tsconfig.build.json index c05e497c4..67123d322 100644 --- a/packages/testing-kit/tsconfig.build.json +++ b/packages/testing-kit/tsconfig.build.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["src/**/*"] + "include": ["bin/**/*"] } diff --git a/packages/testing-kit/tsconfig.json b/packages/testing-kit/tsconfig.json index 59278cec0..a6c89343b 100644 --- a/packages/testing-kit/tsconfig.json +++ b/packages/testing-kit/tsconfig.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["src/**/*", "./hardhat.config.ts"] + "include": ["./hardhat.config.ts", "bin/**/*", "hardhat/**/*"] } From b3f756f0069ccab0f7dd7d21d83c318d9dd0c6df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 14:19:35 +0200 Subject: [PATCH 03/55] add testing-kit as dep --- packages/protocol-kit/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index b20435692..0f81454f2 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -71,7 +71,8 @@ "nyc": "^15.1.0", "tsconfig-paths": "^4.2.0", "web3": "^4.7.0", - "yargs": "^17.7.2" + "yargs": "^17.7.2", + "@safe-global/testing-kit": "^1.0.0" }, "dependencies": { "@noble/hashes": "^1.3.3", From 803bbc47f48c2c253cb45a9a5964f7030cebdb0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 14:34:53 +0200 Subject: [PATCH 04/55] Add test script to testing kit --- packages/testing-kit/bin/testing-kit.ts | 10 ++++++++-- packages/testing-kit/package.json | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/testing-kit/bin/testing-kit.ts b/packages/testing-kit/bin/testing-kit.ts index a8d4a1b4e..57a7b9445 100755 --- a/packages/testing-kit/bin/testing-kit.ts +++ b/packages/testing-kit/bin/testing-kit.ts @@ -6,17 +6,19 @@ import fs from 'fs' // Resolve the root directory of the package const packageRoot = path.resolve(__dirname, '../../') +const projectRoot = process.cwd() // Capture the command and arguments const args = process.argv.slice(2) const command = args[0] +const directory = args[1] if (!command) { console.error('No command specified') process.exit(1) } -const validCommands = ['compile', 'deploy'] +const validCommands = ['compile', 'deploy', 'test'] if (!validCommands.includes(command)) { console.error(`Invalid command: ${command}`) @@ -34,7 +36,11 @@ if (!fs.existsSync(hardhatConfigPath)) { } try { - execSync(`yarn ${command}`, { stdio: 'inherit' }) + if (command === 'test' && directory) { + execSync(`yarn ${command} ${path.join(projectRoot, directory)}`, { stdio: 'inherit' }) + } else { + execSync(`yarn ${command}`, { stdio: 'inherit' }) + } } catch (error) { console.error(`Failed to execute Hardhat command: ${(error as Error).message}`) process.exit(1) diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index c9de4fff7..a89aa5492 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -19,7 +19,8 @@ "build": "yarn unbuild && hardhat compile && NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && yarn copy-files && chmod +x dist/bin/testing-kit.js", "copy-files": "cpx 'artifacts/**/*' dist/artifacts", "deploy": "hardhat deploy", - "compile": "hardhat compile" + "compile": "hardhat compile", + "test": "hardhat test" }, "repository": { "type": "git", From 9156ecc1b28bc2dc862cd2337adb4b20b3c1152f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 15:03:23 +0200 Subject: [PATCH 05/55] Remove assets from protocol-kit --- .../protocol-kit/contracts/Deps_V1_0_0.sol | 8 - .../protocol-kit/contracts/Deps_V1_1_1.sol | 12 - .../protocol-kit/contracts/Deps_V1_2_0.sol | 15 - .../protocol-kit/contracts/Deps_V1_3_0.sol | 28 -- .../protocol-kit/contracts/Deps_V1_4_1.sol | 28 -- .../protocol-kit/contracts/Deps_passkeys.sol | 219 --------- .../contracts/safe_V1_0_0/GnosisSafe.sol | 354 --------------- .../contracts/safe_V1_0_0/Migrations.sol | 31 -- .../contracts/safe_V1_0_0/base/BaseSafe.sol | 24 - .../contracts/safe_V1_0_0/base/Executor.sol | 56 --- .../contracts/safe_V1_0_0/base/Module.sol | 26 -- .../safe_V1_0_0/base/ModuleManager.sol | 103 ----- .../safe_V1_0_0/base/OwnerManager.sol | 165 ------- .../contracts/safe_V1_0_0/common/Enum.sol | 12 - .../common/EtherPaymentFallback.sol | 15 - .../safe_V1_0_0/common/MasterCopy.sol | 22 - .../common/SecuredTokenTransfer.sol | 32 -- .../safe_V1_0_0/common/SelfAuthorized.sol | 11 - .../safe_V1_0_0/common/SignatureDecoder.sol | 54 --- .../safe_V1_0_0/external/SafeMath.sol | 66 --- .../interfaces/ISignatureValidator.sol | 21 - .../libraries/CreateAndAddModules.sol | 43 -- .../safe_V1_0_0/libraries/MultiSend.sol | 37 -- .../proxies/DelegateConstructorProxy.sol | 27 -- .../safe_V1_0_0/proxies/PayingProxy.sol | 29 -- .../contracts/safe_V1_0_0/proxies/Proxy.sol | 36 -- .../safe_V1_0_0/proxies/ProxyFactory.sol | 59 --- .../contracts/safe_V1_1_1/GnosisSafe.sol | 416 ----------------- .../contracts/safe_V1_1_1/Migrations.sol | 31 -- .../contracts/safe_V1_1_1/base/Executor.sol | 40 -- .../safe_V1_1_1/base/FallbackManager.sol | 57 --- .../contracts/safe_V1_1_1/base/Module.sol | 26 -- .../safe_V1_1_1/base/ModuleManager.sol | 145 ------ .../safe_V1_1_1/base/OwnerManager.sol | 165 ------- .../contracts/safe_V1_1_1/common/Enum.sol | 11 - .../common/EtherPaymentFallback.sol | 15 - .../safe_V1_1_1/common/MasterCopy.sol | 27 -- .../common/SecuredTokenTransfer.sol | 33 -- .../safe_V1_1_1/common/SelfAuthorized.sol | 11 - .../safe_V1_1_1/common/SignatureDecoder.sol | 54 --- .../safe_V1_1_1/external/SafeMath.sol | 66 --- .../handler/DefaultCallbackHandler.sol | 40 -- .../interfaces/ERC1155TokenReceiver.sol | 36 -- .../interfaces/ERC721TokenReceiver.sol | 18 - .../interfaces/ERC777TokensRecipient.sol | 12 - .../interfaces/ISignatureValidator.sol | 25 -- .../libraries/CreateAndAddModules.sol | 43 -- .../safe_V1_1_1/libraries/CreateCall.sol | 26 -- .../safe_V1_1_1/libraries/MultiSend.sol | 59 --- .../proxies/DelegateConstructorProxy.sol | 27 -- .../proxies/IProxyCreationCallback.sol | 6 - .../safe_V1_1_1/proxies/PayingProxy.sol | 29 -- .../contracts/safe_V1_1_1/proxies/Proxy.sol | 47 -- .../safe_V1_1_1/proxies/ProxyFactory.sol | 102 ----- .../contracts/safe_V1_2_0/GnosisSafe.sol | 421 ------------------ .../contracts/safe_V1_2_0/Migrations.sol | 31 -- .../contracts/safe_V1_2_0/base/Executor.sol | 40 -- .../safe_V1_2_0/base/FallbackManager.sol | 57 --- .../contracts/safe_V1_2_0/base/Module.sol | 26 -- .../safe_V1_2_0/base/ModuleManager.sol | 157 ------- .../safe_V1_2_0/base/OwnerManager.sol | 169 ------- .../contracts/safe_V1_2_0/common/Enum.sol | 11 - .../common/EtherPaymentFallback.sol | 15 - .../safe_V1_2_0/common/MasterCopy.sol | 27 -- .../common/SecuredTokenTransfer.sol | 33 -- .../safe_V1_2_0/common/SelfAuthorized.sol | 11 - .../safe_V1_2_0/common/SignatureDecoder.sol | 54 --- .../safe_V1_2_0/external/GnosisSafeMath.sol | 75 ---- .../handler/DefaultCallbackHandler.sol | 40 -- .../interfaces/ERC1155TokenReceiver.sol | 36 -- .../interfaces/ERC721TokenReceiver.sol | 18 - .../interfaces/ERC777TokensRecipient.sol | 12 - .../interfaces/ISignatureValidator.sol | 25 -- .../libraries/CreateAndAddModules.sol | 43 -- .../safe_V1_2_0/libraries/CreateCall.sol | 26 -- .../safe_V1_2_0/libraries/MultiSend.sol | 59 --- .../safe_V1_2_0/modules/DailyLimitModule.sol | 92 ---- .../modules/SocialRecoveryModule.sol | 105 ----- .../modules/StateChannelModule.sol | 89 ---- .../safe_V1_2_0/modules/WhitelistModule.sol | 66 --- .../proxies/DelegateConstructorProxy.sol | 27 -- .../safe_V1_2_0/proxies/GnosisSafeProxy.sol | 47 -- .../proxies/GnosisSafeProxyFactory.sol | 102 ----- .../proxies/IProxyCreationCallback.sol | 6 - .../safe_V1_2_0/proxies/PayingProxy.sol | 29 -- packages/protocol-kit/hardhat.config.ts | 128 ------ .../hardhat/deploy/deploy-contracts.ts | 248 ----------- packages/protocol-kit/package.json | 32 +- .../tests/e2e/contractManager.test.ts | 2 +- packages/protocol-kit/tests/e2e/core.test.ts | 2 +- .../createSafeDeploymentTransaction.test.ts | 2 +- .../tests/e2e/createTransaction.test.ts | 2 +- .../tests/e2e/createTransactionBatch.test.ts | 2 +- .../e2e/eip1271-contract-signatures.test.ts | 2 +- .../protocol-kit/tests/e2e/eip1271.test.ts | 2 +- .../protocol-kit/tests/e2e/erc-20.test.ts | 2 +- .../protocol-kit/tests/e2e/execution.test.ts | 2 +- .../tests/e2e/fallbackHandlerManager.test.ts | 2 +- .../tests/e2e/getEncodedTransaction.test.ts | 2 +- .../tests/e2e/guardManager.test.ts | 2 +- .../tests/e2e/moduleManager.test.ts | 2 +- .../tests/e2e/offChainSignatures.test.ts | 2 +- .../tests/e2e/onChainSignatures.test.ts | 2 +- .../tests/e2e/ownerManager.test.ts | 2 +- .../protocol-kit/tests/e2e/passkey.test.ts | 2 +- .../tests/e2e/safeFactory.test.ts | 2 +- .../tests/e2e/safeProvider.test.ts | 2 +- .../protocol-kit/tests/e2e/threshold.test.ts | 2 +- .../tests/e2e/utils/setupContracts.ts | 2 +- .../tests/e2e/utilsContracts.test.ts | 2 +- ...SafeTransactionIntoDeploymentBatch.test.ts | 2 +- packages/testing-kit/hardhat.config.ts | 8 +- packages/testing-kit/index.ts | 1 + 113 files changed, 44 insertions(+), 5468 deletions(-) delete mode 100644 packages/protocol-kit/contracts/Deps_V1_0_0.sol delete mode 100644 packages/protocol-kit/contracts/Deps_V1_1_1.sol delete mode 100644 packages/protocol-kit/contracts/Deps_V1_2_0.sol delete mode 100644 packages/protocol-kit/contracts/Deps_V1_3_0.sol delete mode 100644 packages/protocol-kit/contracts/Deps_V1_4_1.sol delete mode 100644 packages/protocol-kit/contracts/Deps_passkeys.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/GnosisSafe.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/Migrations.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/base/BaseSafe.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/base/Executor.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/base/Module.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/base/ModuleManager.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/base/OwnerManager.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/common/Enum.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/common/MasterCopy.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/common/SelfAuthorized.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/common/SignatureDecoder.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/external/SafeMath.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/libraries/MultiSend.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/proxies/PayingProxy.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/proxies/Proxy.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_0_0/proxies/ProxyFactory.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/GnosisSafe.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/Migrations.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/base/Executor.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/base/FallbackManager.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/base/Module.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/base/ModuleManager.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/base/OwnerManager.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/common/Enum.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/common/MasterCopy.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/common/SelfAuthorized.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/common/SignatureDecoder.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/external/SafeMath.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/libraries/CreateCall.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/libraries/MultiSend.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/proxies/PayingProxy.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/proxies/Proxy.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_1_1/proxies/ProxyFactory.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/GnosisSafe.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/Migrations.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/base/Executor.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/base/FallbackManager.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/base/Module.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/base/ModuleManager.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/base/OwnerManager.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/common/Enum.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/common/MasterCopy.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/common/SelfAuthorized.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/common/SignatureDecoder.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/external/GnosisSafeMath.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/libraries/CreateCall.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/libraries/MultiSend.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/modules/DailyLimitModule.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/modules/StateChannelModule.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/modules/WhitelistModule.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol delete mode 100644 packages/protocol-kit/contracts/safe_V1_2_0/proxies/PayingProxy.sol delete mode 100644 packages/protocol-kit/hardhat.config.ts delete mode 100644 packages/protocol-kit/hardhat/deploy/deploy-contracts.ts create mode 100644 packages/testing-kit/index.ts diff --git a/packages/protocol-kit/contracts/Deps_V1_0_0.sol b/packages/protocol-kit/contracts/Deps_V1_0_0.sol deleted file mode 100644 index 4ee34e7d3..000000000 --- a/packages/protocol-kit/contracts/Deps_V1_0_0.sol +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.5.0 <0.9.0; - -import { ProxyFactory } from "./safe_V1_0_0/proxies/ProxyFactory.sol"; -import { GnosisSafe } from "./safe_V1_0_0/GnosisSafe.sol"; - -contract SafeProxyFactory_SV1_0_0 is ProxyFactory {} -contract Safe_SV1_0_0 is GnosisSafe {} diff --git a/packages/protocol-kit/contracts/Deps_V1_1_1.sol b/packages/protocol-kit/contracts/Deps_V1_1_1.sol deleted file mode 100644 index 3a6cd8bc4..000000000 --- a/packages/protocol-kit/contracts/Deps_V1_1_1.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.5.0 <0.9.0; - -import { ProxyFactory } from "./safe_V1_1_1/proxies/ProxyFactory.sol"; -import { GnosisSafe } from "./safe_V1_1_1/GnosisSafe.sol"; -import { MultiSend } from "./safe_V1_1_1/libraries/MultiSend.sol"; -import { CreateCall } from "./safe_V1_1_1/libraries/CreateCall.sol"; - -contract SafeProxyFactory_SV1_1_1 is ProxyFactory {} -contract Safe_SV1_1_1 is GnosisSafe {} -contract MultiSend_SV1_1_1 is GnosisSafe {} -contract CreateCall_SV1_1_1 is GnosisSafe {} diff --git a/packages/protocol-kit/contracts/Deps_V1_2_0.sol b/packages/protocol-kit/contracts/Deps_V1_2_0.sol deleted file mode 100644 index 9b5c59e79..000000000 --- a/packages/protocol-kit/contracts/Deps_V1_2_0.sol +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.5.0 <0.9.0; - -import { GnosisSafeProxyFactory } from "./safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol"; -import { GnosisSafe } from "./safe_V1_2_0/GnosisSafe.sol"; -import { MultiSend } from "./safe_V1_2_0/libraries/MultiSend.sol"; - -// Testing contracts -import { DailyLimitModule } from "./safe_V1_2_0/modules/DailyLimitModule.sol"; -import { SocialRecoveryModule } from "./safe_V1_2_0/modules/SocialRecoveryModule.sol"; -import { ERC20Mintable } from "@openzeppelin/contracts/token/ERC20/ERC20Mintable.sol"; - -contract SafeProxyFactory_SV1_2_0 is GnosisSafeProxyFactory {} -contract Safe_SV1_2_0 is GnosisSafe {} -contract MultiSend_SV1_2_0 is MultiSend {} diff --git a/packages/protocol-kit/contracts/Deps_V1_3_0.sol b/packages/protocol-kit/contracts/Deps_V1_3_0.sol deleted file mode 100644 index 7dc0aca90..000000000 --- a/packages/protocol-kit/contracts/Deps_V1_3_0.sol +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.7.0 <=0.8.0; - -import { GnosisSafeProxyFactory } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/proxies/GnosisSafeProxyFactory.sol"; -import { GnosisSafe } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/GnosisSafe.sol"; -import { CompatibilityFallbackHandler } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/handler/CompatibilityFallbackHandler.sol"; -import { MultiSend } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/libraries/MultiSend.sol"; -import { MultiSendCallOnly } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/libraries/MultiSendCallOnly.sol"; -import { SignMessageLib } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/examples/libraries/SignMessage.sol"; -import { CreateCall } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/libraries/CreateCall.sol"; -import { DefaultCallbackHandler } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/handler/DefaultCallbackHandler.sol"; -import { SimulateTxAccessor } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/accessors/SimulateTxAccessor.sol"; - -// Testing contracts -import { DebugTransactionGuard } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/examples/guards/DebugTransactionGuard.sol"; - -contract SafeProxyFactory_SV1_3_0 is GnosisSafeProxyFactory {} -contract Safe_SV1_3_0 is GnosisSafe {} -contract CompatibilityFallbackHandler_SV1_3_0 is CompatibilityFallbackHandler {} -contract MultiSend_SV1_3_0 is MultiSend {} -contract MultiSendCallOnly_SV1_3_0 is MultiSendCallOnly {} -contract SignMessageLib_SV1_3_0 is SignMessageLib {} -contract CreateCall_SV1_3_0 is CreateCall {} -contract DefaultCallbackHandler_SV1_3_0 is DefaultCallbackHandler {} -contract SimulateTxAccessor_SV1_3_0 is SimulateTxAccessor {} - -// Testing contracts -contract DebugTransactionGuard_SV1_3_0 is DebugTransactionGuard {} diff --git a/packages/protocol-kit/contracts/Deps_V1_4_1.sol b/packages/protocol-kit/contracts/Deps_V1_4_1.sol deleted file mode 100644 index e2d5ac180..000000000 --- a/packages/protocol-kit/contracts/Deps_V1_4_1.sol +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.7.0 <0.9.0; - -import { SafeProxyFactory } from "@safe-global/safe-contracts-v1.4.1/contracts/proxies/SafeProxyFactory.sol"; -import { Safe } from "@safe-global/safe-contracts-v1.4.1/contracts/Safe.sol"; -import { CompatibilityFallbackHandler } from "@safe-global/safe-contracts-v1.4.1/contracts/handler/CompatibilityFallbackHandler.sol"; -import { MultiSend } from "@safe-global/safe-contracts-v1.4.1/contracts/libraries/MultiSend.sol"; -import { MultiSendCallOnly } from "@safe-global/safe-contracts-v1.4.1/contracts/libraries/MultiSendCallOnly.sol"; -import { SignMessageLib } from "@safe-global/safe-contracts-v1.4.1/contracts/libraries/SignMessageLib.sol"; -import { CreateCall } from "@safe-global/safe-contracts-v1.4.1/contracts/libraries/CreateCall.sol"; -import { TokenCallbackHandler } from "@safe-global/safe-contracts-v1.4.1/contracts/handler/TokenCallbackHandler.sol"; -import { SimulateTxAccessor } from "@safe-global/safe-contracts-v1.4.1/contracts/accessors/SimulateTxAccessor.sol"; - -// Testing contracts -import { DebugTransactionGuard} from "@safe-global/safe-contracts-v1.4.1/contracts/examples/guards/DebugTransactionGuard.sol"; - -contract SafeProxyFactory_SV1_4_1 is SafeProxyFactory {} -contract Safe_SV1_4_1 is Safe {} -contract CompatibilityFallbackHandler_SV1_4_1 is CompatibilityFallbackHandler {} -contract MultiSend_SV1_4_1 is MultiSend {} -contract MultiSendCallOnly_SV1_4_1 is MultiSendCallOnly {} -contract SignMessageLib_SV1_4_1 is SignMessageLib {} -contract CreateCall_SV1_4_1 is CreateCall {} -contract TokenCallbackHandler_SV1_4_1 is TokenCallbackHandler {} -contract SimulateTxAccessor_SV1_4_1 is SimulateTxAccessor {} - -// Testing contracts -contract DebugTransactionGuard_SV1_4_1 is DebugTransactionGuard {} diff --git a/packages/protocol-kit/contracts/Deps_passkeys.sol b/packages/protocol-kit/contracts/Deps_passkeys.sol deleted file mode 100644 index ad204f89c..000000000 --- a/packages/protocol-kit/contracts/Deps_passkeys.sol +++ /dev/null @@ -1,219 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity 0.8.24; - -import {SafeWebAuthnSignerFactory} from '@safe-global/safe-passkey/contracts/SafeWebAuthnSignerFactory.sol'; -import {FCLP256Verifier} from '@safe-global/safe-passkey/contracts/verifiers/FCLP256Verifier.sol'; -import {SignatureValidator} from '@safe-global/safe-passkey/contracts/base/SignatureValidator.sol'; -import {P256, WebAuthn} from '@safe-global/safe-passkey/contracts/libraries/WebAuthn.sol'; - -/** - * @title Safe Smart Account - * @dev Minimal interface of a Safe smart account. This only includes functions that are used by - * this project. - * @custom:security-contact bounty@safe.global - */ -interface ISafeTest { - /** - * @notice Sets an initial storage of the Safe contract. - * @dev This method can only be called once. If a proxy was created without setting up, anyone - * can call setup and claim the proxy. - * @param owners List of Safe owners. - * @param threshold Number of required confirmations for a Safe transaction. - * @param to Contract address for optional delegate call. - * @param data Data payload for optional delegate call. - * @param fallbackHandler Handler for fallback calls to this contract - * @param paymentToken Token that should be used for the payment (0 is ETH) - * @param payment Value that should be paid - * @param paymentReceiver Address that should receive the payment (or 0 if tx.origin) - */ - function setup( - address[] calldata owners, - uint256 threshold, - address to, - bytes calldata data, - address fallbackHandler, - address paymentToken, - uint256 payment, - address payable paymentReceiver - ) external; - - /** - * @notice Reads `length` bytes of storage in the currents contract - * @param offset - the offset in the current contract's storage in words to start reading from - * @param length - the number of words (32 bytes) of data to read - * @return the bytes that were read. - */ - function getStorageAt(uint256 offset, uint256 length) external view returns (bytes memory); -} - -contract SafeWebAuthnSignerFactory_SV1_4_1 is SafeWebAuthnSignerFactory {} - -contract WebAuthnContract is FCLP256Verifier {} - -// TODO: ADD SHARED SIGNER CONTRACT FROM @safe-global/safe-passkey - -/** - * @title Safe WebAuthn Shared Signer - * @dev A contract for verifying WebAuthn signatures shared by all Safe accounts. This contract uses - * storage from the Safe account itself for full ERC-4337 compatibility. - */ -contract SafeWebAuthnSharedSigner is SignatureValidator { - /** - * @notice Data associated with a WebAuthn signer. It represents the X and Y coordinates of the - * signer's public key as well as the P256 verifiers to use. This is stored in account storage - * starting at the storage slot {SIGNER_SLOT}. - */ - struct Signer { - uint256 x; - uint256 y; - P256.Verifiers verifiers; - } - - /** - * @notice The storage slot of the mapping from shared WebAuthn signer address to signer data. - * @custom:computed-as keccak256("SafeWebAuthnSharedSigner.signer") - 1 - * @dev This value is intentionally computed to be a hash -1 as a precaution to avoid any - * potential issues from unintended hash collisions, and have enough space for all the signer - * fields. Also, this is the slot of a `mapping(address self => Signer)` to ensure that multiple - * {SafeWebAuthnSharedSigner} instances can coexist with the same account. - */ - uint256 private constant _SIGNER_MAPPING_SLOT = - 0x2e0aed53485dc2290ceb5ce14725558ad3e3a09d38c69042410ad15c2b4ea4e8; - - /** - * @notice An error indicating a `CALL` to a function that should only be `DELEGATECALL`-ed. - */ - error NotDelegateCalled(); - - /** - * @notice Address of the shared signer contract itself. - * @dev This is used for determining whether or not the contract is being `DELEGATECALL`-ed when - * setting signer data. - */ - address private immutable _SELF; - - /** - * @notice The starting storage slot on the account containing the signer data. - */ - uint256 public immutable SIGNER_SLOT; - - /** - * @notice Create a new shared WebAuthn signer instance. - */ - constructor() { - _SELF = address(this); - SIGNER_SLOT = uint256(keccak256(abi.encode(address(this), _SIGNER_MAPPING_SLOT))); - } - - /** - * @notice Validates the call is done via `DELEGATECALL`. - */ - modifier onlyDelegateCall() { - if (address(this) == _SELF) { - revert NotDelegateCalled(); - } - _; - } - - /** - * @notice Return the signer configuration for the specified account. - * @dev The calling account must be a Safe, as the signer data is stored in the Safe's storage - * and must be read with the {StorageAccessible} support from the Safe. - * @param account The account to request signer data for. - */ - function getConfiguration(address account) public view returns (Signer memory signer) { - bytes memory getStorageAtData = abi.encodeCall( - ISafeTest(account).getStorageAt, - (SIGNER_SLOT, 3) - ); - - // Call the {StorageAccessible.getStorageAt} with assembly. This allows us to return a - // zeroed out signer configuration instead of reverting for `account`s that are not Safes. - // We also, expect the implementation to behave **exactly** like the Safe's - that is it - // should encode the return data using a standard ABI encoding: - // - The first 32 bytes is the offset of the values bytes array, always `0x20` - // - The second 32 bytes is the length of the values bytes array, always `0x60` - // - the following 3 words (96 bytes) are the values of the signer configuration. - - // solhint-disable-next-line no-inline-assembly - assembly ('memory-safe') { - // Note that Yul expressions are evaluated in reverse order, so the `staticcall` is the - // first thing to be evaluated in the nested `and` expression. - if and( - and( - // The offset of the ABI encoded bytes is 0x20, this should always be the case - // for standard ABI encoding of `(bytes)` tuple that `getStorageAt` returns. - eq(mload(0x00), 0x20), - // The length of the encoded bytes is exactly 0x60 bytes (i.e. 3 words, which is - // exactly how much we read from the Safe's storage in the `getStorageAt` call). - eq(mload(0x20), 0x60) - ), - and( - // The length of the return data should be exactly 0xa0 bytes, which should - // always be the case for the Safe's `getStorageAt` implementation. - eq(returndatasize(), 0xa0), - // The call succeeded. We write the first two words of the return data into the - // scratch space, as we need to inspect them before copying the signer - // signer configuration to our `signer` memory pointer. - staticcall( - gas(), - account, - add(getStorageAtData, 0x20), - mload(getStorageAtData), - 0x00, - 0x40 - ) - ) - ) { - // Copy only the storage values from the return data to our `signer` memory address. - // This only happens on success, so the `signer` value will be zeroed out if any of - // the above conditions fail, indicating that no signer is configured. - returndatacopy(signer, 0x40, 0x60) - } - } - } - - /** - * @notice Sets the signer configuration for the calling account. - * @dev The Safe must call this function with a `DELEGATECALL`, as the signer data is stored in - * the Safe account's storage. - * @param signer The new signer data to set for the calling account. - */ - function configure(Signer memory signer) external onlyDelegateCall { - uint256 signerSlot = SIGNER_SLOT; - Signer storage signerStorage; - - // solhint-disable-next-line no-inline-assembly - assembly ('memory-safe') { - signerStorage.slot := signerSlot - } - - signerStorage.x = signer.x; - signerStorage.y = signer.y; - signerStorage.verifiers = signer.verifiers; - } - - /** - * @inheritdoc SignatureValidator - */ - function _verifySignature( - bytes32 message, - bytes calldata signature - ) internal view virtual override returns (bool isValid) { - Signer memory signer = getConfiguration(msg.sender); - - // Make sure that the signer is configured in the first place. - if (P256.Verifiers.unwrap(signer.verifiers) == 0) { - return false; - } - - isValid = WebAuthn.verifySignature( - message, - signature, - WebAuthn.USER_VERIFICATION, - signer.x, - signer.y, - signer.verifiers - ); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/GnosisSafe.sol b/packages/protocol-kit/contracts/safe_V1_0_0/GnosisSafe.sol deleted file mode 100644 index 526050fc4..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/GnosisSafe.sol +++ /dev/null @@ -1,354 +0,0 @@ -pragma solidity ^0.5.0; -import "./base/BaseSafe.sol"; -import "./common/MasterCopy.sol"; -import "./common/SignatureDecoder.sol"; -import "./common/SecuredTokenTransfer.sol"; -import "./interfaces/ISignatureValidator.sol"; -import "./external/SafeMath.sol"; - -/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191. -/// @author Stefan George - -/// @author Richard Meissner - -/// @author Ricardo Guilherme Schmidt - (Status Research & Development GmbH) - Gas Token Payment -contract GnosisSafe is MasterCopy, BaseSafe, SignatureDecoder, SecuredTokenTransfer, ISignatureValidator { - - using SafeMath for uint256; - - string public constant NAME = "Gnosis Safe"; - string public constant VERSION = "1.0.0"; - - //keccak256( - // "EIP712Domain(address verifyingContract)" - //); - bytes32 public constant DOMAIN_SEPARATOR_TYPEHASH = 0x035aff83d86937d35b32e04f0ddc6ff469290eef2f1b692d8a815c89404d4749; - - //keccak256( - // "SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)" - //); - bytes32 public constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8; - - //keccak256( - // "SafeMessage(bytes message)" - //); - bytes32 public constant SAFE_MSG_TYPEHASH = 0x60b3cbf8b4a223d68d641b3b6ddf9a298e7f33710cf3d3a9d1146b5a6150fbca; - - event ExecutionFailed(bytes32 txHash); - - uint256 public nonce; - bytes32 public domainSeparator; - // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners - mapping(bytes32 => uint256) public signedMessages; - // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners - mapping(address => mapping(bytes32 => uint256)) public approvedHashes; - - /// @dev Setup function sets initial storage of contract. - /// @param _owners List of Safe owners. - /// @param _threshold Number of required confirmations for a Safe transaction. - /// @param to Contract address for optional delegate call. - /// @param data Data payload for optional delegate call. - /// @param paymentToken Token that should be used for the payment (0 is ETH) - /// @param payment Value that should be paid - /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin) - function setup(address[] calldata _owners, uint256 _threshold, address to, bytes calldata data, address paymentToken, uint256 payment, address payable paymentReceiver) - external - { - require(domainSeparator == 0, "Domain Separator already set!"); - domainSeparator = keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, this)); - setupSafe(_owners, _threshold, to, data); - - if (payment > 0) { - // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself) - // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment - handlePayment(payment, 0, 1, paymentToken, paymentReceiver); - } - } - - /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction. - /// Note: The fees are always transfered, even if the user transaction fails. - /// @param to Destination address of Safe transaction. - /// @param value Ether value of Safe transaction. - /// @param data Data payload of Safe transaction. - /// @param operation Operation type of Safe transaction. - /// @param safeTxGas Gas that should be used for the Safe transaction. - /// @param baseGas Gas costs for that are indipendent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund) - /// @param gasPrice Gas price that should be used for the payment calculation. - /// @param gasToken Token address (or 0 if ETH) that is used for the payment. - /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). - /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v}) - function execTransaction( - address to, - uint256 value, - bytes calldata data, - Enum.Operation operation, - uint256 safeTxGas, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address payable refundReceiver, - bytes calldata signatures - ) - external - returns (bool success) - { - bytes memory txHashData = encodeTransactionData( - to, value, data, operation, // Transaction info - safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, // Payment info - nonce - ); - // Increase nonce and execute transaction. - nonce++; - checkSignatures(keccak256(txHashData), txHashData, signatures, true); - require(gasleft() >= safeTxGas, "Not enough gas to execute safe transaction"); - uint256 gasUsed = gasleft(); - // If no safeTxGas has been set and the gasPrice is 0 we assume that all available gas can be used - success = execute(to, value, data, operation, safeTxGas == 0 && gasPrice == 0 ? gasleft() : safeTxGas); - gasUsed = gasUsed.sub(gasleft()); - if (!success) { - emit ExecutionFailed(keccak256(txHashData)); - } - - // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls - if (gasPrice > 0) { - handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver); - } - } - - function handlePayment( - uint256 gasUsed, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address payable refundReceiver - ) - private - { - uint256 amount = gasUsed.add(baseGas).mul(gasPrice); - // solium-disable-next-line security/no-tx-origin - address payable receiver = refundReceiver == address(0) ? tx.origin : refundReceiver; - if (gasToken == address(0)) { - // solium-disable-next-line security/no-send - require(receiver.send(amount), "Could not pay gas costs with ether"); - } else { - require(transferToken(gasToken, receiver, amount), "Could not pay gas costs with token"); - } - } - - /** - * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise. - * @param dataHash Hash of the data (could be either a message hash or transaction hash) - * @param data That should be signed (this is passed to an external validator contract) - * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash. - * @param consumeHash Indicates that in case of an approved hash the storage can be freed to save gas - */ - function checkSignatures(bytes32 dataHash, bytes memory data, bytes memory signatures, bool consumeHash) - internal - { - // Check that the provided signature data is not too short - require(signatures.length >= threshold.mul(65), "Signatures data too short"); - // There cannot be an owner with address 0. - address lastOwner = address(0); - address currentOwner; - uint8 v; - bytes32 r; - bytes32 s; - uint256 i; - for (i = 0; i < threshold; i++) { - (v, r, s) = signatureSplit(signatures, i); - // If v is 0 then it is a contract signature - if (v == 0) { - // When handling contract signatures the address of the contract is encoded into r - currentOwner = address(uint256(r)); - - // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes - // This check is not completely accurate, since it is possible that more signatures than the threshold are send. - // Here we only check that the pointer is not pointing inside the part that is being processed - require(uint256(s) >= threshold.mul(65), "Invalid contract signature location: inside static part"); - - // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes) - require(uint256(s).add(32) <= signatures.length, "Invalid contract signature location: length not present"); - - // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length - uint256 contractSignatureLen; - // solium-disable-next-line security/no-inline-assembly - assembly { - contractSignatureLen := mload(add(add(signatures, s), 0x20)) - } - require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, "Invalid contract signature location: data not complete"); - - // Check signature - bytes memory contractSignature; - // solium-disable-next-line security/no-inline-assembly - assembly { - // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s - contractSignature := add(add(signatures, s), 0x20) - } - require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, "Invalid contract signature provided"); - // If v is 1 then it is an approved hash - } else if (v == 1) { - // When handling approved hashes the address of the approver is encoded into r - currentOwner = address(uint256(r)); - // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction - require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, "Hash has not been approved"); - // Hash has been marked for consumption. If this hash was pre-approved free storage - if (consumeHash && msg.sender != currentOwner) { - approvedHashes[currentOwner][dataHash] = 0; - } - } else { - // Use ecrecover with the messageHash for EOA signatures - currentOwner = ecrecover(dataHash, v, r, s); - } - require (currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, "Invalid owner provided"); - lastOwner = currentOwner; - } - } - - /// @dev Allows to estimate a Safe transaction. - /// This method is only meant for estimation purpose, therfore two different protection mechanism against execution in a transaction have been made: - /// 1.) The method can only be called from the safe itself - /// 2.) The response is returned with a revert - /// When estimating set `from` to the address of the safe. - /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction` - /// @param to Destination address of Safe transaction. - /// @param value Ether value of Safe transaction. - /// @param data Data payload of Safe transaction. - /// @param operation Operation type of Safe transaction. - /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs). - function requiredTxGas(address to, uint256 value, bytes calldata data, Enum.Operation operation) - external - authorized - returns (uint256) - { - uint256 startGas = gasleft(); - // We don't provide an error message here, as we use it to return the estimate - // solium-disable-next-line error-reason - require(execute(to, value, data, operation, gasleft())); - uint256 requiredGas = startGas - gasleft(); - // Convert response to string and return via error message - revert(string(abi.encodePacked(requiredGas))); - } - - /** - * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature. - * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract. - */ - function approveHash(bytes32 hashToApprove) - external - { - require(owners[msg.sender] != address(0), "Only owners can approve a hash"); - approvedHashes[msg.sender][hashToApprove] = 1; - } - - /** - * @dev Marks a message as signed - * @param _data Arbitrary length data that should be marked as signed on the behalf of address(this) - */ - function signMessage(bytes calldata _data) - external - authorized - { - signedMessages[getMessageHash(_data)] = 1; - } - - /** - * @dev Should return whether the signature provided is valid for the provided data - * @param _data Arbitrary length data signed on the behalf of address(this) - * @param _signature Signature byte array associated with _data - * @return a bool upon valid or invalid signature with corresponding _data - */ - function isValidSignature(bytes calldata _data, bytes calldata _signature) - external - returns (bytes4) - { - bytes32 messageHash = getMessageHash(_data); - if (_signature.length == 0) { - require(signedMessages[messageHash] != 0, "Hash not approved"); - } else { - // consumeHash needs to be false, as the state should not be changed - checkSignatures(messageHash, _data, _signature, false); - } - return EIP1271_MAGIC_VALUE; - } - - /// @dev Returns hash of a message that can be signed by owners. - /// @param message Message that should be hashed - /// @return Message hash. - function getMessageHash( - bytes memory message - ) - public - view - returns (bytes32) - { - bytes32 safeMessageHash = keccak256( - abi.encode(SAFE_MSG_TYPEHASH, keccak256(message)) - ); - return keccak256( - abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeMessageHash) - ); - } - - /// @dev Returns the bytes that are hashed to be signed by owners. - /// @param to Destination address. - /// @param value Ether value. - /// @param data Data payload. - /// @param operation Operation type. - /// @param safeTxGas Fas that should be used for the safe transaction. - /// @param baseGas Gas costs for data used to trigger the safe transaction. - /// @param gasPrice Maximum gas price that should be used for this transaction. - /// @param gasToken Token address (or 0 if ETH) that is used for the payment. - /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). - /// @param _nonce Transaction nonce. - /// @return Transaction hash bytes. - function encodeTransactionData( - address to, - uint256 value, - bytes memory data, - Enum.Operation operation, - uint256 safeTxGas, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address refundReceiver, - uint256 _nonce - ) - public - view - returns (bytes memory) - { - bytes32 safeTxHash = keccak256( - abi.encode(SAFE_TX_TYPEHASH, to, value, keccak256(data), operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce) - ); - return abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeTxHash); - } - - /// @dev Returns hash to be signed by owners. - /// @param to Destination address. - /// @param value Ether value. - /// @param data Data payload. - /// @param operation Operation type. - /// @param safeTxGas Fas that should be used for the safe transaction. - /// @param baseGas Gas costs for data used to trigger the safe transaction. - /// @param gasPrice Maximum gas price that should be used for this transaction. - /// @param gasToken Token address (or 0 if ETH) that is used for the payment. - /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). - /// @param _nonce Transaction nonce. - /// @return Transaction hash. - function getTransactionHash( - address to, - uint256 value, - bytes memory data, - Enum.Operation operation, - uint256 safeTxGas, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address refundReceiver, - uint256 _nonce - ) - public - view - returns (bytes32) - { - return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce)); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/Migrations.sol b/packages/protocol-kit/contracts/safe_V1_0_0/Migrations.sol deleted file mode 100644 index 4e1701555..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/Migrations.sol +++ /dev/null @@ -1,31 +0,0 @@ -pragma solidity ^0.5.0; - -contract Migrations { - address public owner; - uint public last_completed_migration; - - modifier restricted() { - if (msg.sender == owner) _; - } - - constructor() - public - { - owner = msg.sender; - } - - function setCompleted(uint completed) - public - restricted - { - last_completed_migration = completed; - } - - function upgrade(address new_address) - public - restricted - { - Migrations upgraded = Migrations(new_address); - upgraded.setCompleted(last_completed_migration); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/base/BaseSafe.sol b/packages/protocol-kit/contracts/safe_V1_0_0/base/BaseSafe.sol deleted file mode 100644 index 9e35a6638..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/base/BaseSafe.sol +++ /dev/null @@ -1,24 +0,0 @@ -pragma solidity ^0.5.0; -import "./Module.sol"; -import "./ModuleManager.sol"; -import "./OwnerManager.sol"; - - -/// @title Base Safe - A multisignature wallet with support for modules and owners. This contract needs to be extented to add functionality to execute transactions. -/// @author Stefan George - -/// @author Richard Meissner - -contract BaseSafe is ModuleManager, OwnerManager { - - /// @dev Setup function sets initial storage of contract. - /// @param _owners List of Safe owners. - /// @param _threshold Number of required confirmations for a Safe transaction. - /// @param to Contract address for optional delegate call. - /// @param data Data payload for optional delegate call. - function setupSafe(address[] memory _owners, uint256 _threshold, address to, bytes memory data) - internal - { - setupOwners(_owners, _threshold); - // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules - setupModules(to, data); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/base/Executor.sol b/packages/protocol-kit/contracts/safe_V1_0_0/base/Executor.sol deleted file mode 100644 index 8b2d87269..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/base/Executor.sol +++ /dev/null @@ -1,56 +0,0 @@ -pragma solidity ^0.5.0; -import "../common/Enum.sol"; -import "../common/EtherPaymentFallback.sol"; - - -/// @title Executor - A contract that can execute transactions -/// @author Richard Meissner - -contract Executor is EtherPaymentFallback { - - event ContractCreation(address newContract); - - function execute(address to, uint256 value, bytes memory data, Enum.Operation operation, uint256 txGas) - internal - returns (bool success) - { - if (operation == Enum.Operation.Call) - success = executeCall(to, value, data, txGas); - else if (operation == Enum.Operation.DelegateCall) - success = executeDelegateCall(to, data, txGas); - else { - address newContract = executeCreate(data); - success = newContract != address(0); - emit ContractCreation(newContract); - } - } - - function executeCall(address to, uint256 value, bytes memory data, uint256 txGas) - internal - returns (bool success) - { - // solium-disable-next-line security/no-inline-assembly - assembly { - success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0) - } - } - - function executeDelegateCall(address to, bytes memory data, uint256 txGas) - internal - returns (bool success) - { - // solium-disable-next-line security/no-inline-assembly - assembly { - success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0) - } - } - - function executeCreate(bytes memory data) - internal - returns (address newContract) - { - // solium-disable-next-line security/no-inline-assembly - assembly { - newContract := create(0, add(data, 0x20), mload(data)) - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/base/Module.sol b/packages/protocol-kit/contracts/safe_V1_0_0/base/Module.sol deleted file mode 100644 index eb33929ca..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/base/Module.sol +++ /dev/null @@ -1,26 +0,0 @@ -pragma solidity ^0.5.0; -import "../common/MasterCopy.sol"; -import "./ModuleManager.sol"; - - -/// @title Module - Base class for modules. -/// @author Stefan George - -/// @author Richard Meissner - -contract Module is MasterCopy { - - ModuleManager public manager; - - modifier authorized() { - require(msg.sender == address(manager), "Method can only be called from manager"); - _; - } - - function setManager() - internal - { - // manager can only be 0 at initalization of contract. - // Check ensures that setup function can only be called once. - require(address(manager) == address(0), "Manager has already been set"); - manager = ModuleManager(msg.sender); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/base/ModuleManager.sol b/packages/protocol-kit/contracts/safe_V1_0_0/base/ModuleManager.sol deleted file mode 100644 index 0ae55ef23..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/base/ModuleManager.sol +++ /dev/null @@ -1,103 +0,0 @@ -pragma solidity ^0.5.0; -import "../common/Enum.sol"; -import "../common/SelfAuthorized.sol"; -import "./Executor.sol"; -import "./Module.sol"; - - -/// @title Module Manager - A contract that manages modules that can execute transactions via this contract -/// @author Stefan George - -/// @author Richard Meissner - -contract ModuleManager is SelfAuthorized, Executor { - - event EnabledModule(Module module); - event DisabledModule(Module module); - - address public constant SENTINEL_MODULES = address(0x1); - - mapping (address => address) internal modules; - - function setupModules(address to, bytes memory data) - internal - { - require(modules[SENTINEL_MODULES] == address(0), "Modules have already been initialized"); - modules[SENTINEL_MODULES] = SENTINEL_MODULES; - if (to != address(0)) - // Setup has to complete successfully or transaction fails. - require(executeDelegateCall(to, data, gasleft()), "Could not finish initialization"); - } - - /// @dev Allows to add a module to the whitelist. - /// This can only be done via a Safe transaction. - /// @param module Module to be whitelisted. - function enableModule(Module module) - public - authorized - { - // Module address cannot be null or sentinel. - require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); - // Module cannot be added twice. - require(modules[address(module)] == address(0), "Module has already been added"); - modules[address(module)] = modules[SENTINEL_MODULES]; - modules[SENTINEL_MODULES] = address(module); - emit EnabledModule(module); - } - - /// @dev Allows to remove a module from the whitelist. - /// This can only be done via a Safe transaction. - /// @param prevModule Module that pointed to the module to be removed in the linked list - /// @param module Module to be removed. - function disableModule(Module prevModule, Module module) - public - authorized - { - // Validate module address and check that it corresponds to module index. - require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); - require(modules[address(prevModule)] == address(module), "Invalid prevModule, module pair provided"); - modules[address(prevModule)] = modules[address(module)]; - modules[address(module)] = address(0); - emit DisabledModule(module); - } - - /// @dev Allows a Module to execute a Safe transaction without any further confirmations. - /// @param to Destination address of module transaction. - /// @param value Ether value of module transaction. - /// @param data Data payload of module transaction. - /// @param operation Operation type of module transaction. - function execTransactionFromModule(address to, uint256 value, bytes memory data, Enum.Operation operation) - public - returns (bool success) - { - // Only whitelisted modules are allowed. - require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), "Method can only be called from an enabled module"); - // Execute transaction without further confirmations. - success = execute(to, value, data, operation, gasleft()); - } - - /// @dev Returns array of modules. - /// @return Array of modules. - function getModules() - public - view - returns (address[] memory) - { - // Calculate module count - uint256 moduleCount = 0; - address currentModule = modules[SENTINEL_MODULES]; - while(currentModule != SENTINEL_MODULES) { - currentModule = modules[currentModule]; - moduleCount ++; - } - address[] memory array = new address[](moduleCount); - - // populate return array - moduleCount = 0; - currentModule = modules[SENTINEL_MODULES]; - while(currentModule != SENTINEL_MODULES) { - array[moduleCount] = currentModule; - currentModule = modules[currentModule]; - moduleCount ++; - } - return array; - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/base/OwnerManager.sol b/packages/protocol-kit/contracts/safe_V1_0_0/base/OwnerManager.sol deleted file mode 100644 index ba0f53008..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/base/OwnerManager.sol +++ /dev/null @@ -1,165 +0,0 @@ -pragma solidity ^0.5.0; -import "../common/SelfAuthorized.sol"; - -/// @title OwnerManager - Manages a set of owners and a threshold to perform actions. -/// @author Stefan George - -/// @author Richard Meissner - -contract OwnerManager is SelfAuthorized { - - event AddedOwner(address owner); - event RemovedOwner(address owner); - event ChangedThreshold(uint256 threshold); - - address public constant SENTINEL_OWNERS = address(0x1); - - mapping(address => address) internal owners; - uint256 ownerCount; - uint256 internal threshold; - - /// @dev Setup function sets initial storage of contract. - /// @param _owners List of Safe owners. - /// @param _threshold Number of required confirmations for a Safe transaction. - function setupOwners(address[] memory _owners, uint256 _threshold) - internal - { - // Threshold can only be 0 at initialization. - // Check ensures that setup function can only be called once. - require(threshold == 0, "Owners have already been setup"); - // Validate that threshold is smaller than number of added owners. - require(_threshold <= _owners.length, "Threshold cannot exceed owner count"); - // There has to be at least one Safe owner. - require(_threshold >= 1, "Threshold needs to be greater than 0"); - // Initializing Safe owners. - address currentOwner = SENTINEL_OWNERS; - for (uint256 i = 0; i < _owners.length; i++) { - // Owner address cannot be null. - address owner = _owners[i]; - require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); - // No duplicate owners allowed. - require(owners[owner] == address(0), "Duplicate owner address provided"); - owners[currentOwner] = owner; - currentOwner = owner; - } - owners[currentOwner] = SENTINEL_OWNERS; - ownerCount = _owners.length; - threshold = _threshold; - } - - /// @dev Allows to add a new owner to the Safe and update the threshold at the same time. - /// This can only be done via a Safe transaction. - /// @param owner New owner address. - /// @param _threshold New threshold. - function addOwnerWithThreshold(address owner, uint256 _threshold) - public - authorized - { - // Owner address cannot be null. - require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); - // No duplicate owners allowed. - require(owners[owner] == address(0), "Address is already an owner"); - owners[owner] = owners[SENTINEL_OWNERS]; - owners[SENTINEL_OWNERS] = owner; - ownerCount++; - emit AddedOwner(owner); - // Change threshold if threshold was changed. - if (threshold != _threshold) - changeThreshold(_threshold); - } - - /// @dev Allows to remove an owner from the Safe and update the threshold at the same time. - /// This can only be done via a Safe transaction. - /// @param prevOwner Owner that pointed to the owner to be removed in the linked list - /// @param owner Owner address to be removed. - /// @param _threshold New threshold. - function removeOwner(address prevOwner, address owner, uint256 _threshold) - public - authorized - { - // Only allow to remove an owner, if threshold can still be reached. - require(ownerCount - 1 >= _threshold, "New owner count needs to be larger than new threshold"); - // Validate owner address and check that it corresponds to owner index. - require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); - require(owners[prevOwner] == owner, "Invalid prevOwner, owner pair provided"); - owners[prevOwner] = owners[owner]; - owners[owner] = address(0); - ownerCount--; - emit RemovedOwner(owner); - // Change threshold if threshold was changed. - if (threshold != _threshold) - changeThreshold(_threshold); - } - - /// @dev Allows to swap/replace an owner from the Safe with another address. - /// This can only be done via a Safe transaction. - /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list - /// @param oldOwner Owner address to be replaced. - /// @param newOwner New owner address. - function swapOwner(address prevOwner, address oldOwner, address newOwner) - public - authorized - { - // Owner address cannot be null. - require(newOwner != address(0) && newOwner != SENTINEL_OWNERS, "Invalid owner address provided"); - // No duplicate owners allowed. - require(owners[newOwner] == address(0), "Address is already an owner"); - // Validate oldOwner address and check that it corresponds to owner index. - require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, "Invalid owner address provided"); - require(owners[prevOwner] == oldOwner, "Invalid prevOwner, owner pair provided"); - owners[newOwner] = owners[oldOwner]; - owners[prevOwner] = newOwner; - owners[oldOwner] = address(0); - emit RemovedOwner(oldOwner); - emit AddedOwner(newOwner); - } - - /// @dev Allows to update the number of required confirmations by Safe owners. - /// This can only be done via a Safe transaction. - /// @param _threshold New threshold. - function changeThreshold(uint256 _threshold) - public - authorized - { - // Validate that threshold is smaller than number of owners. - require(_threshold <= ownerCount, "Threshold cannot exceed owner count"); - // There has to be at least one Safe owner. - require(_threshold >= 1, "Threshold needs to be greater than 0"); - threshold = _threshold; - emit ChangedThreshold(threshold); - } - - function getThreshold() - public - view - returns (uint256) - { - return threshold; - } - - function isOwner(address owner) - public - view - returns (bool) - { - return owner != SENTINEL_OWNERS && owners[owner] != address(0); - } - - /// @dev Returns array of owners. - /// @return Array of Safe owners. - function getOwners() - public - view - returns (address[] memory) - { - address[] memory array = new address[](ownerCount); - - // populate return array - uint256 index = 0; - address currentOwner = owners[SENTINEL_OWNERS]; - while(currentOwner != SENTINEL_OWNERS) { - array[index] = currentOwner; - currentOwner = owners[currentOwner]; - index ++; - } - return array; - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/common/Enum.sol b/packages/protocol-kit/contracts/safe_V1_0_0/common/Enum.sol deleted file mode 100644 index 2df024acc..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/common/Enum.sol +++ /dev/null @@ -1,12 +0,0 @@ -pragma solidity ^0.5.0; - - -/// @title Enum - Collection of enums -/// @author Richard Meissner - -contract Enum { - enum Operation { - Call, - DelegateCall, - Create - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol b/packages/protocol-kit/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol deleted file mode 100644 index a4f8a1a2e..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol +++ /dev/null @@ -1,15 +0,0 @@ -pragma solidity ^0.5.0; - - -/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments -/// @author Richard Meissner - -contract EtherPaymentFallback { - - /// @dev Fallback function accepts Ether transactions. - function () - external - payable - { - - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/common/MasterCopy.sol b/packages/protocol-kit/contracts/safe_V1_0_0/common/MasterCopy.sol deleted file mode 100644 index a24f86954..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/common/MasterCopy.sol +++ /dev/null @@ -1,22 +0,0 @@ -pragma solidity ^0.5.0; -import "./SelfAuthorized.sol"; - - -/// @title MasterCopy - Base for master copy contracts (should always be first super contract) -/// @author Richard Meissner - -contract MasterCopy is SelfAuthorized { - // masterCopy always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract. - // It should also always be ensured that the address is stored alone (uses a full word) - address masterCopy; - - /// @dev Allows to upgrade the contract. This can only be done via a Safe transaction. - /// @param _masterCopy New contract address. - function changeMasterCopy(address _masterCopy) - public - authorized - { - // Master copy address cannot be null. - require(_masterCopy != address(0), "Invalid master copy address provided"); - masterCopy = _masterCopy; - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol b/packages/protocol-kit/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol deleted file mode 100644 index 546512406..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol +++ /dev/null @@ -1,32 +0,0 @@ -pragma solidity ^0.5.0; - - -/// @title SecuredTokenTransfer - Secure token transfer -/// @author Richard Meissner - -contract SecuredTokenTransfer { - - /// @dev Transfers a token and returns if it was a success - /// @param token Token that should be transferred - /// @param receiver Receiver to whom the token should be transferred - /// @param amount The amount of tokens that should be transferred - function transferToken ( - address token, - address receiver, - uint256 amount - ) - internal - returns (bool transferred) - { - bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", receiver, amount); - // solium-disable-next-line security/no-inline-assembly - assembly { - let success := call(sub(gas, 10000), token, 0, add(data, 0x20), mload(data), 0, 0) - let ptr := mload(0x40) - returndatacopy(ptr, 0, returndatasize) - switch returndatasize - case 0 { transferred := success } - case 0x20 { transferred := iszero(or(iszero(success), iszero(mload(ptr)))) } - default { transferred := 0 } - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/common/SelfAuthorized.sol b/packages/protocol-kit/contracts/safe_V1_0_0/common/SelfAuthorized.sol deleted file mode 100644 index d8da5ffbe..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/common/SelfAuthorized.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma solidity ^0.5.0; - - -/// @title SelfAuthorized - authorizes current contract to perform actions -/// @author Richard Meissner - -contract SelfAuthorized { - modifier authorized() { - require(msg.sender == address(this), "Method can only be called from this contract"); - _; - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/common/SignatureDecoder.sol b/packages/protocol-kit/contracts/safe_V1_0_0/common/SignatureDecoder.sol deleted file mode 100644 index ec966eee5..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/common/SignatureDecoder.sol +++ /dev/null @@ -1,54 +0,0 @@ -pragma solidity ^0.5.0; - - -/// @title SignatureDecoder - Decodes signatures that a encoded as bytes -/// @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) -/// @author Richard Meissner - -contract SignatureDecoder { - - /// @dev Recovers address who signed the message - /// @param messageHash operation ethereum signed message hash - /// @param messageSignature message `txHash` signature - /// @param pos which signature to read - function recoverKey ( - bytes32 messageHash, - bytes memory messageSignature, - uint256 pos - ) - internal - pure - returns (address) - { - uint8 v; - bytes32 r; - bytes32 s; - (v, r, s) = signatureSplit(messageSignature, pos); - return ecrecover(messageHash, v, r, s); - } - - /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`. - /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures - /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access - /// @param signatures concatenated rsv signatures - function signatureSplit(bytes memory signatures, uint256 pos) - internal - pure - returns (uint8 v, bytes32 r, bytes32 s) - { - // The signature format is a compact form of: - // {bytes32 r}{bytes32 s}{uint8 v} - // Compact means, uint8 is not padded to 32 bytes. - // solium-disable-next-line security/no-inline-assembly - assembly { - let signaturePos := mul(0x41, pos) - r := mload(add(signatures, add(signaturePos, 0x20))) - s := mload(add(signatures, add(signaturePos, 0x40))) - // Here we are loading the last 32 bytes, including 31 bytes - // of 's'. There is no 'mload8' to do this. - // - // 'byte' is not working due to the Solidity parser, so lets - // use the second best option, 'and' - v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff) - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/external/SafeMath.sol b/packages/protocol-kit/contracts/safe_V1_0_0/external/SafeMath.sol deleted file mode 100644 index 84f95a0d9..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/external/SafeMath.sol +++ /dev/null @@ -1,66 +0,0 @@ -pragma solidity ^0.5.0; - -/** - * @title SafeMath - * @dev Math operations with safety checks that revert on error - * TODO: remove once open zeppelin update to solc 0.5.0 - */ -library SafeMath { - - /** - * @dev Multiplies two numbers, reverts on overflow. - */ - function mul(uint256 a, uint256 b) internal pure returns (uint256) { - // Gas optimization: this is cheaper than requiring 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - if (a == 0) { - return 0; - } - - uint256 c = a * b; - require(c / a == b); - - return c; - } - - /** - * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. - */ - function div(uint256 a, uint256 b) internal pure returns (uint256) { - require(b > 0); // Solidity only automatically asserts when dividing by 0 - uint256 c = a / b; - // assert(a == b * c + a % b); // There is no case in which this doesn't hold - - return c; - } - - /** - * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). - */ - function sub(uint256 a, uint256 b) internal pure returns (uint256) { - require(b <= a); - uint256 c = a - b; - - return c; - } - - /** - * @dev Adds two numbers, reverts on overflow. - */ - function add(uint256 a, uint256 b) internal pure returns (uint256) { - uint256 c = a + b; - require(c >= a); - - return c; - } - - /** - * @dev Divides two numbers and returns the remainder (unsigned integer modulo), - * reverts when dividing by zero. - */ - function mod(uint256 a, uint256 b) internal pure returns (uint256) { - require(b != 0); - return a % b; - } -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol b/packages/protocol-kit/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol deleted file mode 100644 index e16e36927..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol +++ /dev/null @@ -1,21 +0,0 @@ -pragma solidity ^0.5.0; - -contract ISignatureValidator { - // bytes4(keccak256("isValidSignature(bytes,bytes)") - bytes4 constant internal EIP1271_MAGIC_VALUE = 0x20c13b0b; - - /** - * @dev Should return whether the signature provided is valid for the provided data - * @param _data Arbitrary length data signed on the behalf of address(this) - * @param _signature Signature byte array associated with _data - * - * MUST return the bytes4 magic value 0x20c13b0b when function passes. - * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5) - * MUST allow external calls - */ - function isValidSignature( - bytes calldata _data, - bytes calldata _signature) - external - returns (bytes4); -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol b/packages/protocol-kit/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol deleted file mode 100644 index e2022512b..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol +++ /dev/null @@ -1,43 +0,0 @@ -pragma solidity ^0.5.0; -import "../base/Module.sol"; - - -/// @title Create and Add Modules - Allows to create and add multiple module in one transaction. -/// @author Stefan George - -/// @author Richard Meissner - -contract CreateAndAddModules { - - /// @dev Function required to compile contract. Gnosis Safe function is called instead. - /// @param module Not used. - function enableModule(Module module) - public - { - revert(); - } - - /// @dev Allows to create and add multiple module in one transaction. - /// @param proxyFactory Module proxy factory contract. - /// @param data Modules constructor payload. This is the data for each proxy factory call concatinated. (e.g. ) - function createAndAddModules(address proxyFactory, bytes memory data) - public - { - uint256 length = data.length; - Module module; - uint256 i = 0; - while (i < length) { - // solium-disable-next-line security/no-inline-assembly - assembly { - let createBytesLength := mload(add(0x20, add(data, i))) - let createBytes := add(0x40, add(data, i)) - - let output := mload(0x40) - if eq(delegatecall(gas, proxyFactory, createBytes, createBytesLength, output, 0x20), 0) { revert(0, 0) } - module := and(mload(output), 0xffffffffffffffffffffffffffffffffffffffff) - - // Data is always padded to 32 bytes - i := add(i, add(0x20, mul(div(add(createBytesLength, 0x1f), 0x20), 0x20))) - } - this.enableModule(module); - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/libraries/MultiSend.sol b/packages/protocol-kit/contracts/safe_V1_0_0/libraries/MultiSend.sol deleted file mode 100644 index b561262fc..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/libraries/MultiSend.sol +++ /dev/null @@ -1,37 +0,0 @@ -pragma solidity ^0.5.0; - - -/// @title Multi Send - Allows to batch multiple transactions into one. -/// @author Nick Dodson - -/// @author Gonçalo Sá - -/// @author Stefan George - -contract MultiSend { - - /// @dev Sends multiple transactions and reverts all if one fails. - /// @param transactions Encoded transactions. Each transaction is encoded as a - /// tuple(operation,address,uint256,bytes), where operation - /// can be 0 for a call or 1 for a delegatecall. The bytes - /// of all encoded transactions are concatenated to form the input. - function multiSend(bytes memory transactions) - public - { - // solium-disable-next-line security/no-inline-assembly - assembly { - let length := mload(transactions) - let i := 0x20 - for { } lt(i, length) { } { - let operation := mload(add(transactions, i)) - let to := mload(add(transactions, add(i, 0x20))) - let value := mload(add(transactions, add(i, 0x40))) - let dataLength := mload(add(transactions, add(i, 0x80))) - let data := add(transactions, add(i, 0xa0)) - let success := 0 - switch operation - case 0 { success := call(gas, to, value, data, dataLength, 0, 0) } - case 1 { success := delegatecall(gas, to, data, dataLength, 0, 0) } - if eq(success, 0) { revert(0, 0) } - i := add(i, add(0xa0, mul(div(add(dataLength, 0x1f), 0x20), 0x20))) - } - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol b/packages/protocol-kit/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol deleted file mode 100644 index bf26631bf..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol +++ /dev/null @@ -1,27 +0,0 @@ -pragma solidity ^0.5.0; -import "./Proxy.sol"; - - -/// @title Delegate Constructor Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. -/// @author Stefan George - -/// @author Richard Meissner - -contract DelegateConstructorProxy is Proxy { - - /// @dev Constructor function sets address of master copy contract. - /// @param _masterCopy Master copy address. - /// @param initializer Data used for a delegate call to initialize the contract. - constructor(address _masterCopy, bytes memory initializer) Proxy(_masterCopy) - public - { - if (initializer.length > 0) { - // solium-disable-next-line security/no-inline-assembly - assembly { - let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) - let success := delegatecall(sub(gas, 10000), masterCopy, add(initializer, 0x20), mload(initializer), 0, 0) - let ptr := mload(0x40) - returndatacopy(ptr, 0, returndatasize) - if eq(success, 0) { revert(ptr, returndatasize) } - } - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/proxies/PayingProxy.sol b/packages/protocol-kit/contracts/safe_V1_0_0/proxies/PayingProxy.sol deleted file mode 100644 index d3f8f6ba1..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/proxies/PayingProxy.sol +++ /dev/null @@ -1,29 +0,0 @@ -pragma solidity ^0.5.0; -import "../common/SecuredTokenTransfer.sol"; -import "./DelegateConstructorProxy.sol"; - -/// @title Paying Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. And sends funds after creation to a specified account. -/// @author Stefan George - -/// @author Richard Meissner - -contract PayingProxy is DelegateConstructorProxy, SecuredTokenTransfer { - - /// @dev Constructor function sets address of master copy contract. - /// @param _masterCopy Master copy address. - /// @param initializer Data used for a delegate call to initialize the contract. - /// @param funder Address that should be paid for the execution of this call - /// @param paymentToken Token that should be used for the payment (0 is ETH) - /// @param payment Value that should be paid - constructor(address _masterCopy, bytes memory initializer, address payable funder, address paymentToken, uint256 payment) - DelegateConstructorProxy(_masterCopy, initializer) - public - { - if (payment > 0) { - if (paymentToken == address(0)) { - // solium-disable-next-line security/no-send - require(funder.send(payment), "Could not pay safe creation with ether"); - } else { - require(transferToken(paymentToken, funder, payment), "Could not pay safe creation with token"); - } - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/proxies/Proxy.sol b/packages/protocol-kit/contracts/safe_V1_0_0/proxies/Proxy.sol deleted file mode 100644 index e2c2a15d2..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/proxies/Proxy.sol +++ /dev/null @@ -1,36 +0,0 @@ -pragma solidity ^0.5.0; - - -/// @title Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. -/// @author Stefan George - -contract Proxy { - - // masterCopy always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. - // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` - address internal masterCopy; - - /// @dev Constructor function sets address of master copy contract. - /// @param _masterCopy Master copy address. - constructor(address _masterCopy) - public - { - require(_masterCopy != address(0), "Invalid master copy address provided"); - masterCopy = _masterCopy; - } - - /// @dev Fallback function forwards all transactions and returns all received return data. - function () - external - payable - { - // solium-disable-next-line security/no-inline-assembly - assembly { - let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) - calldatacopy(0, 0, calldatasize()) - let success := delegatecall(gas, masterCopy, 0, calldatasize(), 0, 0) - returndatacopy(0, 0, returndatasize()) - if eq(success, 0) { revert(0, returndatasize()) } - return(0, returndatasize()) - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_0_0/proxies/ProxyFactory.sol b/packages/protocol-kit/contracts/safe_V1_0_0/proxies/ProxyFactory.sol deleted file mode 100644 index 7431d7beb..000000000 --- a/packages/protocol-kit/contracts/safe_V1_0_0/proxies/ProxyFactory.sol +++ /dev/null @@ -1,59 +0,0 @@ -pragma solidity ^0.5.3; -import "./Proxy.sol"; - - -/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. -/// @author Stefan George - -contract ProxyFactory { - - event ProxyCreation(Proxy proxy); - - /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. - /// @param masterCopy Address of master copy. - /// @param data Payload for message call sent to new proxy contract. - function createProxy(address masterCopy, bytes memory data) - public - returns (Proxy proxy) - { - proxy = new Proxy(masterCopy); - if (data.length > 0) - // solium-disable-next-line security/no-inline-assembly - assembly { - if eq(call(gas, proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } - } - emit ProxyCreation(proxy); - } - - /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. - function proxyRuntimeCode() public pure returns (bytes memory) { - return type(Proxy).runtimeCode; - } - - /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. - function proxyCreationCode() public pure returns (bytes memory) { - return type(Proxy).creationCode; - } - - /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. - /// @param _mastercopy Address of master copy. - /// @param initializer Payload for message call sent to new proxy contract. - /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. - function createProxyWithNonce(address _mastercopy, bytes memory initializer, uint256 saltNonce) - public - returns (Proxy proxy) - { - // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it - bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); - bytes memory deploymentData = abi.encodePacked(type(Proxy).creationCode, uint256(_mastercopy)); - // solium-disable-next-line security/no-inline-assembly - assembly { - proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) - } - if (initializer.length > 0) - // solium-disable-next-line security/no-inline-assembly - assembly { - if eq(call(gas, proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0,0) } - } - emit ProxyCreation(proxy); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/GnosisSafe.sol b/packages/protocol-kit/contracts/safe_V1_1_1/GnosisSafe.sol deleted file mode 100644 index ae72291c3..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/GnosisSafe.sol +++ /dev/null @@ -1,416 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "./base/ModuleManager.sol"; -import "./base/OwnerManager.sol"; -import "./base/FallbackManager.sol"; -import "./common/MasterCopy.sol"; -import "./common/SignatureDecoder.sol"; -import "./common/SecuredTokenTransfer.sol"; -import "./interfaces/ISignatureValidator.sol"; -import "./external/SafeMath.sol"; - -/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191. -/// @author Stefan George - -/// @author Richard Meissner - -/// @author Ricardo Guilherme Schmidt - (Status Research & Development GmbH) - Gas Token Payment -contract GnosisSafe - is MasterCopy, ModuleManager, OwnerManager, SignatureDecoder, SecuredTokenTransfer, ISignatureValidatorConstants, FallbackManager { - - using SafeMath for uint256; - - string public constant NAME = "Gnosis Safe"; - string public constant VERSION = "1.1.1"; - - //keccak256( - // "EIP712Domain(address verifyingContract)" - //); - bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x035aff83d86937d35b32e04f0ddc6ff469290eef2f1b692d8a815c89404d4749; - - //keccak256( - // "SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)" - //); - bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8; - - //keccak256( - // "SafeMessage(bytes message)" - //); - bytes32 private constant SAFE_MSG_TYPEHASH = 0x60b3cbf8b4a223d68d641b3b6ddf9a298e7f33710cf3d3a9d1146b5a6150fbca; - - event ApproveHash( - bytes32 indexed approvedHash, - address indexed owner - ); - event SignMsg( - bytes32 indexed msgHash - ); - event ExecutionFailure( - bytes32 txHash, uint256 payment - ); - event ExecutionSuccess( - bytes32 txHash, uint256 payment - ); - - uint256 public nonce; - bytes32 public domainSeparator; - // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners - mapping(bytes32 => uint256) public signedMessages; - // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners - mapping(address => mapping(bytes32 => uint256)) public approvedHashes; - - // This constructor ensures that this contract can only be used as a master copy for Proxy contracts - constructor() public { - // By setting the threshold it is not possible to call setup anymore, - // so we create a Safe with 0 owners and threshold 1. - // This is an unusable Safe, perfect for the mastercopy - threshold = 1; - } - - /// @dev Setup function sets initial storage of contract. - /// @param _owners List of Safe owners. - /// @param _threshold Number of required confirmations for a Safe transaction. - /// @param to Contract address for optional delegate call. - /// @param data Data payload for optional delegate call. - /// @param fallbackHandler Handler for fallback calls to this contract - /// @param paymentToken Token that should be used for the payment (0 is ETH) - /// @param payment Value that should be paid - /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin) - function setup( - address[] calldata _owners, - uint256 _threshold, - address to, - bytes calldata data, - address fallbackHandler, - address paymentToken, - uint256 payment, - address payable paymentReceiver - ) - external - { - require(domainSeparator == 0, "Domain Separator already set!"); - domainSeparator = keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, this)); - setupOwners(_owners, _threshold); - if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler); - // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules - setupModules(to, data); - - if (payment > 0) { - // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself) - // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment - handlePayment(payment, 0, 1, paymentToken, paymentReceiver); - } - } - - /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction. - /// Note: The fees are always transfered, even if the user transaction fails. - /// @param to Destination address of Safe transaction. - /// @param value Ether value of Safe transaction. - /// @param data Data payload of Safe transaction. - /// @param operation Operation type of Safe transaction. - /// @param safeTxGas Gas that should be used for the Safe transaction. - /// @param baseGas Gas costs for that are indipendent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund) - /// @param gasPrice Gas price that should be used for the payment calculation. - /// @param gasToken Token address (or 0 if ETH) that is used for the payment. - /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). - /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v}) - function execTransaction( - address to, - uint256 value, - bytes calldata data, - Enum.Operation operation, - uint256 safeTxGas, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address payable refundReceiver, - bytes calldata signatures - ) - external - returns (bool success) - { - bytes32 txHash; - // Use scope here to limit variable lifetime and prevent `stack too deep` errors - { - bytes memory txHashData = encodeTransactionData( - to, value, data, operation, // Transaction info - safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, // Payment info - nonce - ); - // Increase nonce and execute transaction. - nonce++; - txHash = keccak256(txHashData); - checkSignatures(txHash, txHashData, signatures, true); - } - require(gasleft() >= safeTxGas, "Not enough gas to execute safe transaction"); - // Use scope here to limit variable lifetime and prevent `stack too deep` errors - { - uint256 gasUsed = gasleft(); - // If no safeTxGas has been set and the gasPrice is 0 we assume that all available gas can be used - success = execute(to, value, data, operation, safeTxGas == 0 && gasPrice == 0 ? gasleft() : safeTxGas); - gasUsed = gasUsed.sub(gasleft()); - // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls - uint256 payment = 0; - if (gasPrice > 0) { - payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver); - } - if (success) emit ExecutionSuccess(txHash, payment); - else emit ExecutionFailure(txHash, payment); - } - } - - function handlePayment( - uint256 gasUsed, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address payable refundReceiver - ) - private - returns (uint256 payment) - { - // solium-disable-next-line security/no-tx-origin - address payable receiver = refundReceiver == address(0) ? tx.origin : refundReceiver; - if (gasToken == address(0)) { - // For ETH we will only adjust the gas price to not be higher than the actual used gas price - payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice); - // solium-disable-next-line security/no-send - require(receiver.send(payment), "Could not pay gas costs with ether"); - } else { - payment = gasUsed.add(baseGas).mul(gasPrice); - require(transferToken(gasToken, receiver, payment), "Could not pay gas costs with token"); - } - } - - /** - * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise. - * @param dataHash Hash of the data (could be either a message hash or transaction hash) - * @param data That should be signed (this is passed to an external validator contract) - * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash. - * @param consumeHash Indicates that in case of an approved hash the storage can be freed to save gas - */ - function checkSignatures(bytes32 dataHash, bytes memory data, bytes memory signatures, bool consumeHash) - internal - { - // Load threshold to avoid multiple storage loads - uint256 _threshold = threshold; - // Check that a threshold is set - require(_threshold > 0, "Threshold needs to be defined!"); - // Check that the provided signature data is not too short - require(signatures.length >= _threshold.mul(65), "Signatures data too short"); - // There cannot be an owner with address 0. - address lastOwner = address(0); - address currentOwner; - uint8 v; - bytes32 r; - bytes32 s; - uint256 i; - for (i = 0; i < _threshold; i++) { - (v, r, s) = signatureSplit(signatures, i); - // If v is 0 then it is a contract signature - if (v == 0) { - // When handling contract signatures the address of the contract is encoded into r - currentOwner = address(uint256(r)); - - // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes - // This check is not completely accurate, since it is possible that more signatures than the threshold are send. - // Here we only check that the pointer is not pointing inside the part that is being processed - require(uint256(s) >= _threshold.mul(65), "Invalid contract signature location: inside static part"); - - // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes) - require(uint256(s).add(32) <= signatures.length, "Invalid contract signature location: length not present"); - - // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length - uint256 contractSignatureLen; - // solium-disable-next-line security/no-inline-assembly - assembly { - contractSignatureLen := mload(add(add(signatures, s), 0x20)) - } - require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, "Invalid contract signature location: data not complete"); - - // Check signature - bytes memory contractSignature; - // solium-disable-next-line security/no-inline-assembly - assembly { - // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s - contractSignature := add(add(signatures, s), 0x20) - } - require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, "Invalid contract signature provided"); - // If v is 1 then it is an approved hash - } else if (v == 1) { - // When handling approved hashes the address of the approver is encoded into r - currentOwner = address(uint256(r)); - // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction - require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, "Hash has not been approved"); - // Hash has been marked for consumption. If this hash was pre-approved free storage - if (consumeHash && msg.sender != currentOwner) { - approvedHashes[currentOwner][dataHash] = 0; - } - } else if (v > 30) { - // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover - currentOwner = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", dataHash)), v - 4, r, s); - } else { - // Use ecrecover with the messageHash for EOA signatures - currentOwner = ecrecover(dataHash, v, r, s); - } - require ( - currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, - "Invalid owner provided" - ); - lastOwner = currentOwner; - } - } - - /// @dev Allows to estimate a Safe transaction. - /// This method is only meant for estimation purpose, therefore two different protection mechanism against execution in a transaction have been made: - /// 1.) The method can only be called from the safe itself - /// 2.) The response is returned with a revert - /// When estimating set `from` to the address of the safe. - /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction` - /// @param to Destination address of Safe transaction. - /// @param value Ether value of Safe transaction. - /// @param data Data payload of Safe transaction. - /// @param operation Operation type of Safe transaction. - /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs). - function requiredTxGas(address to, uint256 value, bytes calldata data, Enum.Operation operation) - external - authorized - returns (uint256) - { - uint256 startGas = gasleft(); - // We don't provide an error message here, as we use it to return the estimate - // solium-disable-next-line error-reason - require(execute(to, value, data, operation, gasleft())); - uint256 requiredGas = startGas - gasleft(); - // Convert response to string and return via error message - revert(string(abi.encodePacked(requiredGas))); - } - - /** - * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature. - * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract. - */ - function approveHash(bytes32 hashToApprove) - external - { - require(owners[msg.sender] != address(0), "Only owners can approve a hash"); - approvedHashes[msg.sender][hashToApprove] = 1; - emit ApproveHash(hashToApprove, msg.sender); - } - - /** - * @dev Marks a message as signed - * @param _data Arbitrary length data that should be marked as signed on the behalf of address(this) - */ - function signMessage(bytes calldata _data) - external - authorized - { - bytes32 msgHash = getMessageHash(_data); - signedMessages[msgHash] = 1; - emit SignMsg(msgHash); - } - - /** - * Implementation of ISignatureValidator (see `interfaces/ISignatureValidator.sol`) - * @dev Should return whether the signature provided is valid for the provided data. - * The save does not implement the interface since `checkSignatures` is not a view method. - * The method will not perform any state changes (see parameters of `checkSignatures`) - * @param _data Arbitrary length data signed on the behalf of address(this) - * @param _signature Signature byte array associated with _data - * @return a bool upon valid or invalid signature with corresponding _data - */ - function isValidSignature(bytes calldata _data, bytes calldata _signature) - external - returns (bytes4) - { - bytes32 messageHash = getMessageHash(_data); - if (_signature.length == 0) { - require(signedMessages[messageHash] != 0, "Hash not approved"); - } else { - // consumeHash needs to be false, as the state should not be changed - checkSignatures(messageHash, _data, _signature, false); - } - return EIP1271_MAGIC_VALUE; - } - - /// @dev Returns hash of a message that can be signed by owners. - /// @param message Message that should be hashed - /// @return Message hash. - function getMessageHash( - bytes memory message - ) - public - view - returns (bytes32) - { - bytes32 safeMessageHash = keccak256( - abi.encode(SAFE_MSG_TYPEHASH, keccak256(message)) - ); - return keccak256( - abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeMessageHash) - ); - } - - /// @dev Returns the bytes that are hashed to be signed by owners. - /// @param to Destination address. - /// @param value Ether value. - /// @param data Data payload. - /// @param operation Operation type. - /// @param safeTxGas Fas that should be used for the safe transaction. - /// @param baseGas Gas costs for data used to trigger the safe transaction. - /// @param gasPrice Maximum gas price that should be used for this transaction. - /// @param gasToken Token address (or 0 if ETH) that is used for the payment. - /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). - /// @param _nonce Transaction nonce. - /// @return Transaction hash bytes. - function encodeTransactionData( - address to, - uint256 value, - bytes memory data, - Enum.Operation operation, - uint256 safeTxGas, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address refundReceiver, - uint256 _nonce - ) - public - view - returns (bytes memory) - { - bytes32 safeTxHash = keccak256( - abi.encode(SAFE_TX_TYPEHASH, to, value, keccak256(data), operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce) - ); - return abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeTxHash); - } - - /// @dev Returns hash to be signed by owners. - /// @param to Destination address. - /// @param value Ether value. - /// @param data Data payload. - /// @param operation Operation type. - /// @param safeTxGas Fas that should be used for the safe transaction. - /// @param baseGas Gas costs for data used to trigger the safe transaction. - /// @param gasPrice Maximum gas price that should be used for this transaction. - /// @param gasToken Token address (or 0 if ETH) that is used for the payment. - /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). - /// @param _nonce Transaction nonce. - /// @return Transaction hash. - function getTransactionHash( - address to, - uint256 value, - bytes memory data, - Enum.Operation operation, - uint256 safeTxGas, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address refundReceiver, - uint256 _nonce - ) - public - view - returns (bytes32) - { - return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce)); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/Migrations.sol b/packages/protocol-kit/contracts/safe_V1_1_1/Migrations.sol deleted file mode 100644 index 9ffe9a1d5..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/Migrations.sol +++ /dev/null @@ -1,31 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -contract Migrations { - address public owner; - uint public last_completed_migration; - - modifier restricted() { - if (msg.sender == owner) _; - } - - constructor() - public - { - owner = msg.sender; - } - - function setCompleted(uint completed) - public - restricted - { - last_completed_migration = completed; - } - - function upgrade(address new_address) - public - restricted - { - Migrations upgraded = Migrations(new_address); - upgraded.setCompleted(last_completed_migration); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/base/Executor.sol b/packages/protocol-kit/contracts/safe_V1_1_1/base/Executor.sol deleted file mode 100644 index 293c74799..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/base/Executor.sol +++ /dev/null @@ -1,40 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../common/Enum.sol"; - - -/// @title Executor - A contract that can execute transactions -/// @author Richard Meissner - -contract Executor { - - function execute(address to, uint256 value, bytes memory data, Enum.Operation operation, uint256 txGas) - internal - returns (bool success) - { - if (operation == Enum.Operation.Call) - success = executeCall(to, value, data, txGas); - else if (operation == Enum.Operation.DelegateCall) - success = executeDelegateCall(to, data, txGas); - else - success = false; - } - - function executeCall(address to, uint256 value, bytes memory data, uint256 txGas) - internal - returns (bool success) - { - // solium-disable-next-line security/no-inline-assembly - assembly { - success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0) - } - } - - function executeDelegateCall(address to, bytes memory data, uint256 txGas) - internal - returns (bool success) - { - // solium-disable-next-line security/no-inline-assembly - assembly { - success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0) - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/base/FallbackManager.sol b/packages/protocol-kit/contracts/safe_V1_1_1/base/FallbackManager.sol deleted file mode 100644 index 8de981c45..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/base/FallbackManager.sol +++ /dev/null @@ -1,57 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -import "../common/SelfAuthorized.sol"; - -/// @title Fallback Manager - A contract that manages fallback calls made to this contract -/// @author Richard Meissner - -contract FallbackManager is SelfAuthorized { - - // keccak256("fallback_manager.handler.address") - bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5; - - function internalSetFallbackHandler(address handler) internal { - bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT; - // solium-disable-next-line security/no-inline-assembly - assembly { - sstore(slot, handler) - } - } - - /// @dev Allows to add a contract to handle fallback calls. - /// Only fallback calls without value and with data will be forwarded. - /// This can only be done via a Safe transaction. - /// @param handler contract to handle fallbacks calls. - function setFallbackHandler(address handler) - public - authorized - { - internalSetFallbackHandler(handler); - } - - function () - external - payable - { - // Only calls without value and with data will be forwarded - if (msg.value > 0 || msg.data.length == 0) { - return; - } - bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT; - address handler; - // solium-disable-next-line security/no-inline-assembly - assembly { - handler := sload(slot) - } - - if (handler != address(0)) { - // solium-disable-next-line security/no-inline-assembly - assembly { - calldatacopy(0, 0, calldatasize()) - let success := call(gas, handler, 0, 0, calldatasize(), 0, 0) - returndatacopy(0, 0, returndatasize()) - if eq(success, 0) { revert(0, returndatasize()) } - return(0, returndatasize()) - } - } - } -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/base/Module.sol b/packages/protocol-kit/contracts/safe_V1_1_1/base/Module.sol deleted file mode 100644 index 298fc41ca..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/base/Module.sol +++ /dev/null @@ -1,26 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../common/MasterCopy.sol"; -import "./ModuleManager.sol"; - - -/// @title Module - Base class for modules. -/// @author Stefan George - -/// @author Richard Meissner - -contract Module is MasterCopy { - - ModuleManager public manager; - - modifier authorized() { - require(msg.sender == address(manager), "Method can only be called from manager"); - _; - } - - function setManager() - internal - { - // manager can only be 0 at initalization of contract. - // Check ensures that setup function can only be called once. - require(address(manager) == address(0), "Manager has already been set"); - manager = ModuleManager(msg.sender); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/base/ModuleManager.sol b/packages/protocol-kit/contracts/safe_V1_1_1/base/ModuleManager.sol deleted file mode 100644 index 747b391e3..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/base/ModuleManager.sol +++ /dev/null @@ -1,145 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../common/Enum.sol"; -import "../common/SelfAuthorized.sol"; -import "./Executor.sol"; -import "./Module.sol"; - - -/// @title Module Manager - A contract that manages modules that can execute transactions via this contract -/// @author Stefan George - -/// @author Richard Meissner - -contract ModuleManager is SelfAuthorized, Executor { - - event EnabledModule(Module module); - event DisabledModule(Module module); - event ExecutionFromModuleSuccess(address indexed module); - event ExecutionFromModuleFailure(address indexed module); - - address internal constant SENTINEL_MODULES = address(0x1); - - mapping (address => address) internal modules; - - function setupModules(address to, bytes memory data) - internal - { - require(modules[SENTINEL_MODULES] == address(0), "Modules have already been initialized"); - modules[SENTINEL_MODULES] = SENTINEL_MODULES; - if (to != address(0)) - // Setup has to complete successfully or transaction fails. - require(executeDelegateCall(to, data, gasleft()), "Could not finish initialization"); - } - - /// @dev Allows to add a module to the whitelist. - /// This can only be done via a Safe transaction. - /// @param module Module to be whitelisted. - function enableModule(Module module) - public - authorized - { - // Module address cannot be null or sentinel. - require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); - // Module cannot be added twice. - require(modules[address(module)] == address(0), "Module has already been added"); - modules[address(module)] = modules[SENTINEL_MODULES]; - modules[SENTINEL_MODULES] = address(module); - emit EnabledModule(module); - } - - /// @dev Allows to remove a module from the whitelist. - /// This can only be done via a Safe transaction. - /// @param prevModule Module that pointed to the module to be removed in the linked list - /// @param module Module to be removed. - function disableModule(Module prevModule, Module module) - public - authorized - { - // Validate module address and check that it corresponds to module index. - require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); - require(modules[address(prevModule)] == address(module), "Invalid prevModule, module pair provided"); - modules[address(prevModule)] = modules[address(module)]; - modules[address(module)] = address(0); - emit DisabledModule(module); - } - - /// @dev Allows a Module to execute a Safe transaction without any further confirmations. - /// @param to Destination address of module transaction. - /// @param value Ether value of module transaction. - /// @param data Data payload of module transaction. - /// @param operation Operation type of module transaction. - function execTransactionFromModule(address to, uint256 value, bytes memory data, Enum.Operation operation) - public - returns (bool success) - { - // Only whitelisted modules are allowed. - require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), "Method can only be called from an enabled module"); - // Execute transaction without further confirmations. - success = execute(to, value, data, operation, gasleft()); - if (success) emit ExecutionFromModuleSuccess(msg.sender); - else emit ExecutionFromModuleFailure(msg.sender); - } - - /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data - /// @param to Destination address of module transaction. - /// @param value Ether value of module transaction. - /// @param data Data payload of module transaction. - /// @param operation Operation type of module transaction. - function execTransactionFromModuleReturnData(address to, uint256 value, bytes memory data, Enum.Operation operation) - public - returns (bool success, bytes memory returnData) - { - success = execTransactionFromModule(to, value, data, operation); - // solium-disable-next-line security/no-inline-assembly - assembly { - // Load free memory location - let ptr := mload(0x40) - // We allocate memory for the return data by setting the free memory location to - // current free memory location + data size + 32 bytes for data size value - mstore(0x40, add(ptr, add(returndatasize(), 0x20))) - // Store the size - mstore(ptr, returndatasize()) - // Store the data - returndatacopy(add(ptr, 0x20), 0, returndatasize()) - // Point the return data to the correct memory location - returnData := ptr - } - } - - /// @dev Returns array of first 10 modules. - /// @return Array of modules. - function getModules() - public - view - returns (address[] memory) - { - (address[] memory array,) = getModulesPaginated(SENTINEL_MODULES, 10); - return array; - } - - /// @dev Returns array of modules. - /// @param start Start of the page. - /// @param pageSize Maximum number of modules that should be returned. - /// @return Array of modules. - function getModulesPaginated(address start, uint256 pageSize) - public - view - returns (address[] memory array, address next) - { - // Init array with max page size - array = new address[](pageSize); - - // Populate return array - uint256 moduleCount = 0; - address currentModule = modules[start]; - while(currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) { - array[moduleCount] = currentModule; - currentModule = modules[currentModule]; - moduleCount++; - } - next = currentModule; - // Set correct size of returned array - // solium-disable-next-line security/no-inline-assembly - assembly { - mstore(array, moduleCount) - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/base/OwnerManager.sol b/packages/protocol-kit/contracts/safe_V1_1_1/base/OwnerManager.sol deleted file mode 100644 index 4e99e4ea1..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/base/OwnerManager.sol +++ /dev/null @@ -1,165 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../common/SelfAuthorized.sol"; - -/// @title OwnerManager - Manages a set of owners and a threshold to perform actions. -/// @author Stefan George - -/// @author Richard Meissner - -contract OwnerManager is SelfAuthorized { - - event AddedOwner(address owner); - event RemovedOwner(address owner); - event ChangedThreshold(uint256 threshold); - - address internal constant SENTINEL_OWNERS = address(0x1); - - mapping(address => address) internal owners; - uint256 ownerCount; - uint256 internal threshold; - - /// @dev Setup function sets initial storage of contract. - /// @param _owners List of Safe owners. - /// @param _threshold Number of required confirmations for a Safe transaction. - function setupOwners(address[] memory _owners, uint256 _threshold) - internal - { - // Threshold can only be 0 at initialization. - // Check ensures that setup function can only be called once. - require(threshold == 0, "Owners have already been setup"); - // Validate that threshold is smaller than number of added owners. - require(_threshold <= _owners.length, "Threshold cannot exceed owner count"); - // There has to be at least one Safe owner. - require(_threshold >= 1, "Threshold needs to be greater than 0"); - // Initializing Safe owners. - address currentOwner = SENTINEL_OWNERS; - for (uint256 i = 0; i < _owners.length; i++) { - // Owner address cannot be null. - address owner = _owners[i]; - require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); - // No duplicate owners allowed. - require(owners[owner] == address(0), "Duplicate owner address provided"); - owners[currentOwner] = owner; - currentOwner = owner; - } - owners[currentOwner] = SENTINEL_OWNERS; - ownerCount = _owners.length; - threshold = _threshold; - } - - /// @dev Allows to add a new owner to the Safe and update the threshold at the same time. - /// This can only be done via a Safe transaction. - /// @param owner New owner address. - /// @param _threshold New threshold. - function addOwnerWithThreshold(address owner, uint256 _threshold) - public - authorized - { - // Owner address cannot be null. - require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); - // No duplicate owners allowed. - require(owners[owner] == address(0), "Address is already an owner"); - owners[owner] = owners[SENTINEL_OWNERS]; - owners[SENTINEL_OWNERS] = owner; - ownerCount++; - emit AddedOwner(owner); - // Change threshold if threshold was changed. - if (threshold != _threshold) - changeThreshold(_threshold); - } - - /// @dev Allows to remove an owner from the Safe and update the threshold at the same time. - /// This can only be done via a Safe transaction. - /// @param prevOwner Owner that pointed to the owner to be removed in the linked list - /// @param owner Owner address to be removed. - /// @param _threshold New threshold. - function removeOwner(address prevOwner, address owner, uint256 _threshold) - public - authorized - { - // Only allow to remove an owner, if threshold can still be reached. - require(ownerCount - 1 >= _threshold, "New owner count needs to be larger than new threshold"); - // Validate owner address and check that it corresponds to owner index. - require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); - require(owners[prevOwner] == owner, "Invalid prevOwner, owner pair provided"); - owners[prevOwner] = owners[owner]; - owners[owner] = address(0); - ownerCount--; - emit RemovedOwner(owner); - // Change threshold if threshold was changed. - if (threshold != _threshold) - changeThreshold(_threshold); - } - - /// @dev Allows to swap/replace an owner from the Safe with another address. - /// This can only be done via a Safe transaction. - /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list - /// @param oldOwner Owner address to be replaced. - /// @param newOwner New owner address. - function swapOwner(address prevOwner, address oldOwner, address newOwner) - public - authorized - { - // Owner address cannot be null. - require(newOwner != address(0) && newOwner != SENTINEL_OWNERS, "Invalid owner address provided"); - // No duplicate owners allowed. - require(owners[newOwner] == address(0), "Address is already an owner"); - // Validate oldOwner address and check that it corresponds to owner index. - require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, "Invalid owner address provided"); - require(owners[prevOwner] == oldOwner, "Invalid prevOwner, owner pair provided"); - owners[newOwner] = owners[oldOwner]; - owners[prevOwner] = newOwner; - owners[oldOwner] = address(0); - emit RemovedOwner(oldOwner); - emit AddedOwner(newOwner); - } - - /// @dev Allows to update the number of required confirmations by Safe owners. - /// This can only be done via a Safe transaction. - /// @param _threshold New threshold. - function changeThreshold(uint256 _threshold) - public - authorized - { - // Validate that threshold is smaller than number of owners. - require(_threshold <= ownerCount, "Threshold cannot exceed owner count"); - // There has to be at least one Safe owner. - require(_threshold >= 1, "Threshold needs to be greater than 0"); - threshold = _threshold; - emit ChangedThreshold(threshold); - } - - function getThreshold() - public - view - returns (uint256) - { - return threshold; - } - - function isOwner(address owner) - public - view - returns (bool) - { - return owner != SENTINEL_OWNERS && owners[owner] != address(0); - } - - /// @dev Returns array of owners. - /// @return Array of Safe owners. - function getOwners() - public - view - returns (address[] memory) - { - address[] memory array = new address[](ownerCount); - - // populate return array - uint256 index = 0; - address currentOwner = owners[SENTINEL_OWNERS]; - while(currentOwner != SENTINEL_OWNERS) { - array[index] = currentOwner; - currentOwner = owners[currentOwner]; - index ++; - } - return array; - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/common/Enum.sol b/packages/protocol-kit/contracts/safe_V1_1_1/common/Enum.sol deleted file mode 100644 index 3288682a4..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/common/Enum.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title Enum - Collection of enums -/// @author Richard Meissner - -contract Enum { - enum Operation { - Call, - DelegateCall - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol b/packages/protocol-kit/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol deleted file mode 100644 index 7fddb9a28..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol +++ /dev/null @@ -1,15 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments -/// @author Richard Meissner - -contract EtherPaymentFallback { - - /// @dev Fallback function accepts Ether transactions. - function () - external - payable - { - - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/common/MasterCopy.sol b/packages/protocol-kit/contracts/safe_V1_1_1/common/MasterCopy.sol deleted file mode 100644 index 1fa27b3e5..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/common/MasterCopy.sol +++ /dev/null @@ -1,27 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "./SelfAuthorized.sol"; - - -/// @title MasterCopy - Base for master copy contracts (should always be first super contract) -/// This contract is tightly coupled to our proxy contract (see `proxies/Proxy.sol`) -/// @author Richard Meissner - -contract MasterCopy is SelfAuthorized { - - event ChangedMasterCopy(address masterCopy); - - // masterCopy always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract. - // It should also always be ensured that the address is stored alone (uses a full word) - address private masterCopy; - - /// @dev Allows to upgrade the contract. This can only be done via a Safe transaction. - /// @param _masterCopy New contract address. - function changeMasterCopy(address _masterCopy) - public - authorized - { - // Master copy address cannot be null. - require(_masterCopy != address(0), "Invalid master copy address provided"); - masterCopy = _masterCopy; - emit ChangedMasterCopy(_masterCopy); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol b/packages/protocol-kit/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol deleted file mode 100644 index 1ba688e9f..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol +++ /dev/null @@ -1,33 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title SecuredTokenTransfer - Secure token transfer -/// @author Richard Meissner - -contract SecuredTokenTransfer { - - /// @dev Transfers a token and returns if it was a success - /// @param token Token that should be transferred - /// @param receiver Receiver to whom the token should be transferred - /// @param amount The amount of tokens that should be transferred - function transferToken ( - address token, - address receiver, - uint256 amount - ) - internal - returns (bool transferred) - { - bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", receiver, amount); - // solium-disable-next-line security/no-inline-assembly - assembly { - let success := call(sub(gas, 10000), token, 0, add(data, 0x20), mload(data), 0, 0) - let ptr := mload(0x40) - mstore(0x40, add(ptr, returndatasize())) - returndatacopy(ptr, 0, returndatasize()) - switch returndatasize() - case 0 { transferred := success } - case 0x20 { transferred := iszero(or(iszero(success), iszero(mload(ptr)))) } - default { transferred := 0 } - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/common/SelfAuthorized.sol b/packages/protocol-kit/contracts/safe_V1_1_1/common/SelfAuthorized.sol deleted file mode 100644 index d5892fcf9..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/common/SelfAuthorized.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title SelfAuthorized - authorizes current contract to perform actions -/// @author Richard Meissner - -contract SelfAuthorized { - modifier authorized() { - require(msg.sender == address(this), "Method can only be called from this contract"); - _; - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/common/SignatureDecoder.sol b/packages/protocol-kit/contracts/safe_V1_1_1/common/SignatureDecoder.sol deleted file mode 100644 index 87020c465..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/common/SignatureDecoder.sol +++ /dev/null @@ -1,54 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title SignatureDecoder - Decodes signatures that a encoded as bytes -/// @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) -/// @author Richard Meissner - -contract SignatureDecoder { - - /// @dev Recovers address who signed the message - /// @param messageHash operation ethereum signed message hash - /// @param messageSignature message `txHash` signature - /// @param pos which signature to read - function recoverKey ( - bytes32 messageHash, - bytes memory messageSignature, - uint256 pos - ) - internal - pure - returns (address) - { - uint8 v; - bytes32 r; - bytes32 s; - (v, r, s) = signatureSplit(messageSignature, pos); - return ecrecover(messageHash, v, r, s); - } - - /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`. - /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures - /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access - /// @param signatures concatenated rsv signatures - function signatureSplit(bytes memory signatures, uint256 pos) - internal - pure - returns (uint8 v, bytes32 r, bytes32 s) - { - // The signature format is a compact form of: - // {bytes32 r}{bytes32 s}{uint8 v} - // Compact means, uint8 is not padded to 32 bytes. - // solium-disable-next-line security/no-inline-assembly - assembly { - let signaturePos := mul(0x41, pos) - r := mload(add(signatures, add(signaturePos, 0x20))) - s := mload(add(signatures, add(signaturePos, 0x40))) - // Here we are loading the last 32 bytes, including 31 bytes - // of 's'. There is no 'mload8' to do this. - // - // 'byte' is not working due to the Solidity parser, so lets - // use the second best option, 'and' - v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff) - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/external/SafeMath.sol b/packages/protocol-kit/contracts/safe_V1_1_1/external/SafeMath.sol deleted file mode 100644 index ed3f10406..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/external/SafeMath.sol +++ /dev/null @@ -1,66 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -/** - * @title SafeMath - * @dev Math operations with safety checks that revert on error - * TODO: remove once open zeppelin update to solc 0.5.0 - */ -library SafeMath { - - /** - * @dev Multiplies two numbers, reverts on overflow. - */ - function mul(uint256 a, uint256 b) internal pure returns (uint256) { - // Gas optimization: this is cheaper than requiring 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - if (a == 0) { - return 0; - } - - uint256 c = a * b; - require(c / a == b); - - return c; - } - - /** - * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. - */ - function div(uint256 a, uint256 b) internal pure returns (uint256) { - require(b > 0); // Solidity only automatically asserts when dividing by 0 - uint256 c = a / b; - // assert(a == b * c + a % b); // There is no case in which this doesn't hold - - return c; - } - - /** - * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). - */ - function sub(uint256 a, uint256 b) internal pure returns (uint256) { - require(b <= a); - uint256 c = a - b; - - return c; - } - - /** - * @dev Adds two numbers, reverts on overflow. - */ - function add(uint256 a, uint256 b) internal pure returns (uint256) { - uint256 c = a + b; - require(c >= a); - - return c; - } - - /** - * @dev Divides two numbers and returns the remainder (unsigned integer modulo), - * reverts when dividing by zero. - */ - function mod(uint256 a, uint256 b) internal pure returns (uint256) { - require(b != 0); - return a % b; - } -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol b/packages/protocol-kit/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol deleted file mode 100644 index 03058d1b0..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol +++ /dev/null @@ -1,40 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -import "../interfaces/ERC1155TokenReceiver.sol"; -import "../interfaces/ERC721TokenReceiver.sol"; -import "../interfaces/ERC777TokensRecipient.sol"; - -/// @title Default Callback Handler - returns true for known token callbacks -/// @author Richard Meissner - -contract DefaultCallbackHandler is ERC1155TokenReceiver, ERC777TokensRecipient, ERC721TokenReceiver { - - string public constant NAME = "Default Callback Handler"; - string public constant VERSION = "1.0.0"; - - function onERC1155Received(address, address, uint256, uint256, bytes calldata) - external - returns(bytes4) - { - return 0xf23a6e61; - } - - function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) - external - returns(bytes4) - { - return 0xbc197c81; - } - - function onERC721Received(address, address, uint256, bytes calldata) - external - returns(bytes4) - { - return 0x150b7a02; - } - - // solium-disable-next-line no-empty-blocks - function tokensReceived(address, address, address, uint256, bytes calldata, bytes calldata) external { - // We implement this for completeness, doesn't really have any value - } - -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol b/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol deleted file mode 100644 index 56c72cdff..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol +++ /dev/null @@ -1,36 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -/** - Note: The ERC-165 identifier for this interface is 0x4e2312e0. -*/ -interface ERC1155TokenReceiver { - /** - @notice Handle the receipt of a single ERC1155 token type. - @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeTransferFrom` after the balance has been updated. - This function MUST return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61) if it accepts the transfer. - This function MUST revert if it rejects the transfer. - Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. - @param _operator The address which initiated the transfer (i.e. msg.sender) - @param _from The address which previously owned the token - @param _id The ID of the token being transferred - @param _value The amount of tokens being transferred - @param _data Additional data with no specified format - @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` - */ - function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _value, bytes calldata _data) external returns(bytes4); - - /** - @notice Handle the receipt of multiple ERC1155 token types. - @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated. - This function MUST return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81) if it accepts the transfer(s). - This function MUST revert if it rejects the transfer(s). - Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. - @param _operator The address which initiated the batch transfer (i.e. msg.sender) - @param _from The address which previously owned the token - @param _ids An array containing ids of each token being transferred (order and length must match _values array) - @param _values An array containing amounts of each token being transferred (order and length must match _ids array) - @param _data Additional data with no specified format - @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` - */ - function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external returns(bytes4); -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol b/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol deleted file mode 100644 index 2bf050bac..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol +++ /dev/null @@ -1,18 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02. -interface ERC721TokenReceiver { - /// @notice Handle the receipt of an NFT - /// @dev The ERC721 smart contract calls this function on the recipient - /// after a `transfer`. This function MAY throw to revert and reject the - /// transfer. Return of other than the magic value MUST result in the - /// transaction being reverted. - /// Note: the contract address is always the message sender. - /// @param _operator The address which called `safeTransferFrom` function - /// @param _from The address which previously owned the token - /// @param _tokenId The NFT identifier which is being transferred - /// @param _data Additional data with no specified format - /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` - /// unless throwing - function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external returns(bytes4); -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol b/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol deleted file mode 100644 index b8c471377..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol +++ /dev/null @@ -1,12 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -interface ERC777TokensRecipient { - function tokensReceived( - address operator, - address from, - address to, - uint256 amount, - bytes calldata data, - bytes calldata operatorData - ) external; -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol b/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol deleted file mode 100644 index ff8a7478f..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol +++ /dev/null @@ -1,25 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -contract ISignatureValidatorConstants { - // bytes4(keccak256("isValidSignature(bytes,bytes)") - bytes4 constant internal EIP1271_MAGIC_VALUE = 0x20c13b0b; -} - -contract ISignatureValidator is ISignatureValidatorConstants { - - /** - * @dev Should return whether the signature provided is valid for the provided data - * @param _data Arbitrary length data signed on the behalf of address(this) - * @param _signature Signature byte array associated with _data - * - * MUST return the bytes4 magic value 0x20c13b0b when function passes. - * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5) - * MUST allow external calls - */ - function isValidSignature( - bytes memory _data, - bytes memory _signature) - public - view - returns (bytes4); -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol b/packages/protocol-kit/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol deleted file mode 100644 index f0ca1d8a9..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol +++ /dev/null @@ -1,43 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../base/Module.sol"; - - -/// @title Create and Add Modules - Allows to create and add multiple module in one transaction. -/// @author Stefan George - -/// @author Richard Meissner - -contract CreateAndAddModules { - - /// @dev Function required to compile contract. Gnosis Safe function is called instead. - /// @param module Not used. - function enableModule(Module module) - public - { - revert(); - } - - /// @dev Allows to create and add multiple module in one transaction. - /// @param proxyFactory Module proxy factory contract. - /// @param data Modules constructor payload. This is the data for each proxy factory call concatinated. (e.g. ) - function createAndAddModules(address proxyFactory, bytes memory data) - public - { - uint256 length = data.length; - Module module; - uint256 i = 0; - while (i < length) { - // solium-disable-next-line security/no-inline-assembly - assembly { - let createBytesLength := mload(add(0x20, add(data, i))) - let createBytes := add(0x40, add(data, i)) - - let output := mload(0x40) - if eq(delegatecall(gas, proxyFactory, createBytes, createBytesLength, output, 0x20), 0) { revert(0, 0) } - module := and(mload(output), 0xffffffffffffffffffffffffffffffffffffffff) - - // Data is always padded to 32 bytes - i := add(i, add(0x20, mul(div(add(createBytesLength, 0x1f), 0x20), 0x20))) - } - this.enableModule(module); - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/libraries/CreateCall.sol b/packages/protocol-kit/contracts/safe_V1_1_1/libraries/CreateCall.sol deleted file mode 100644 index 9e1564557..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/libraries/CreateCall.sol +++ /dev/null @@ -1,26 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title Create Call - Allows to use the different create opcodes to deploy a contract -/// @author Richard Meissner - -contract CreateCall { - event ContractCreation(address newContract); - - function performCreate2(uint256 value, bytes memory deploymentData, bytes32 salt) public returns(address newContract) { - // solium-disable-next-line security/no-inline-assembly - assembly { - newContract := create2(value, add(0x20, deploymentData), mload(deploymentData), salt) - } - require(newContract != address(0), "Could not deploy contract"); - emit ContractCreation(newContract); - } - - function performCreate(uint256 value, bytes memory deploymentData) public returns(address newContract) { - // solium-disable-next-line security/no-inline-assembly - assembly { - newContract := create(value, add(deploymentData, 0x20), mload(deploymentData)) - } - require(newContract != address(0), "Could not deploy contract"); - emit ContractCreation(newContract); - } -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/libraries/MultiSend.sol b/packages/protocol-kit/contracts/safe_V1_1_1/libraries/MultiSend.sol deleted file mode 100644 index 8bfe010ca..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/libraries/MultiSend.sol +++ /dev/null @@ -1,59 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title Multi Send - Allows to batch multiple transactions into one. -/// @author Nick Dodson - -/// @author Gonçalo Sá - -/// @author Stefan George - -/// @author Richard Meissner - -contract MultiSend { - - bytes32 constant private GUARD_VALUE = keccak256("multisend.guard.bytes32"); - - bytes32 guard; - - constructor() public { - guard = GUARD_VALUE; - } - - /// @dev Sends multiple transactions and reverts all if one fails. - /// @param transactions Encoded transactions. Each transaction is encoded as a packed bytes of - /// operation as a uint8 with 0 for a call or 1 for a delegatecall (=> 1 byte), - /// to as a address (=> 20 bytes), - /// value as a uint256 (=> 32 bytes), - /// data length as a uint256 (=> 32 bytes), - /// data as bytes. - /// see abi.encodePacked for more information on packed encoding - function multiSend(bytes memory transactions) - public - { - require(guard != GUARD_VALUE, "MultiSend should only be called via delegatecall"); - // solium-disable-next-line security/no-inline-assembly - assembly { - let length := mload(transactions) - let i := 0x20 - for { } lt(i, length) { } { - // First byte of the data is the operation. - // We shift by 248 bits (256 - 8 [operation byte]) it right since mload will always load 32 bytes (a word). - // This will also zero out unused data. - let operation := shr(0xf8, mload(add(transactions, i))) - // We offset the load address by 1 byte (operation byte) - // We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data. - let to := shr(0x60, mload(add(transactions, add(i, 0x01)))) - // We offset the load address by 21 byte (operation byte + 20 address bytes) - let value := mload(add(transactions, add(i, 0x15))) - // We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes) - let dataLength := mload(add(transactions, add(i, 0x35))) - // We offset the load address by 85 byte (operation byte + 20 address bytes + 32 value bytes + 32 data length bytes) - let data := add(transactions, add(i, 0x55)) - let success := 0 - switch operation - case 0 { success := call(gas, to, value, data, dataLength, 0, 0) } - case 1 { success := delegatecall(gas, to, data, dataLength, 0, 0) } - if eq(success, 0) { revert(0, 0) } - // Next entry starts at 85 byte + data length - i := add(i, add(0x55, dataLength)) - } - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol b/packages/protocol-kit/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol deleted file mode 100644 index fd7b006e2..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol +++ /dev/null @@ -1,27 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "./Proxy.sol"; - - -/// @title Delegate Constructor Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. -/// @author Stefan George - -/// @author Richard Meissner - -contract DelegateConstructorProxy is Proxy { - - /// @dev Constructor function sets address of master copy contract. - /// @param _masterCopy Master copy address. - /// @param initializer Data used for a delegate call to initialize the contract. - constructor(address _masterCopy, bytes memory initializer) Proxy(_masterCopy) - public - { - if (initializer.length > 0) { - // solium-disable-next-line security/no-inline-assembly - assembly { - let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) - let success := delegatecall(sub(gas, 10000), masterCopy, add(initializer, 0x20), mload(initializer), 0, 0) - let ptr := mload(0x40) - returndatacopy(ptr, 0, returndatasize()) - if eq(success, 0) { revert(ptr, returndatasize()) } - } - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol b/packages/protocol-kit/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol deleted file mode 100644 index bc01952aa..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma solidity ^0.5.3; -import "./Proxy.sol"; - -interface IProxyCreationCallback { - function proxyCreated(Proxy proxy, address _mastercopy, bytes calldata initializer, uint256 saltNonce) external; -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/proxies/PayingProxy.sol b/packages/protocol-kit/contracts/safe_V1_1_1/proxies/PayingProxy.sol deleted file mode 100644 index 0db92a558..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/proxies/PayingProxy.sol +++ /dev/null @@ -1,29 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../common/SecuredTokenTransfer.sol"; -import "./DelegateConstructorProxy.sol"; - -/// @title Paying Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. And sends funds after creation to a specified account. -/// @author Stefan George - -/// @author Richard Meissner - -contract PayingProxy is DelegateConstructorProxy, SecuredTokenTransfer { - - /// @dev Constructor function sets address of master copy contract. - /// @param _masterCopy Master copy address. - /// @param initializer Data used for a delegate call to initialize the contract. - /// @param funder Address that should be paid for the execution of this call - /// @param paymentToken Token that should be used for the payment (0 is ETH) - /// @param payment Value that should be paid - constructor(address _masterCopy, bytes memory initializer, address payable funder, address paymentToken, uint256 payment) - DelegateConstructorProxy(_masterCopy, initializer) - public - { - if (payment > 0) { - if (paymentToken == address(0)) { - // solium-disable-next-line security/no-send - require(funder.send(payment), "Could not pay safe creation with ether"); - } else { - require(transferToken(paymentToken, funder, payment), "Could not pay safe creation with token"); - } - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/proxies/Proxy.sol b/packages/protocol-kit/contracts/safe_V1_1_1/proxies/Proxy.sol deleted file mode 100644 index c5b6e39bc..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/proxies/Proxy.sol +++ /dev/null @@ -1,47 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain -/// @author Richard Meissner - -interface IProxy { - function masterCopy() external view returns (address); -} - -/// @title Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. -/// @author Stefan George - -/// @author Richard Meissner - -contract Proxy { - - // masterCopy always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. - // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` - address internal masterCopy; - - /// @dev Constructor function sets address of master copy contract. - /// @param _masterCopy Master copy address. - constructor(address _masterCopy) - public - { - require(_masterCopy != address(0), "Invalid master copy address provided"); - masterCopy = _masterCopy; - } - - /// @dev Fallback function forwards all transactions and returns all received return data. - function () - external - payable - { - // solium-disable-next-line security/no-inline-assembly - assembly { - let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) - // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s - if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { - mstore(0, masterCopy) - return(0, 0x20) - } - calldatacopy(0, 0, calldatasize()) - let success := delegatecall(gas, masterCopy, 0, calldatasize(), 0, 0) - returndatacopy(0, 0, returndatasize()) - if eq(success, 0) { revert(0, returndatasize()) } - return(0, returndatasize()) - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_1_1/proxies/ProxyFactory.sol b/packages/protocol-kit/contracts/safe_V1_1_1/proxies/ProxyFactory.sol deleted file mode 100644 index 0f194e20a..000000000 --- a/packages/protocol-kit/contracts/safe_V1_1_1/proxies/ProxyFactory.sol +++ /dev/null @@ -1,102 +0,0 @@ -pragma solidity ^0.5.3; -import "./Proxy.sol"; -import "./IProxyCreationCallback.sol"; - -/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. -/// @author Stefan George - -contract ProxyFactory { - - event ProxyCreation(Proxy proxy); - - /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. - /// @param masterCopy Address of master copy. - /// @param data Payload for message call sent to new proxy contract. - function createProxy(address masterCopy, bytes memory data) - public - returns (Proxy proxy) - { - proxy = new Proxy(masterCopy); - if (data.length > 0) - // solium-disable-next-line security/no-inline-assembly - assembly { - if eq(call(gas, proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } - } - emit ProxyCreation(proxy); - } - - /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. - function proxyRuntimeCode() public pure returns (bytes memory) { - return type(Proxy).runtimeCode; - } - - /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. - function proxyCreationCode() public pure returns (bytes memory) { - return type(Proxy).creationCode; - } - - /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. - /// This method is only meant as an utility to be called from other methods - /// @param _mastercopy Address of master copy. - /// @param initializer Payload for message call sent to new proxy contract. - /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. - function deployProxyWithNonce(address _mastercopy, bytes memory initializer, uint256 saltNonce) - internal - returns (Proxy proxy) - { - // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it - bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); - bytes memory deploymentData = abi.encodePacked(type(Proxy).creationCode, uint256(_mastercopy)); - // solium-disable-next-line security/no-inline-assembly - assembly { - proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) - } - require(address(proxy) != address(0), "Create2 call failed"); - } - - /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. - /// @param _mastercopy Address of master copy. - /// @param initializer Payload for message call sent to new proxy contract. - /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. - function createProxyWithNonce(address _mastercopy, bytes memory initializer, uint256 saltNonce) - public - returns (Proxy proxy) - { - proxy = deployProxyWithNonce(_mastercopy, initializer, saltNonce); - if (initializer.length > 0) - // solium-disable-next-line security/no-inline-assembly - assembly { - if eq(call(gas, proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0,0) } - } - emit ProxyCreation(proxy); - } - - /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction - /// @param _mastercopy Address of master copy. - /// @param initializer Payload for message call sent to new proxy contract. - /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. - /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. - function createProxyWithCallback(address _mastercopy, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback) - public - returns (Proxy proxy) - { - uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); - proxy = createProxyWithNonce(_mastercopy, initializer, saltNonceWithCallback); - if (address(callback) != address(0)) - callback.proxyCreated(proxy, _mastercopy, initializer, saltNonce); - } - - /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` - /// This method is only meant for address calculation purpose when you use an initializer that would revert, - /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. - /// @param _mastercopy Address of master copy. - /// @param initializer Payload for message call sent to new proxy contract. - /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. - function calculateCreateProxyWithNonceAddress(address _mastercopy, bytes calldata initializer, uint256 saltNonce) - external - returns (Proxy proxy) - { - proxy = deployProxyWithNonce(_mastercopy, initializer, saltNonce); - revert(string(abi.encodePacked(proxy))); - } - -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/GnosisSafe.sol b/packages/protocol-kit/contracts/safe_V1_2_0/GnosisSafe.sol deleted file mode 100644 index a0d6eff4f..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/GnosisSafe.sol +++ /dev/null @@ -1,421 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "./base/ModuleManager.sol"; -import "./base/OwnerManager.sol"; -import "./base/FallbackManager.sol"; -import "./common/MasterCopy.sol"; -import "./common/SignatureDecoder.sol"; -import "./common/SecuredTokenTransfer.sol"; -import "./interfaces/ISignatureValidator.sol"; -import "./external/GnosisSafeMath.sol"; - -/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191. -/// @author Stefan George - -/// @author Richard Meissner - -/// @author Ricardo Guilherme Schmidt - (Status Research & Development GmbH) - Gas Token Payment -contract GnosisSafe - is MasterCopy, ModuleManager, OwnerManager, SignatureDecoder, SecuredTokenTransfer, ISignatureValidatorConstants, FallbackManager { - - using GnosisSafeMath for uint256; - - string public constant NAME = "Gnosis Safe"; - string public constant VERSION = "1.2.0"; - - //keccak256( - // "EIP712Domain(address verifyingContract)" - //); - bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x035aff83d86937d35b32e04f0ddc6ff469290eef2f1b692d8a815c89404d4749; - - //keccak256( - // "SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)" - //); - bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8; - - //keccak256( - // "SafeMessage(bytes message)" - //); - bytes32 private constant SAFE_MSG_TYPEHASH = 0x60b3cbf8b4a223d68d641b3b6ddf9a298e7f33710cf3d3a9d1146b5a6150fbca; - - event ApproveHash( - bytes32 indexed approvedHash, - address indexed owner - ); - event SignMsg( - bytes32 indexed msgHash - ); - event ExecutionFailure( - bytes32 txHash, uint256 payment - ); - event ExecutionSuccess( - bytes32 txHash, uint256 payment - ); - - uint256 public nonce; - bytes32 public domainSeparator; - // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners - mapping(bytes32 => uint256) public signedMessages; - // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners - mapping(address => mapping(bytes32 => uint256)) public approvedHashes; - - // This constructor ensures that this contract can only be used as a master copy for Proxy contracts - constructor() public { - // By setting the threshold it is not possible to call setup anymore, - // so we create a Safe with 0 owners and threshold 1. - // This is an unusable Safe, perfect for the mastercopy - threshold = 1; - } - - /// @dev Setup function sets initial storage of contract. - /// @param _owners List of Safe owners. - /// @param _threshold Number of required confirmations for a Safe transaction. - /// @param to Contract address for optional delegate call. - /// @param data Data payload for optional delegate call. - /// @param fallbackHandler Handler for fallback calls to this contract - /// @param paymentToken Token that should be used for the payment (0 is ETH) - /// @param payment Value that should be paid - /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin) - function setup( - address[] calldata _owners, - uint256 _threshold, - address to, - bytes calldata data, - address fallbackHandler, - address paymentToken, - uint256 payment, - address payable paymentReceiver - ) - external - { - require(domainSeparator == 0, "Domain Separator already set!"); - domainSeparator = keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, this)); - setupOwners(_owners, _threshold); - if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler); - // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules - setupModules(to, data); - - if (payment > 0) { - // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself) - // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment - handlePayment(payment, 0, 1, paymentToken, paymentReceiver); - } - } - - /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction. - /// Note: The fees are always transfered, even if the user transaction fails. - /// @param to Destination address of Safe transaction. - /// @param value Ether value of Safe transaction. - /// @param data Data payload of Safe transaction. - /// @param operation Operation type of Safe transaction. - /// @param safeTxGas Gas that should be used for the Safe transaction. - /// @param baseGas Gas costs for that are indipendent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund) - /// @param gasPrice Gas price that should be used for the payment calculation. - /// @param gasToken Token address (or 0 if ETH) that is used for the payment. - /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). - /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v}) - function execTransaction( - address to, - uint256 value, - bytes calldata data, - Enum.Operation operation, - uint256 safeTxGas, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address payable refundReceiver, - bytes calldata signatures - ) - external - payable - returns (bool success) - { - bytes32 txHash; - // Use scope here to limit variable lifetime and prevent `stack too deep` errors - { - bytes memory txHashData = encodeTransactionData( - to, value, data, operation, // Transaction info - safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, // Payment info - nonce - ); - // Increase nonce and execute transaction. - nonce++; - txHash = keccak256(txHashData); - checkSignatures(txHash, txHashData, signatures, true); - } - // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500) - // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150 - require(gasleft() >= (safeTxGas * 64 / 63).max(safeTxGas + 2500) + 500, "Not enough gas to execute safe transaction"); - // Use scope here to limit variable lifetime and prevent `stack too deep` errors - { - uint256 gasUsed = gasleft(); - // If the gasPrice is 0 we assume that nearly all available gas can be used (it is always more than safeTxGas) - // We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas - success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas); - gasUsed = gasUsed.sub(gasleft()); - // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls - uint256 payment = 0; - if (gasPrice > 0) { - payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver); - } - if (success) emit ExecutionSuccess(txHash, payment); - else emit ExecutionFailure(txHash, payment); - } - } - - function handlePayment( - uint256 gasUsed, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address payable refundReceiver - ) - private - returns (uint256 payment) - { - // solium-disable-next-line security/no-tx-origin - address payable receiver = refundReceiver == address(0) ? tx.origin : refundReceiver; - if (gasToken == address(0)) { - // For ETH we will only adjust the gas price to not be higher than the actual used gas price - payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice); - // solium-disable-next-line security/no-send - require(receiver.send(payment), "Could not pay gas costs with ether"); - } else { - payment = gasUsed.add(baseGas).mul(gasPrice); - require(transferToken(gasToken, receiver, payment), "Could not pay gas costs with token"); - } - } - - /** - * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise. - * @param dataHash Hash of the data (could be either a message hash or transaction hash) - * @param data That should be signed (this is passed to an external validator contract) - * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash. - * @param consumeHash Indicates that in case of an approved hash the storage can be freed to save gas - */ - function checkSignatures(bytes32 dataHash, bytes memory data, bytes memory signatures, bool consumeHash) - internal - { - // Load threshold to avoid multiple storage loads - uint256 _threshold = threshold; - // Check that a threshold is set - require(_threshold > 0, "Threshold needs to be defined!"); - // Check that the provided signature data is not too short - require(signatures.length >= _threshold.mul(65), "Signatures data too short"); - // There cannot be an owner with address 0. - address lastOwner = address(0); - address currentOwner; - uint8 v; - bytes32 r; - bytes32 s; - uint256 i; - for (i = 0; i < _threshold; i++) { - (v, r, s) = signatureSplit(signatures, i); - // If v is 0 then it is a contract signature - if (v == 0) { - // When handling contract signatures the address of the contract is encoded into r - currentOwner = address(uint256(r)); - - // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes - // This check is not completely accurate, since it is possible that more signatures than the threshold are send. - // Here we only check that the pointer is not pointing inside the part that is being processed - require(uint256(s) >= _threshold.mul(65), "Invalid contract signature location: inside static part"); - - // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes) - require(uint256(s).add(32) <= signatures.length, "Invalid contract signature location: length not present"); - - // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length - uint256 contractSignatureLen; - // solium-disable-next-line security/no-inline-assembly - assembly { - contractSignatureLen := mload(add(add(signatures, s), 0x20)) - } - require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, "Invalid contract signature location: data not complete"); - - // Check signature - bytes memory contractSignature; - // solium-disable-next-line security/no-inline-assembly - assembly { - // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s - contractSignature := add(add(signatures, s), 0x20) - } - require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, "Invalid contract signature provided"); - // If v is 1 then it is an approved hash - } else if (v == 1) { - // When handling approved hashes the address of the approver is encoded into r - currentOwner = address(uint256(r)); - // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction - require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, "Hash has not been approved"); - // Hash has been marked for consumption. If this hash was pre-approved free storage - if (consumeHash && msg.sender != currentOwner) { - approvedHashes[currentOwner][dataHash] = 0; - } - } else if (v > 30) { - // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover - currentOwner = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", dataHash)), v - 4, r, s); - } else { - // Use ecrecover with the messageHash for EOA signatures - currentOwner = ecrecover(dataHash, v, r, s); - } - require ( - currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, - "Invalid owner provided" - ); - lastOwner = currentOwner; - } - } - - /// @dev Allows to estimate a Safe transaction. - /// This method is only meant for estimation purpose, therefore two different protection mechanism against execution in a transaction have been made: - /// 1.) The method can only be called from the safe itself - /// 2.) The response is returned with a revert - /// When estimating set `from` to the address of the safe. - /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction` - /// @param to Destination address of Safe transaction. - /// @param value Ether value of Safe transaction. - /// @param data Data payload of Safe transaction. - /// @param operation Operation type of Safe transaction. - /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs). - function requiredTxGas(address to, uint256 value, bytes calldata data, Enum.Operation operation) - external - authorized - returns (uint256) - { - uint256 startGas = gasleft(); - // We don't provide an error message here, as we use it to return the estimate - // solium-disable-next-line error-reason - require(execute(to, value, data, operation, gasleft())); - uint256 requiredGas = startGas - gasleft(); - // Convert response to string and return via error message - revert(string(abi.encodePacked(requiredGas))); - } - - /** - * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature. - * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract. - */ - function approveHash(bytes32 hashToApprove) - external - { - require(owners[msg.sender] != address(0), "Only owners can approve a hash"); - approvedHashes[msg.sender][hashToApprove] = 1; - emit ApproveHash(hashToApprove, msg.sender); - } - - /** - * @dev Marks a message as signed, so that it can be used with EIP-1271 - * @notice Marks a message (`_data`) as signed. - * @param _data Arbitrary length data that should be marked as signed on the behalf of address(this) - */ - function signMessage(bytes calldata _data) - external - authorized - { - bytes32 msgHash = getMessageHash(_data); - signedMessages[msgHash] = 1; - emit SignMsg(msgHash); - } - - /** - * Implementation of ISignatureValidator (see `interfaces/ISignatureValidator.sol`) - * @dev Should return whether the signature provided is valid for the provided data. - * The save does not implement the interface since `checkSignatures` is not a view method. - * The method will not perform any state changes (see parameters of `checkSignatures`) - * @param _data Arbitrary length data signed on the behalf of address(this) - * @param _signature Signature byte array associated with _data - * @return a bool upon valid or invalid signature with corresponding _data - */ - function isValidSignature(bytes calldata _data, bytes calldata _signature) - external - returns (bytes4) - { - bytes32 messageHash = getMessageHash(_data); - if (_signature.length == 0) { - require(signedMessages[messageHash] != 0, "Hash not approved"); - } else { - // consumeHash needs to be false, as the state should not be changed - checkSignatures(messageHash, _data, _signature, false); - } - return EIP1271_MAGIC_VALUE; - } - - /// @dev Returns hash of a message that can be signed by owners. - /// @param message Message that should be hashed - /// @return Message hash. - function getMessageHash( - bytes memory message - ) - public - view - returns (bytes32) - { - bytes32 safeMessageHash = keccak256( - abi.encode(SAFE_MSG_TYPEHASH, keccak256(message)) - ); - return keccak256( - abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeMessageHash) - ); - } - - /// @dev Returns the bytes that are hashed to be signed by owners. - /// @param to Destination address. - /// @param value Ether value. - /// @param data Data payload. - /// @param operation Operation type. - /// @param safeTxGas Fas that should be used for the safe transaction. - /// @param baseGas Gas costs for data used to trigger the safe transaction. - /// @param gasPrice Maximum gas price that should be used for this transaction. - /// @param gasToken Token address (or 0 if ETH) that is used for the payment. - /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). - /// @param _nonce Transaction nonce. - /// @return Transaction hash bytes. - function encodeTransactionData( - address to, - uint256 value, - bytes memory data, - Enum.Operation operation, - uint256 safeTxGas, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address refundReceiver, - uint256 _nonce - ) - public - view - returns (bytes memory) - { - bytes32 safeTxHash = keccak256( - abi.encode(SAFE_TX_TYPEHASH, to, value, keccak256(data), operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce) - ); - return abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeTxHash); - } - - /// @dev Returns hash to be signed by owners. - /// @param to Destination address. - /// @param value Ether value. - /// @param data Data payload. - /// @param operation Operation type. - /// @param safeTxGas Fas that should be used for the safe transaction. - /// @param baseGas Gas costs for data used to trigger the safe transaction. - /// @param gasPrice Maximum gas price that should be used for this transaction. - /// @param gasToken Token address (or 0 if ETH) that is used for the payment. - /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). - /// @param _nonce Transaction nonce. - /// @return Transaction hash. - function getTransactionHash( - address to, - uint256 value, - bytes memory data, - Enum.Operation operation, - uint256 safeTxGas, - uint256 baseGas, - uint256 gasPrice, - address gasToken, - address refundReceiver, - uint256 _nonce - ) - public - view - returns (bytes32) - { - return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce)); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/Migrations.sol b/packages/protocol-kit/contracts/safe_V1_2_0/Migrations.sol deleted file mode 100644 index 9ffe9a1d5..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/Migrations.sol +++ /dev/null @@ -1,31 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -contract Migrations { - address public owner; - uint public last_completed_migration; - - modifier restricted() { - if (msg.sender == owner) _; - } - - constructor() - public - { - owner = msg.sender; - } - - function setCompleted(uint completed) - public - restricted - { - last_completed_migration = completed; - } - - function upgrade(address new_address) - public - restricted - { - Migrations upgraded = Migrations(new_address); - upgraded.setCompleted(last_completed_migration); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/base/Executor.sol b/packages/protocol-kit/contracts/safe_V1_2_0/base/Executor.sol deleted file mode 100644 index 293c74799..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/base/Executor.sol +++ /dev/null @@ -1,40 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../common/Enum.sol"; - - -/// @title Executor - A contract that can execute transactions -/// @author Richard Meissner - -contract Executor { - - function execute(address to, uint256 value, bytes memory data, Enum.Operation operation, uint256 txGas) - internal - returns (bool success) - { - if (operation == Enum.Operation.Call) - success = executeCall(to, value, data, txGas); - else if (operation == Enum.Operation.DelegateCall) - success = executeDelegateCall(to, data, txGas); - else - success = false; - } - - function executeCall(address to, uint256 value, bytes memory data, uint256 txGas) - internal - returns (bool success) - { - // solium-disable-next-line security/no-inline-assembly - assembly { - success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0) - } - } - - function executeDelegateCall(address to, bytes memory data, uint256 txGas) - internal - returns (bool success) - { - // solium-disable-next-line security/no-inline-assembly - assembly { - success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0) - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/base/FallbackManager.sol b/packages/protocol-kit/contracts/safe_V1_2_0/base/FallbackManager.sol deleted file mode 100644 index 8de981c45..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/base/FallbackManager.sol +++ /dev/null @@ -1,57 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -import "../common/SelfAuthorized.sol"; - -/// @title Fallback Manager - A contract that manages fallback calls made to this contract -/// @author Richard Meissner - -contract FallbackManager is SelfAuthorized { - - // keccak256("fallback_manager.handler.address") - bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5; - - function internalSetFallbackHandler(address handler) internal { - bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT; - // solium-disable-next-line security/no-inline-assembly - assembly { - sstore(slot, handler) - } - } - - /// @dev Allows to add a contract to handle fallback calls. - /// Only fallback calls without value and with data will be forwarded. - /// This can only be done via a Safe transaction. - /// @param handler contract to handle fallbacks calls. - function setFallbackHandler(address handler) - public - authorized - { - internalSetFallbackHandler(handler); - } - - function () - external - payable - { - // Only calls without value and with data will be forwarded - if (msg.value > 0 || msg.data.length == 0) { - return; - } - bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT; - address handler; - // solium-disable-next-line security/no-inline-assembly - assembly { - handler := sload(slot) - } - - if (handler != address(0)) { - // solium-disable-next-line security/no-inline-assembly - assembly { - calldatacopy(0, 0, calldatasize()) - let success := call(gas, handler, 0, 0, calldatasize(), 0, 0) - returndatacopy(0, 0, returndatasize()) - if eq(success, 0) { revert(0, returndatasize()) } - return(0, returndatasize()) - } - } - } -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/base/Module.sol b/packages/protocol-kit/contracts/safe_V1_2_0/base/Module.sol deleted file mode 100644 index 298fc41ca..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/base/Module.sol +++ /dev/null @@ -1,26 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../common/MasterCopy.sol"; -import "./ModuleManager.sol"; - - -/// @title Module - Base class for modules. -/// @author Stefan George - -/// @author Richard Meissner - -contract Module is MasterCopy { - - ModuleManager public manager; - - modifier authorized() { - require(msg.sender == address(manager), "Method can only be called from manager"); - _; - } - - function setManager() - internal - { - // manager can only be 0 at initalization of contract. - // Check ensures that setup function can only be called once. - require(address(manager) == address(0), "Manager has already been set"); - manager = ModuleManager(msg.sender); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/base/ModuleManager.sol b/packages/protocol-kit/contracts/safe_V1_2_0/base/ModuleManager.sol deleted file mode 100644 index b8a2a0243..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/base/ModuleManager.sol +++ /dev/null @@ -1,157 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../common/Enum.sol"; -import "../common/SelfAuthorized.sol"; -import "./Executor.sol"; -import "./Module.sol"; - - -/// @title Module Manager - A contract that manages modules that can execute transactions via this contract -/// @author Stefan George - -/// @author Richard Meissner - -contract ModuleManager is SelfAuthorized, Executor { - - event EnabledModule(Module module); - event DisabledModule(Module module); - event ExecutionFromModuleSuccess(address indexed module); - event ExecutionFromModuleFailure(address indexed module); - - address internal constant SENTINEL_MODULES = address(0x1); - - mapping (address => address) internal modules; - - function setupModules(address to, bytes memory data) - internal - { - require(modules[SENTINEL_MODULES] == address(0), "Modules have already been initialized"); - modules[SENTINEL_MODULES] = SENTINEL_MODULES; - if (to != address(0)) - // Setup has to complete successfully or transaction fails. - require(executeDelegateCall(to, data, gasleft()), "Could not finish initialization"); - } - - /// @dev Allows to add a module to the whitelist. - /// This can only be done via a Safe transaction. - /// @notice Enables the module `module` for the Safe. - /// @param module Module to be whitelisted. - function enableModule(Module module) - public - authorized - { - // Module address cannot be null or sentinel. - require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); - // Module cannot be added twice. - require(modules[address(module)] == address(0), "Module has already been added"); - modules[address(module)] = modules[SENTINEL_MODULES]; - modules[SENTINEL_MODULES] = address(module); - emit EnabledModule(module); - } - - /// @dev Allows to remove a module from the whitelist. - /// This can only be done via a Safe transaction. - /// @notice Disables the module `module` for the Safe. - /// @param prevModule Module that pointed to the module to be removed in the linked list - /// @param module Module to be removed. - function disableModule(Module prevModule, Module module) - public - authorized - { - // Validate module address and check that it corresponds to module index. - require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided"); - require(modules[address(prevModule)] == address(module), "Invalid prevModule, module pair provided"); - modules[address(prevModule)] = modules[address(module)]; - modules[address(module)] = address(0); - emit DisabledModule(module); - } - - /// @dev Allows a Module to execute a Safe transaction without any further confirmations. - /// @param to Destination address of module transaction. - /// @param value Ether value of module transaction. - /// @param data Data payload of module transaction. - /// @param operation Operation type of module transaction. - function execTransactionFromModule(address to, uint256 value, bytes memory data, Enum.Operation operation) - public - returns (bool success) - { - // Only whitelisted modules are allowed. - require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), "Method can only be called from an enabled module"); - // Execute transaction without further confirmations. - success = execute(to, value, data, operation, gasleft()); - if (success) emit ExecutionFromModuleSuccess(msg.sender); - else emit ExecutionFromModuleFailure(msg.sender); - } - - /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data - /// @param to Destination address of module transaction. - /// @param value Ether value of module transaction. - /// @param data Data payload of module transaction. - /// @param operation Operation type of module transaction. - function execTransactionFromModuleReturnData(address to, uint256 value, bytes memory data, Enum.Operation operation) - public - returns (bool success, bytes memory returnData) - { - success = execTransactionFromModule(to, value, data, operation); - // solium-disable-next-line security/no-inline-assembly - assembly { - // Load free memory location - let ptr := mload(0x40) - // We allocate memory for the return data by setting the free memory location to - // current free memory location + data size + 32 bytes for data size value - mstore(0x40, add(ptr, add(returndatasize(), 0x20))) - // Store the size - mstore(ptr, returndatasize()) - // Store the data - returndatacopy(add(ptr, 0x20), 0, returndatasize()) - // Point the return data to the correct memory location - returnData := ptr - } - } - - /// @dev Returns if an module is enabled - /// @return True if the module is enabled - function isModuleEnabled(Module module) - public - view - returns (bool) - { - return SENTINEL_MODULES != address(module) && modules[address(module)] != address(0); - } - - /// @dev Returns array of first 10 modules. - /// @return Array of modules. - function getModules() - public - view - returns (address[] memory) - { - (address[] memory array,) = getModulesPaginated(SENTINEL_MODULES, 10); - return array; - } - - /// @dev Returns array of modules. - /// @param start Start of the page. - /// @param pageSize Maximum number of modules that should be returned. - /// @return Array of modules. - function getModulesPaginated(address start, uint256 pageSize) - public - view - returns (address[] memory array, address next) - { - // Init array with max page size - array = new address[](pageSize); - - // Populate return array - uint256 moduleCount = 0; - address currentModule = modules[start]; - while(currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) { - array[moduleCount] = currentModule; - currentModule = modules[currentModule]; - moduleCount++; - } - next = currentModule; - // Set correct size of returned array - // solium-disable-next-line security/no-inline-assembly - assembly { - mstore(array, moduleCount) - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/base/OwnerManager.sol b/packages/protocol-kit/contracts/safe_V1_2_0/base/OwnerManager.sol deleted file mode 100644 index 647b7b6b1..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/base/OwnerManager.sol +++ /dev/null @@ -1,169 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../common/SelfAuthorized.sol"; - -/// @title OwnerManager - Manages a set of owners and a threshold to perform actions. -/// @author Stefan George - -/// @author Richard Meissner - -contract OwnerManager is SelfAuthorized { - - event AddedOwner(address owner); - event RemovedOwner(address owner); - event ChangedThreshold(uint256 threshold); - - address internal constant SENTINEL_OWNERS = address(0x1); - - mapping(address => address) internal owners; - uint256 ownerCount; - uint256 internal threshold; - - /// @dev Setup function sets initial storage of contract. - /// @param _owners List of Safe owners. - /// @param _threshold Number of required confirmations for a Safe transaction. - function setupOwners(address[] memory _owners, uint256 _threshold) - internal - { - // Threshold can only be 0 at initialization. - // Check ensures that setup function can only be called once. - require(threshold == 0, "Owners have already been setup"); - // Validate that threshold is smaller than number of added owners. - require(_threshold <= _owners.length, "Threshold cannot exceed owner count"); - // There has to be at least one Safe owner. - require(_threshold >= 1, "Threshold needs to be greater than 0"); - // Initializing Safe owners. - address currentOwner = SENTINEL_OWNERS; - for (uint256 i = 0; i < _owners.length; i++) { - // Owner address cannot be null. - address owner = _owners[i]; - require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); - // No duplicate owners allowed. - require(owners[owner] == address(0), "Duplicate owner address provided"); - owners[currentOwner] = owner; - currentOwner = owner; - } - owners[currentOwner] = SENTINEL_OWNERS; - ownerCount = _owners.length; - threshold = _threshold; - } - - /// @dev Allows to add a new owner to the Safe and update the threshold at the same time. - /// This can only be done via a Safe transaction. - /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`. - /// @param owner New owner address. - /// @param _threshold New threshold. - function addOwnerWithThreshold(address owner, uint256 _threshold) - public - authorized - { - // Owner address cannot be null. - require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); - // No duplicate owners allowed. - require(owners[owner] == address(0), "Address is already an owner"); - owners[owner] = owners[SENTINEL_OWNERS]; - owners[SENTINEL_OWNERS] = owner; - ownerCount++; - emit AddedOwner(owner); - // Change threshold if threshold was changed. - if (threshold != _threshold) - changeThreshold(_threshold); - } - - /// @dev Allows to remove an owner from the Safe and update the threshold at the same time. - /// This can only be done via a Safe transaction. - /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`. - /// @param prevOwner Owner that pointed to the owner to be removed in the linked list - /// @param owner Owner address to be removed. - /// @param _threshold New threshold. - function removeOwner(address prevOwner, address owner, uint256 _threshold) - public - authorized - { - // Only allow to remove an owner, if threshold can still be reached. - require(ownerCount - 1 >= _threshold, "New owner count needs to be larger than new threshold"); - // Validate owner address and check that it corresponds to owner index. - require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided"); - require(owners[prevOwner] == owner, "Invalid prevOwner, owner pair provided"); - owners[prevOwner] = owners[owner]; - owners[owner] = address(0); - ownerCount--; - emit RemovedOwner(owner); - // Change threshold if threshold was changed. - if (threshold != _threshold) - changeThreshold(_threshold); - } - - /// @dev Allows to swap/replace an owner from the Safe with another address. - /// This can only be done via a Safe transaction. - /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`. - /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list - /// @param oldOwner Owner address to be replaced. - /// @param newOwner New owner address. - function swapOwner(address prevOwner, address oldOwner, address newOwner) - public - authorized - { - // Owner address cannot be null. - require(newOwner != address(0) && newOwner != SENTINEL_OWNERS, "Invalid owner address provided"); - // No duplicate owners allowed. - require(owners[newOwner] == address(0), "Address is already an owner"); - // Validate oldOwner address and check that it corresponds to owner index. - require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, "Invalid owner address provided"); - require(owners[prevOwner] == oldOwner, "Invalid prevOwner, owner pair provided"); - owners[newOwner] = owners[oldOwner]; - owners[prevOwner] = newOwner; - owners[oldOwner] = address(0); - emit RemovedOwner(oldOwner); - emit AddedOwner(newOwner); - } - - /// @dev Allows to update the number of required confirmations by Safe owners. - /// This can only be done via a Safe transaction. - /// @notice Changes the threshold of the Safe to `_threshold`. - /// @param _threshold New threshold. - function changeThreshold(uint256 _threshold) - public - authorized - { - // Validate that threshold is smaller than number of owners. - require(_threshold <= ownerCount, "Threshold cannot exceed owner count"); - // There has to be at least one Safe owner. - require(_threshold >= 1, "Threshold needs to be greater than 0"); - threshold = _threshold; - emit ChangedThreshold(threshold); - } - - function getThreshold() - public - view - returns (uint256) - { - return threshold; - } - - function isOwner(address owner) - public - view - returns (bool) - { - return owner != SENTINEL_OWNERS && owners[owner] != address(0); - } - - /// @dev Returns array of owners. - /// @return Array of Safe owners. - function getOwners() - public - view - returns (address[] memory) - { - address[] memory array = new address[](ownerCount); - - // populate return array - uint256 index = 0; - address currentOwner = owners[SENTINEL_OWNERS]; - while(currentOwner != SENTINEL_OWNERS) { - array[index] = currentOwner; - currentOwner = owners[currentOwner]; - index ++; - } - return array; - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/common/Enum.sol b/packages/protocol-kit/contracts/safe_V1_2_0/common/Enum.sol deleted file mode 100644 index 3288682a4..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/common/Enum.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title Enum - Collection of enums -/// @author Richard Meissner - -contract Enum { - enum Operation { - Call, - DelegateCall - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol b/packages/protocol-kit/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol deleted file mode 100644 index 7fddb9a28..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol +++ /dev/null @@ -1,15 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments -/// @author Richard Meissner - -contract EtherPaymentFallback { - - /// @dev Fallback function accepts Ether transactions. - function () - external - payable - { - - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/common/MasterCopy.sol b/packages/protocol-kit/contracts/safe_V1_2_0/common/MasterCopy.sol deleted file mode 100644 index d98cd3776..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/common/MasterCopy.sol +++ /dev/null @@ -1,27 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "./SelfAuthorized.sol"; - - -/// @title MasterCopy - Base for master copy contracts (should always be first super contract) -/// This contract is tightly coupled to our proxy contract (see `proxies/GnosisSafeProxy.sol`) -/// @author Richard Meissner - -contract MasterCopy is SelfAuthorized { - - event ChangedMasterCopy(address masterCopy); - - // masterCopy always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract. - // It should also always be ensured that the address is stored alone (uses a full word) - address private masterCopy; - - /// @dev Allows to upgrade the contract. This can only be done via a Safe transaction. - /// @param _masterCopy New contract address. - function changeMasterCopy(address _masterCopy) - public - authorized - { - // Master copy address cannot be null. - require(_masterCopy != address(0), "Invalid master copy address provided"); - masterCopy = _masterCopy; - emit ChangedMasterCopy(_masterCopy); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol b/packages/protocol-kit/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol deleted file mode 100644 index 1ba688e9f..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol +++ /dev/null @@ -1,33 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title SecuredTokenTransfer - Secure token transfer -/// @author Richard Meissner - -contract SecuredTokenTransfer { - - /// @dev Transfers a token and returns if it was a success - /// @param token Token that should be transferred - /// @param receiver Receiver to whom the token should be transferred - /// @param amount The amount of tokens that should be transferred - function transferToken ( - address token, - address receiver, - uint256 amount - ) - internal - returns (bool transferred) - { - bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", receiver, amount); - // solium-disable-next-line security/no-inline-assembly - assembly { - let success := call(sub(gas, 10000), token, 0, add(data, 0x20), mload(data), 0, 0) - let ptr := mload(0x40) - mstore(0x40, add(ptr, returndatasize())) - returndatacopy(ptr, 0, returndatasize()) - switch returndatasize() - case 0 { transferred := success } - case 0x20 { transferred := iszero(or(iszero(success), iszero(mload(ptr)))) } - default { transferred := 0 } - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/common/SelfAuthorized.sol b/packages/protocol-kit/contracts/safe_V1_2_0/common/SelfAuthorized.sol deleted file mode 100644 index d5892fcf9..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/common/SelfAuthorized.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title SelfAuthorized - authorizes current contract to perform actions -/// @author Richard Meissner - -contract SelfAuthorized { - modifier authorized() { - require(msg.sender == address(this), "Method can only be called from this contract"); - _; - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/common/SignatureDecoder.sol b/packages/protocol-kit/contracts/safe_V1_2_0/common/SignatureDecoder.sol deleted file mode 100644 index 87020c465..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/common/SignatureDecoder.sol +++ /dev/null @@ -1,54 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title SignatureDecoder - Decodes signatures that a encoded as bytes -/// @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) -/// @author Richard Meissner - -contract SignatureDecoder { - - /// @dev Recovers address who signed the message - /// @param messageHash operation ethereum signed message hash - /// @param messageSignature message `txHash` signature - /// @param pos which signature to read - function recoverKey ( - bytes32 messageHash, - bytes memory messageSignature, - uint256 pos - ) - internal - pure - returns (address) - { - uint8 v; - bytes32 r; - bytes32 s; - (v, r, s) = signatureSplit(messageSignature, pos); - return ecrecover(messageHash, v, r, s); - } - - /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`. - /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures - /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access - /// @param signatures concatenated rsv signatures - function signatureSplit(bytes memory signatures, uint256 pos) - internal - pure - returns (uint8 v, bytes32 r, bytes32 s) - { - // The signature format is a compact form of: - // {bytes32 r}{bytes32 s}{uint8 v} - // Compact means, uint8 is not padded to 32 bytes. - // solium-disable-next-line security/no-inline-assembly - assembly { - let signaturePos := mul(0x41, pos) - r := mload(add(signatures, add(signaturePos, 0x20))) - s := mload(add(signatures, add(signaturePos, 0x40))) - // Here we are loading the last 32 bytes, including 31 bytes - // of 's'. There is no 'mload8' to do this. - // - // 'byte' is not working due to the Solidity parser, so lets - // use the second best option, 'and' - v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff) - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/external/GnosisSafeMath.sol b/packages/protocol-kit/contracts/safe_V1_2_0/external/GnosisSafeMath.sol deleted file mode 100644 index 1f884de6b..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/external/GnosisSafeMath.sol +++ /dev/null @@ -1,75 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -/** - * @title GnosisSafeMath - * @dev Math operations with safety checks that revert on error - * Renamed from SafeMath to GnosisSafeMath to avoid conflicts - * TODO: remove once open zeppelin update to solc 0.5.0 - */ -library GnosisSafeMath { - - /** - * @dev Multiplies two numbers, reverts on overflow. - */ - function mul(uint256 a, uint256 b) internal pure returns (uint256) { - // Gas optimization: this is cheaper than requiring 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - if (a == 0) { - return 0; - } - - uint256 c = a * b; - require(c / a == b); - - return c; - } - - /** - * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. - */ - function div(uint256 a, uint256 b) internal pure returns (uint256) { - require(b > 0); // Solidity only automatically asserts when dividing by 0 - uint256 c = a / b; - // assert(a == b * c + a % b); // There is no case in which this doesn't hold - - return c; - } - - /** - * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). - */ - function sub(uint256 a, uint256 b) internal pure returns (uint256) { - require(b <= a); - uint256 c = a - b; - - return c; - } - - /** - * @dev Adds two numbers, reverts on overflow. - */ - function add(uint256 a, uint256 b) internal pure returns (uint256) { - uint256 c = a + b; - require(c >= a); - - return c; - } - - /** - * @dev Divides two numbers and returns the remainder (unsigned integer modulo), - * reverts when dividing by zero. - */ - function mod(uint256 a, uint256 b) internal pure returns (uint256) { - require(b != 0); - return a % b; - } - - - /** - * @dev Returns the largest of two numbers. - */ - function max(uint256 a, uint256 b) internal pure returns (uint256) { - return a >= b ? a : b; - } -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol b/packages/protocol-kit/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol deleted file mode 100644 index 03058d1b0..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol +++ /dev/null @@ -1,40 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -import "../interfaces/ERC1155TokenReceiver.sol"; -import "../interfaces/ERC721TokenReceiver.sol"; -import "../interfaces/ERC777TokensRecipient.sol"; - -/// @title Default Callback Handler - returns true for known token callbacks -/// @author Richard Meissner - -contract DefaultCallbackHandler is ERC1155TokenReceiver, ERC777TokensRecipient, ERC721TokenReceiver { - - string public constant NAME = "Default Callback Handler"; - string public constant VERSION = "1.0.0"; - - function onERC1155Received(address, address, uint256, uint256, bytes calldata) - external - returns(bytes4) - { - return 0xf23a6e61; - } - - function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) - external - returns(bytes4) - { - return 0xbc197c81; - } - - function onERC721Received(address, address, uint256, bytes calldata) - external - returns(bytes4) - { - return 0x150b7a02; - } - - // solium-disable-next-line no-empty-blocks - function tokensReceived(address, address, address, uint256, bytes calldata, bytes calldata) external { - // We implement this for completeness, doesn't really have any value - } - -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol b/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol deleted file mode 100644 index 56c72cdff..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol +++ /dev/null @@ -1,36 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -/** - Note: The ERC-165 identifier for this interface is 0x4e2312e0. -*/ -interface ERC1155TokenReceiver { - /** - @notice Handle the receipt of a single ERC1155 token type. - @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeTransferFrom` after the balance has been updated. - This function MUST return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61) if it accepts the transfer. - This function MUST revert if it rejects the transfer. - Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. - @param _operator The address which initiated the transfer (i.e. msg.sender) - @param _from The address which previously owned the token - @param _id The ID of the token being transferred - @param _value The amount of tokens being transferred - @param _data Additional data with no specified format - @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` - */ - function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _value, bytes calldata _data) external returns(bytes4); - - /** - @notice Handle the receipt of multiple ERC1155 token types. - @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated. - This function MUST return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81) if it accepts the transfer(s). - This function MUST revert if it rejects the transfer(s). - Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. - @param _operator The address which initiated the batch transfer (i.e. msg.sender) - @param _from The address which previously owned the token - @param _ids An array containing ids of each token being transferred (order and length must match _values array) - @param _values An array containing amounts of each token being transferred (order and length must match _ids array) - @param _data Additional data with no specified format - @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` - */ - function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external returns(bytes4); -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol b/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol deleted file mode 100644 index 2bf050bac..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol +++ /dev/null @@ -1,18 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02. -interface ERC721TokenReceiver { - /// @notice Handle the receipt of an NFT - /// @dev The ERC721 smart contract calls this function on the recipient - /// after a `transfer`. This function MAY throw to revert and reject the - /// transfer. Return of other than the magic value MUST result in the - /// transaction being reverted. - /// Note: the contract address is always the message sender. - /// @param _operator The address which called `safeTransferFrom` function - /// @param _from The address which previously owned the token - /// @param _tokenId The NFT identifier which is being transferred - /// @param _data Additional data with no specified format - /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` - /// unless throwing - function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external returns(bytes4); -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol b/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol deleted file mode 100644 index b8c471377..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol +++ /dev/null @@ -1,12 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -interface ERC777TokensRecipient { - function tokensReceived( - address operator, - address from, - address to, - uint256 amount, - bytes calldata data, - bytes calldata operatorData - ) external; -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol b/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol deleted file mode 100644 index ff8a7478f..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol +++ /dev/null @@ -1,25 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -contract ISignatureValidatorConstants { - // bytes4(keccak256("isValidSignature(bytes,bytes)") - bytes4 constant internal EIP1271_MAGIC_VALUE = 0x20c13b0b; -} - -contract ISignatureValidator is ISignatureValidatorConstants { - - /** - * @dev Should return whether the signature provided is valid for the provided data - * @param _data Arbitrary length data signed on the behalf of address(this) - * @param _signature Signature byte array associated with _data - * - * MUST return the bytes4 magic value 0x20c13b0b when function passes. - * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5) - * MUST allow external calls - */ - function isValidSignature( - bytes memory _data, - bytes memory _signature) - public - view - returns (bytes4); -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol b/packages/protocol-kit/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol deleted file mode 100644 index f0ca1d8a9..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol +++ /dev/null @@ -1,43 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../base/Module.sol"; - - -/// @title Create and Add Modules - Allows to create and add multiple module in one transaction. -/// @author Stefan George - -/// @author Richard Meissner - -contract CreateAndAddModules { - - /// @dev Function required to compile contract. Gnosis Safe function is called instead. - /// @param module Not used. - function enableModule(Module module) - public - { - revert(); - } - - /// @dev Allows to create and add multiple module in one transaction. - /// @param proxyFactory Module proxy factory contract. - /// @param data Modules constructor payload. This is the data for each proxy factory call concatinated. (e.g. ) - function createAndAddModules(address proxyFactory, bytes memory data) - public - { - uint256 length = data.length; - Module module; - uint256 i = 0; - while (i < length) { - // solium-disable-next-line security/no-inline-assembly - assembly { - let createBytesLength := mload(add(0x20, add(data, i))) - let createBytes := add(0x40, add(data, i)) - - let output := mload(0x40) - if eq(delegatecall(gas, proxyFactory, createBytes, createBytesLength, output, 0x20), 0) { revert(0, 0) } - module := and(mload(output), 0xffffffffffffffffffffffffffffffffffffffff) - - // Data is always padded to 32 bytes - i := add(i, add(0x20, mul(div(add(createBytesLength, 0x1f), 0x20), 0x20))) - } - this.enableModule(module); - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/libraries/CreateCall.sol b/packages/protocol-kit/contracts/safe_V1_2_0/libraries/CreateCall.sol deleted file mode 100644 index 9e1564557..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/libraries/CreateCall.sol +++ /dev/null @@ -1,26 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title Create Call - Allows to use the different create opcodes to deploy a contract -/// @author Richard Meissner - -contract CreateCall { - event ContractCreation(address newContract); - - function performCreate2(uint256 value, bytes memory deploymentData, bytes32 salt) public returns(address newContract) { - // solium-disable-next-line security/no-inline-assembly - assembly { - newContract := create2(value, add(0x20, deploymentData), mload(deploymentData), salt) - } - require(newContract != address(0), "Could not deploy contract"); - emit ContractCreation(newContract); - } - - function performCreate(uint256 value, bytes memory deploymentData) public returns(address newContract) { - // solium-disable-next-line security/no-inline-assembly - assembly { - newContract := create(value, add(deploymentData, 0x20), mload(deploymentData)) - } - require(newContract != address(0), "Could not deploy contract"); - emit ContractCreation(newContract); - } -} \ No newline at end of file diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/libraries/MultiSend.sol b/packages/protocol-kit/contracts/safe_V1_2_0/libraries/MultiSend.sol deleted file mode 100644 index 8bfe010ca..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/libraries/MultiSend.sol +++ /dev/null @@ -1,59 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - - -/// @title Multi Send - Allows to batch multiple transactions into one. -/// @author Nick Dodson - -/// @author Gonçalo Sá - -/// @author Stefan George - -/// @author Richard Meissner - -contract MultiSend { - - bytes32 constant private GUARD_VALUE = keccak256("multisend.guard.bytes32"); - - bytes32 guard; - - constructor() public { - guard = GUARD_VALUE; - } - - /// @dev Sends multiple transactions and reverts all if one fails. - /// @param transactions Encoded transactions. Each transaction is encoded as a packed bytes of - /// operation as a uint8 with 0 for a call or 1 for a delegatecall (=> 1 byte), - /// to as a address (=> 20 bytes), - /// value as a uint256 (=> 32 bytes), - /// data length as a uint256 (=> 32 bytes), - /// data as bytes. - /// see abi.encodePacked for more information on packed encoding - function multiSend(bytes memory transactions) - public - { - require(guard != GUARD_VALUE, "MultiSend should only be called via delegatecall"); - // solium-disable-next-line security/no-inline-assembly - assembly { - let length := mload(transactions) - let i := 0x20 - for { } lt(i, length) { } { - // First byte of the data is the operation. - // We shift by 248 bits (256 - 8 [operation byte]) it right since mload will always load 32 bytes (a word). - // This will also zero out unused data. - let operation := shr(0xf8, mload(add(transactions, i))) - // We offset the load address by 1 byte (operation byte) - // We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data. - let to := shr(0x60, mload(add(transactions, add(i, 0x01)))) - // We offset the load address by 21 byte (operation byte + 20 address bytes) - let value := mload(add(transactions, add(i, 0x15))) - // We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes) - let dataLength := mload(add(transactions, add(i, 0x35))) - // We offset the load address by 85 byte (operation byte + 20 address bytes + 32 value bytes + 32 data length bytes) - let data := add(transactions, add(i, 0x55)) - let success := 0 - switch operation - case 0 { success := call(gas, to, value, data, dataLength, 0, 0) } - case 1 { success := delegatecall(gas, to, data, dataLength, 0, 0) } - if eq(success, 0) { revert(0, 0) } - // Next entry starts at 85 byte + data length - i := add(i, add(0x55, dataLength)) - } - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/modules/DailyLimitModule.sol b/packages/protocol-kit/contracts/safe_V1_2_0/modules/DailyLimitModule.sol deleted file mode 100644 index eb1945747..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/modules/DailyLimitModule.sol +++ /dev/null @@ -1,92 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../base/Module.sol"; -import "../base/ModuleManager.sol"; -import "../base/OwnerManager.sol"; -import "../common/Enum.sol"; - - -/// @title Daily Limit Module - Allows to transfer limited amounts of ERC20 tokens and Ether without confirmations. -/// @author Stefan George - -contract DailyLimitModule is Module { - - string public constant NAME = "Daily Limit Module"; - string public constant VERSION = "0.1.0"; - - // dailyLimits mapping maps token address to daily limit settings. - mapping (address => DailyLimit) public dailyLimits; - - struct DailyLimit { - uint256 dailyLimit; - uint256 spentToday; - uint256 lastDay; - } - - /// @dev Setup function sets initial storage of contract. - /// @param tokens List of token addresses. Ether is represented with address 0x0. - /// @param _dailyLimits List of daily limits in smalles units (e.g. Wei for Ether). - function setup(address[] memory tokens, uint256[] memory _dailyLimits) - public - { - setManager(); - for (uint256 i = 0; i < tokens.length; i++) - dailyLimits[tokens[i]].dailyLimit = _dailyLimits[i]; - } - - /// @dev Allows to update the daily limit for a specified token. This can only be done via a Safe transaction. - /// @param token Token contract address. - /// @param dailyLimit Daily limit in smallest token unit. - function changeDailyLimit(address token, uint256 dailyLimit) - public - authorized - { - dailyLimits[token].dailyLimit = dailyLimit; - } - - /// @dev Returns if Safe transaction is a valid daily limit transaction. - /// @param token Address of the token that should be transfered (0 for Ether) - /// @param to Address to which the tokens should be transfered - /// @param amount Amount of tokens (or Ether) that should be transfered - /// @return Returns if transaction can be executed. - function executeDailyLimit(address token, address to, uint256 amount) - public - { - // Only Safe owners are allowed to execute daily limit transactions. - require(OwnerManager(address(manager)).isOwner(msg.sender), "Method can only be called by an owner"); - require(to != address(0), "Invalid to address provided"); - require(amount > 0, "Invalid amount provided"); - // Validate that transfer is not exceeding daily limit. - require(isUnderLimit(token, amount), "Daily limit has been reached"); - dailyLimits[token].spentToday += amount; - if (token == address(0)) { - require(manager.execTransactionFromModule(to, amount, "", Enum.Operation.Call), "Could not execute ether transfer"); - } else { - bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", to, amount); - require(manager.execTransactionFromModule(token, 0, data, Enum.Operation.Call), "Could not execute token transfer"); - } - } - - function isUnderLimit(address token, uint256 amount) - internal - returns (bool) - { - DailyLimit storage dailyLimit = dailyLimits[token]; - if (today() > dailyLimit.lastDay) { - dailyLimit.lastDay = today(); - dailyLimit.spentToday = 0; - } - if (dailyLimit.spentToday + amount <= dailyLimit.dailyLimit && - dailyLimit.spentToday + amount > dailyLimit.spentToday) - return true; - return false; - } - - /// @dev Returns last midnight as Unix timestamp. - /// @return Unix timestamp. - function today() - public - view - returns (uint) - { - return now - (now % 1 days); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol b/packages/protocol-kit/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol deleted file mode 100644 index 63f211b3c..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol +++ /dev/null @@ -1,105 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../base/Module.sol"; -import "../base/ModuleManager.sol"; -import "../base/OwnerManager.sol"; -import "../common/Enum.sol"; - - -/// @title Social Recovery Module - Allows to replace an owner without Safe confirmations if friends approve the replacement. -/// @author Stefan George - -contract SocialRecoveryModule is Module { - - string public constant NAME = "Social Recovery Module"; - string public constant VERSION = "0.1.0"; - - uint256 public threshold; - address[] public friends; - - // isFriend mapping maps friend's address to friend status. - mapping (address => bool) public isFriend; - // isExecuted mapping maps data hash to execution status. - mapping (bytes32 => bool) public isExecuted; - // isConfirmed mapping maps data hash to friend's address to confirmation status. - mapping (bytes32 => mapping (address => bool)) public isConfirmed; - - modifier onlyFriend() { - require(isFriend[msg.sender], "Method can only be called by a friend"); - _; - } - - /// @dev Setup function sets initial storage of contract. - /// @param _friends List of friends' addresses. - /// @param _threshold Required number of friends to confirm replacement. - function setup(address[] memory _friends, uint256 _threshold) - public - { - require(_threshold <= _friends.length, "Threshold cannot exceed friends count"); - require(_threshold >= 2, "At least 2 friends required"); - setManager(); - // Set allowed friends. - for (uint256 i = 0; i < _friends.length; i++) { - address friend = _friends[i]; - require(friend != address(0), "Invalid friend address provided"); - require(!isFriend[friend], "Duplicate friend address provided"); - isFriend[friend] = true; - } - friends = _friends; - threshold = _threshold; - } - - /// @dev Allows a friend to confirm a Safe transaction. - /// @param dataHash Safe transaction hash. - function confirmTransaction(bytes32 dataHash) - public - onlyFriend - { - require(!isExecuted[dataHash], "Recovery already executed"); - isConfirmed[dataHash][msg.sender] = true; - } - - /// @dev Returns if Safe transaction is a valid owner replacement transaction. - /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list - /// @param oldOwner Owner address to be replaced. - /// @param newOwner New owner address. - /// @return Returns if transaction can be executed. - function recoverAccess(address prevOwner, address oldOwner, address newOwner) - public - onlyFriend - { - bytes memory data = abi.encodeWithSignature("swapOwner(address,address,address)", prevOwner, oldOwner, newOwner); - bytes32 dataHash = getDataHash(data); - require(!isExecuted[dataHash], "Recovery already executed"); - require(isConfirmedByRequiredFriends(dataHash), "Recovery has not enough confirmations"); - isExecuted[dataHash] = true; - require(manager.execTransactionFromModule(address(manager), 0, data, Enum.Operation.Call), "Could not execute recovery"); - } - - /// @dev Returns if Safe transaction is a valid owner replacement transaction. - /// @param dataHash Data hash. - /// @return Confirmation status. - function isConfirmedByRequiredFriends(bytes32 dataHash) - public - view - returns (bool) - { - uint256 confirmationCount; - for (uint256 i = 0; i < friends.length; i++) { - if (isConfirmed[dataHash][friends[i]]) - confirmationCount++; - if (confirmationCount == threshold) - return true; - } - return false; - } - - /// @dev Returns hash of data encoding owner replacement. - /// @param data Data payload. - /// @return Data hash. - function getDataHash(bytes memory data) - public - pure - returns (bytes32) - { - return keccak256(data); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/modules/StateChannelModule.sol b/packages/protocol-kit/contracts/safe_V1_2_0/modules/StateChannelModule.sol deleted file mode 100644 index 68a8e1bd0..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/modules/StateChannelModule.sol +++ /dev/null @@ -1,89 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../base/Module.sol"; -import "../base/OwnerManager.sol"; -import "../common/Enum.sol"; -import "../common/SignatureDecoder.sol"; - - -/// @title Gnosis Safe State Module - A module that allows interaction with statechannels. -/// @author Stefan George - -/// @author Richard Meissner - -contract StateChannelModule is Module, SignatureDecoder { - - string public constant NAME = "State Channel Module"; - string public constant VERSION = "0.1.0"; - - // isExecuted mapping allows to check if a transaction (by hash) was already executed. - mapping (bytes32 => uint256) public isExecuted; - - /// @dev Setup function sets manager - function setup() - public - { - setManager(); - } - - /// @dev Allows to execute a Safe transaction confirmed by required number of owners. - /// @param to Destination address of Safe transaction. - /// @param value Ether value of Safe transaction. - /// @param data Data payload of Safe transaction. - /// @param operation Operation type of Safe transaction. - /// @param nonce Nonce used for this Safe transaction. - /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v}) - function execTransaction( - address to, - uint256 value, - bytes memory data, - Enum.Operation operation, - uint256 nonce, - bytes memory signatures - ) - public - { - bytes32 transactionHash = getTransactionHash(to, value, data, operation, nonce); - require(isExecuted[transactionHash] == 0, "Transaction already executed"); - checkHash(transactionHash, signatures); - // Mark as executed and execute transaction. - isExecuted[transactionHash] = 1; - require(manager.execTransactionFromModule(to, value, data, operation), "Could not execute transaction"); - } - - function checkHash(bytes32 transactionHash, bytes memory signatures) - internal - view - { - // There cannot be an owner with address 0. - address lastOwner = address(0); - address currentOwner; - uint256 i; - uint256 threshold = OwnerManager(address(manager)).getThreshold(); - // Validate threshold is reached. - for (i = 0; i < threshold; i++) { - currentOwner = recoverKey(transactionHash, signatures, i); - require(OwnerManager(address(manager)).isOwner(currentOwner), "Signature not provided by owner"); - require(currentOwner > lastOwner, "Signatures are not ordered by owner address"); - lastOwner = currentOwner; - } - } - - /// @dev Returns hash to be signed by owners. - /// @param to Destination address. - /// @param value Ether value. - /// @param data Data payload. - /// @param operation Operation type. - /// @param nonce Transaction nonce. - /// @return Transaction hash. - function getTransactionHash( - address to, - uint256 value, - bytes memory data, - Enum.Operation operation, - uint256 nonce - ) - public - view - returns (bytes32) - { - return keccak256(abi.encodePacked(byte(0x19), byte(0), this, to, value, data, operation, nonce)); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/modules/WhitelistModule.sol b/packages/protocol-kit/contracts/safe_V1_2_0/modules/WhitelistModule.sol deleted file mode 100644 index e1bbd17f2..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/modules/WhitelistModule.sol +++ /dev/null @@ -1,66 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../base/Module.sol"; -import "../base/ModuleManager.sol"; -import "../base/OwnerManager.sol"; -import "../common/Enum.sol"; - - -/// @title Whitelist Module - Allows to execute transactions to whitelisted addresses without confirmations. -/// @author Stefan George - -contract WhitelistModule is Module { - - string public constant NAME = "Whitelist Module"; - string public constant VERSION = "0.1.0"; - - // isWhitelisted mapping maps destination address to boolean. - mapping (address => bool) public isWhitelisted; - - /// @dev Setup function sets initial storage of contract. - /// @param accounts List of whitelisted accounts. - function setup(address[] memory accounts) - public - { - setManager(); - for (uint256 i = 0; i < accounts.length; i++) { - address account = accounts[i]; - require(account != address(0), "Invalid account provided"); - isWhitelisted[account] = true; - } - } - - /// @dev Allows to add destination to whitelist. This can only be done via a Safe transaction. - /// @param account Destination address. - function addToWhitelist(address account) - public - authorized - { - require(account != address(0), "Invalid account provided"); - require(!isWhitelisted[account], "Account is already whitelisted"); - isWhitelisted[account] = true; - } - - /// @dev Allows to remove destination from whitelist. This can only be done via a Safe transaction. - /// @param account Destination address. - function removeFromWhitelist(address account) - public - authorized - { - require(isWhitelisted[account], "Account is not whitelisted"); - isWhitelisted[account] = false; - } - - /// @dev Returns if Safe transaction is to a whitelisted destination. - /// @param to Whitelisted destination address. - /// @param value Not checked. - /// @param data Not checked. - /// @return Returns if transaction can be executed. - function executeWhitelisted(address to, uint256 value, bytes memory data) - public - returns (bool) - { - // Only Safe owners are allowed to execute transactions to whitelisted accounts. - require(OwnerManager(address(manager)).isOwner(msg.sender), "Method can only be called by an owner"); - require(isWhitelisted[to], "Target account is not whitelisted"); - require(manager.execTransactionFromModule(to, value, data, Enum.Operation.Call), "Could not execute transaction"); - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol b/packages/protocol-kit/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol deleted file mode 100644 index 5eb686b14..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol +++ /dev/null @@ -1,27 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "./GnosisSafeProxy.sol"; - - -/// @title Delegate Constructor Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. -/// @author Stefan George - -/// @author Richard Meissner - -contract DelegateConstructorProxy is GnosisSafeProxy { - - /// @dev Constructor function sets address of master copy contract. - /// @param _masterCopy Master copy address. - /// @param initializer Data used for a delegate call to initialize the contract. - constructor(address _masterCopy, bytes memory initializer) GnosisSafeProxy(_masterCopy) - public - { - if (initializer.length > 0) { - // solium-disable-next-line security/no-inline-assembly - assembly { - let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) - let success := delegatecall(sub(gas, 10000), masterCopy, add(initializer, 0x20), mload(initializer), 0, 0) - let ptr := mload(0x40) - returndatacopy(ptr, 0, returndatasize()) - if eq(success, 0) { revert(ptr, returndatasize()) } - } - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol b/packages/protocol-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol deleted file mode 100644 index e78216740..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol +++ /dev/null @@ -1,47 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; - -/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain -/// @author Richard Meissner - -interface IProxy { - function masterCopy() external view returns (address); -} - -/// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. -/// @author Stefan George - -/// @author Richard Meissner - -contract GnosisSafeProxy { - - // masterCopy always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. - // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` - address internal masterCopy; - - /// @dev Constructor function sets address of master copy contract. - /// @param _masterCopy Master copy address. - constructor(address _masterCopy) - public - { - require(_masterCopy != address(0), "Invalid master copy address provided"); - masterCopy = _masterCopy; - } - - /// @dev Fallback function forwards all transactions and returns all received return data. - function () - external - payable - { - // solium-disable-next-line security/no-inline-assembly - assembly { - let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) - // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s - if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { - mstore(0, masterCopy) - return(0, 0x20) - } - calldatacopy(0, 0, calldatasize()) - let success := delegatecall(gas, masterCopy, 0, calldatasize(), 0, 0) - returndatacopy(0, 0, returndatasize()) - if eq(success, 0) { revert(0, returndatasize()) } - return(0, returndatasize()) - } - } -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol b/packages/protocol-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol deleted file mode 100644 index 574f5e85b..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol +++ /dev/null @@ -1,102 +0,0 @@ -pragma solidity ^0.5.3; -import "./GnosisSafeProxy.sol"; -import "./IProxyCreationCallback.sol"; - -/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. -/// @author Stefan George - -contract GnosisSafeProxyFactory { - - event ProxyCreation(GnosisSafeProxy proxy); - - /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. - /// @param masterCopy Address of master copy. - /// @param data Payload for message call sent to new proxy contract. - function createProxy(address masterCopy, bytes memory data) - public - returns (GnosisSafeProxy proxy) - { - proxy = new GnosisSafeProxy(masterCopy); - if (data.length > 0) - // solium-disable-next-line security/no-inline-assembly - assembly { - if eq(call(gas, proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } - } - emit ProxyCreation(proxy); - } - - /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. - function proxyRuntimeCode() public pure returns (bytes memory) { - return type(GnosisSafeProxy).runtimeCode; - } - - /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. - function proxyCreationCode() public pure returns (bytes memory) { - return type(GnosisSafeProxy).creationCode; - } - - /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. - /// This method is only meant as an utility to be called from other methods - /// @param _mastercopy Address of master copy. - /// @param initializer Payload for message call sent to new proxy contract. - /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. - function deployProxyWithNonce(address _mastercopy, bytes memory initializer, uint256 saltNonce) - internal - returns (GnosisSafeProxy proxy) - { - // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it - bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); - bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(_mastercopy)); - // solium-disable-next-line security/no-inline-assembly - assembly { - proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) - } - require(address(proxy) != address(0), "Create2 call failed"); - } - - /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. - /// @param _mastercopy Address of master copy. - /// @param initializer Payload for message call sent to new proxy contract. - /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. - function createProxyWithNonce(address _mastercopy, bytes memory initializer, uint256 saltNonce) - public - returns (GnosisSafeProxy proxy) - { - proxy = deployProxyWithNonce(_mastercopy, initializer, saltNonce); - if (initializer.length > 0) - // solium-disable-next-line security/no-inline-assembly - assembly { - if eq(call(gas, proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0,0) } - } - emit ProxyCreation(proxy); - } - - /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction - /// @param _mastercopy Address of master copy. - /// @param initializer Payload for message call sent to new proxy contract. - /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. - /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. - function createProxyWithCallback(address _mastercopy, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback) - public - returns (GnosisSafeProxy proxy) - { - uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); - proxy = createProxyWithNonce(_mastercopy, initializer, saltNonceWithCallback); - if (address(callback) != address(0)) - callback.proxyCreated(proxy, _mastercopy, initializer, saltNonce); - } - - /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` - /// This method is only meant for address calculation purpose when you use an initializer that would revert, - /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. - /// @param _mastercopy Address of master copy. - /// @param initializer Payload for message call sent to new proxy contract. - /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. - function calculateCreateProxyWithNonceAddress(address _mastercopy, bytes calldata initializer, uint256 saltNonce) - external - returns (GnosisSafeProxy proxy) - { - proxy = deployProxyWithNonce(_mastercopy, initializer, saltNonce); - revert(string(abi.encodePacked(proxy))); - } - -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol b/packages/protocol-kit/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol deleted file mode 100644 index 15d9a54a7..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma solidity ^0.5.3; -import "./GnosisSafeProxy.sol"; - -interface IProxyCreationCallback { - function proxyCreated(GnosisSafeProxy proxy, address _mastercopy, bytes calldata initializer, uint256 saltNonce) external; -} diff --git a/packages/protocol-kit/contracts/safe_V1_2_0/proxies/PayingProxy.sol b/packages/protocol-kit/contracts/safe_V1_2_0/proxies/PayingProxy.sol deleted file mode 100644 index 0db92a558..000000000 --- a/packages/protocol-kit/contracts/safe_V1_2_0/proxies/PayingProxy.sol +++ /dev/null @@ -1,29 +0,0 @@ -pragma solidity >=0.5.0 <0.7.0; -import "../common/SecuredTokenTransfer.sol"; -import "./DelegateConstructorProxy.sol"; - -/// @title Paying Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. It is possible to send along initialization data with the constructor. And sends funds after creation to a specified account. -/// @author Stefan George - -/// @author Richard Meissner - -contract PayingProxy is DelegateConstructorProxy, SecuredTokenTransfer { - - /// @dev Constructor function sets address of master copy contract. - /// @param _masterCopy Master copy address. - /// @param initializer Data used for a delegate call to initialize the contract. - /// @param funder Address that should be paid for the execution of this call - /// @param paymentToken Token that should be used for the payment (0 is ETH) - /// @param payment Value that should be paid - constructor(address _masterCopy, bytes memory initializer, address payable funder, address paymentToken, uint256 payment) - DelegateConstructorProxy(_masterCopy, initializer) - public - { - if (payment > 0) { - if (paymentToken == address(0)) { - // solium-disable-next-line security/no-send - require(funder.send(payment), "Could not pay safe creation with ether"); - } else { - require(transferToken(paymentToken, funder, payment), "Could not pay safe creation with token"); - } - } - } -} diff --git a/packages/protocol-kit/hardhat.config.ts b/packages/protocol-kit/hardhat.config.ts deleted file mode 100644 index 10273de4d..000000000 --- a/packages/protocol-kit/hardhat.config.ts +++ /dev/null @@ -1,128 +0,0 @@ -import '@nomicfoundation/hardhat-viem' -import 'hardhat-deploy' -import 'tsconfig-paths/register' -import dotenv from 'dotenv' -import { HardhatUserConfig, HttpNetworkUserConfig } from 'hardhat/types' -import yargs from 'yargs' - -yargs - .option('network', { - type: 'string', - default: 'hardhat' - }) - .help(false) - .version(false).argv - -dotenv.config() -const { MNEMONIC, PK } = process.env -const DEFAULT_MNEMONIC = - 'myth like bonus scare over problem client lizard pioneer submit female collect' - -const sharedNetworkConfig: HttpNetworkUserConfig = {} -if (PK) { - sharedNetworkConfig.accounts = [PK] -} else { - sharedNetworkConfig.accounts = { - mnemonic: MNEMONIC || DEFAULT_MNEMONIC - } -} - -const config: HardhatUserConfig = { - defaultNetwork: 'hardhat', - solidity: { - compilers: [ - { version: '0.5.17' }, - { version: '0.5.3' }, - { version: '0.8.0' }, - { - version: '0.8.24', - settings: { - optimizer: { - enabled: true, - runs: 10_000_000 - }, - viaIR: false, - evmVersion: 'paris' - } - } - ], - overrides: { - '@gnosis.pm/safe-contracts-v1.3.0/contracts/handler/CompatibilityFallbackHandler.sol': { - version: '0.8.0' - } - } - }, - paths: { - artifacts: 'artifacts', - deploy: 'hardhat/deploy', - sources: 'contracts', - tests: 'tests/e2e' - }, - networks: { - localhost: { - url: 'http://127.0.0.1:8545' - }, - hardhat: { - allowUnlimitedContractSize: true, - blockGasLimit: 100000000, - gas: 100000000, - accounts: [ - { - balance: '100000000000000000000', - privateKey: '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d' - }, - { - balance: '100000000000000000000', - privateKey: '0x6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1' - }, - { - balance: '100000000000000000000', - privateKey: '0x6370fd033278c143179d81c5526140625662b8daa446c22ee2d73db3707e620c' - }, - { - balance: '100000000000000000000', - privateKey: '0x646f1ce2fdad0e6deeeb5c7e8e5543bdde65e86029e2fd9fc169899c440a7913' - }, - { - balance: '100000000000000000000', - privateKey: '0xadd53f9a7e588d003326d1cbf9e4a43c061aadd9bc938c843a79e7b4fd2ad743' - }, - { - balance: '100000000000000000000', - privateKey: '0x395df67f0c2d2d9fe1ad08d1bc8b6627011959b79c53d7dd6a3536a33ab8a4fd' - }, - { - balance: '100000000000000000000', - privateKey: '0xe485d098507f54e7733a205420dfddbe58db035fa577fc294ebd14db90767a52' - }, - { - balance: '100000000000000000000', - privateKey: '0xa453611d9419d0e56f499079478fd72c37b251a94bfde4d19872c44cf65386e3' - }, - { - balance: '100000000000000000000', - privateKey: '0x829e924fdf021ba3dbbc4225edfece9aca04b929d6e75613329ca6f1d31c0bb4' - }, - { - balance: '100000000000000000000', - privateKey: '0xb0057716d5917badaf911b193b12b910811c1497b5bada8d7711f758981c3773' - } - ] - }, - sepolia: { - ...sharedNetworkConfig, - url: 'https://sepolia.gateway.tenderly.co' - } - }, - //@ts-expect-error Type not found - compilerOptions: { - paths: { '^@safe-global/protocol-kit/(.*)$': ['../protocol-kit/src/*'] } - }, - namedAccounts: { - deployer: { - default: 0 - } - } -} - -export default config diff --git a/packages/protocol-kit/hardhat/deploy/deploy-contracts.ts b/packages/protocol-kit/hardhat/deploy/deploy-contracts.ts deleted file mode 100644 index 93171e1c5..000000000 --- a/packages/protocol-kit/hardhat/deploy/deploy-contracts.ts +++ /dev/null @@ -1,248 +0,0 @@ -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { DeployFunction } from 'hardhat-deploy/types' -import { HardhatRuntimeEnvironment } from 'hardhat/types' - -export const safeVersionDeployed = process.env.SAFE_VERSION as SafeVersion - -type SafeVersions = { [key: string]: { name: string } } - -const safeContracts: SafeVersions = { - '1.4.1': { name: 'Safe_SV1_4_1' }, - '1.3.0': { name: 'Safe_SV1_3_0' }, - '1.2.0': { name: 'Safe_SV1_2_0' }, - '1.1.1': { name: 'Safe_SV1_1_1' }, - '1.0.0': { name: 'Safe_SV1_0_0' } -} - -const proxyFactoryContracts: SafeVersions = { - '1.4.1': { name: 'SafeProxyFactory_SV1_4_1' }, - '1.3.0': { name: 'SafeProxyFactory_SV1_3_0' }, - '1.2.0': { name: 'SafeProxyFactory_SV1_2_0' }, - '1.1.1': { name: 'SafeProxyFactory_SV1_1_1' }, - '1.0.0': { name: 'SafeProxyFactory_SV1_0_0' } -} - -const multiSendContracts: SafeVersions = { - '1.4.1': { name: 'MultiSend_SV1_4_1' }, - '1.3.0': { name: 'MultiSend_SV1_3_0' }, - '1.2.0': { name: 'MultiSend_SV1_2_0' }, - '1.1.1': { name: 'MultiSend_SV1_2_0' }, - '1.0.0': { name: 'MultiSend_SV1_2_0' } -} - -const multiSendCallOnlyContracts: SafeVersions = { - '1.4.1': { name: 'MultiSendCallOnly_SV1_4_1' }, - '1.3.0': { name: 'MultiSendCallOnly_SV1_3_0' }, - '1.2.0': { name: 'MultiSendCallOnly_SV1_3_0' }, - '1.1.1': { name: 'MultiSendCallOnly_SV1_3_0' }, - '1.0.0': { name: 'MultiSendCallOnly_SV1_3_0' } -} - -const compatibilityFallbackHandlerContracts: SafeVersions = { - '1.4.1': { name: 'CompatibilityFallbackHandler_SV1_4_1' }, - '1.3.0': { name: 'CompatibilityFallbackHandler_SV1_3_0' }, - '1.2.0': { name: 'CompatibilityFallbackHandler_SV1_3_0' }, - '1.1.1': { name: 'CompatibilityFallbackHandler_SV1_3_0' }, - '1.0.0': { name: 'CompatibilityFallbackHandler_SV1_3_0' } -} - -const signMessageLibContracts: SafeVersions = { - '1.4.1': { name: 'SignMessageLib_SV1_4_1' }, - '1.3.0': { name: 'SignMessageLib_SV1_3_0' }, - '1.2.0': { name: 'SignMessageLib_SV1_3_0' }, - '1.1.1': { name: 'SignMessageLib_SV1_3_0' }, - '1.0.0': { name: 'SignMessageLib_SV1_3_0' } -} - -const createCallContracts: SafeVersions = { - '1.4.1': { name: 'CreateCall_SV1_4_1' }, - '1.3.0': { name: 'CreateCall_SV1_3_0' }, - '1.2.0': { name: 'CreateCall_SV1_3_0' }, - '1.1.1': { name: 'CreateCall_SV1_3_0' }, - '1.0.0': { name: 'CreateCall_SV1_3_0' } -} - -const simulateTxAccessorContracts: SafeVersions = { - '1.4.1': { name: 'SimulateTxAccessor_SV1_4_1' }, - '1.3.0': { name: 'SimulateTxAccessor_SV1_3_0' }, - '1.2.0': { name: 'SimulateTxAccessor_SV1_3_0' }, - '1.1.1': { name: 'SimulateTxAccessor_SV1_3_0' }, - '1.0.0': { name: 'SimulateTxAccessor_SV1_3_0' } -} - -const safeWebAuthnSignerFactoryContracts: SafeVersions = { - '1.4.1': { name: 'SafeWebAuthnSignerFactory_SV1_4_1' }, - '1.3.0': { name: 'SafeWebAuthnSignerFactory_SV1_4_1' }, - '1.2.0': { name: 'SafeWebAuthnSignerFactory_SV1_4_1' }, - '1.1.1': { name: 'SafeWebAuthnSignerFactory_SV1_4_1' }, - '1.0.0': { name: 'SafeWebAuthnSignerFactory_SV1_4_1' } -} - -const safeWebAuthnSharedSignerContracts: SafeVersions = { - '1.4.1': { name: 'SafeWebAuthnSharedSigner' }, - '1.3.0': { name: 'SafeWebAuthnSharedSigner' }, - '1.2.0': { name: 'SafeWebAuthnSharedSigner' }, - '1.1.1': { name: 'SafeWebAuthnSharedSigner' }, - '1.0.0': { name: 'SafeWebAuthnSharedSigner' } -} - -export const safeDeployed = safeContracts[safeVersionDeployed] -export const proxyFactoryDeployed = proxyFactoryContracts[safeVersionDeployed] -export const multiSendDeployed = multiSendContracts[safeVersionDeployed] -export const multiSendCallOnlyDeployed = multiSendCallOnlyContracts[safeVersionDeployed] -export const compatibilityFallbackHandlerDeployed = - compatibilityFallbackHandlerContracts[safeVersionDeployed] -export const signMessageLibDeployed = signMessageLibContracts[safeVersionDeployed] -export const createCallDeployed = createCallContracts[safeVersionDeployed] -export const simulateTxAccessorDeployed = simulateTxAccessorContracts[safeVersionDeployed] -export const safeWebAuthnSignerFactoryDeployed = - safeWebAuthnSignerFactoryContracts[safeVersionDeployed] -export const safeWebAuthnSharedSignerDeployed = - safeWebAuthnSharedSignerContracts[safeVersionDeployed] - -const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment): Promise => { - const { deployments, getNamedAccounts } = hre - const { deployer } = await getNamedAccounts() - const { deploy } = deployments - - await deploy(safeDeployed.name, { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy(proxyFactoryDeployed.name, { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy(multiSendDeployed.name, { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy(multiSendCallOnlyDeployed.name, { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy(signMessageLibDeployed.name, { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy(createCallDeployed.name, { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy(compatibilityFallbackHandlerDeployed.name, { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy(simulateTxAccessorDeployed.name, { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy(safeWebAuthnSignerFactoryDeployed.name, { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy(safeWebAuthnSharedSignerDeployed.name, { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy('WebAuthnContract', { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy('DailyLimitModule', { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy('SocialRecoveryModule', { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy('ERC20Mintable', { - from: deployer, - args: [], - log: true - }) - - await deploy('DebugTransactionGuard_SV1_3_0', { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy('DefaultCallbackHandler_SV1_3_0', { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy('DebugTransactionGuard_SV1_4_1', { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy('TokenCallbackHandler_SV1_4_1', { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy('StateChannelModule', { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) - - await deploy('WhitelistModule', { - from: deployer, - args: [], - log: true, - deterministicDeployment: true - }) -} - -export default deploy diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index 0f81454f2..1ece075b7 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -16,26 +16,26 @@ "update-safe-deployments": "ts-node scripts/safe-deployments/updateLocalNetworks.ts", "check-short-name-integrity": "ts-node scripts/safe-deployments/checkShortNameIntegrity.ts", "test": "mocha -r ts-node/register -r tsconfig-paths/register tests/unit/**/*.ts", - "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", - "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test", - "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", - "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test", - "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", - "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test", + "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", "coverage": "nyc report --reporter=lcov", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", "unbuild": "rimraf dist artifacts deployments cache .nyc_output *.tsbuildinfo", - "build": "yarn unbuild && hardhat compile && yarn check-safe-deployments && NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json" + "build": "yarn unbuild && yarn check-safe-deployments && NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json" }, "repository": { "type": "git", diff --git a/packages/protocol-kit/tests/e2e/contractManager.test.ts b/packages/protocol-kit/tests/e2e/contractManager.test.ts index 978c5b845..cae664a6f 100644 --- a/packages/protocol-kit/tests/e2e/contractManager.test.ts +++ b/packages/protocol-kit/tests/e2e/contractManager.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { ContractNetworksConfig, PredictedSafeProps } from '@safe-global/protocol-kit/index' import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import chai from 'chai' diff --git a/packages/protocol-kit/tests/e2e/core.test.ts b/packages/protocol-kit/tests/e2e/core.test.ts index d1bd27877..5182e4bdc 100644 --- a/packages/protocol-kit/tests/e2e/core.test.ts +++ b/packages/protocol-kit/tests/e2e/core.test.ts @@ -1,5 +1,5 @@ import { DEFAULT_SAFE_VERSION } from '@safe-global/protocol-kit/contracts/config' -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PredictedSafeProps, SafeFactory } from '@safe-global/protocol-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' diff --git a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts index 00f81707e..92a3f5689 100644 --- a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts @@ -2,7 +2,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' import { keccak256, toHex } from 'viem' -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PREDETERMINED_SALT_NONCE, PredictedSafeProps, diff --git a/packages/protocol-kit/tests/e2e/createTransaction.test.ts b/packages/protocol-kit/tests/e2e/createTransaction.test.ts index 0569bb3a8..de7c4caaa 100644 --- a/packages/protocol-kit/tests/e2e/createTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransaction.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PredictedSafeProps, SafeTransactionOptionalProps, diff --git a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts index 437e1abfc..899a11bad 100644 --- a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts @@ -1,7 +1,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit/index' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners, getMultiSendCallOnly } from './utils/setupContracts' diff --git a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts index cc195fea6..ff76522f1 100644 --- a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts @@ -1,5 +1,5 @@ import Safe, { buildContractSignature, hashSafeMessage } from '@safe-global/protocol-kit/index' -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import { SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' import { SigningMethod } from '@safe-global/protocol-kit/types' import chai from 'chai' diff --git a/packages/protocol-kit/tests/e2e/eip1271.test.ts b/packages/protocol-kit/tests/e2e/eip1271.test.ts index 4abee3f91..4ffa84d61 100644 --- a/packages/protocol-kit/tests/e2e/eip1271.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271.test.ts @@ -6,7 +6,7 @@ import Safe, { buildContractSignature, EthSafeSignature } from '@safe-global/protocol-kit/index' -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import SafeMessage from '@safe-global/protocol-kit/utils/messages/SafeMessage' import { OperationType, SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' import { SigningMethod } from '@safe-global/protocol-kit/types' diff --git a/packages/protocol-kit/tests/e2e/erc-20.test.ts b/packages/protocol-kit/tests/e2e/erc-20.test.ts index f875b0b6b..de27538be 100644 --- a/packages/protocol-kit/tests/e2e/erc-20.test.ts +++ b/packages/protocol-kit/tests/e2e/erc-20.test.ts @@ -4,7 +4,7 @@ import Safe, { getERC20Decimals, isGasTokenCompatibleWithHandlePayment } from '@safe-global/protocol-kit/index' -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import sinon from 'sinon' diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index 36cdf8716..07e4821ce 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { SigningMethod } from '@safe-global/protocol-kit/index' import { TransactionOptions, MetaTransactionData } from '@safe-global/safe-core-sdk-types' import chai from 'chai' diff --git a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts index cb9985a59..a9342999f 100644 --- a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PredictedSafeProps, SafeTransactionOptionalProps diff --git a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts index e11e3c341..150a2116c 100644 --- a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts @@ -1,5 +1,5 @@ import Safe from '@safe-global/protocol-kit/index' -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import chai from 'chai' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' diff --git a/packages/protocol-kit/tests/e2e/guardManager.test.ts b/packages/protocol-kit/tests/e2e/guardManager.test.ts index 49fc8cefe..f1c13d026 100644 --- a/packages/protocol-kit/tests/e2e/guardManager.test.ts +++ b/packages/protocol-kit/tests/e2e/guardManager.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PredictedSafeProps, SafeTransactionOptionalProps diff --git a/packages/protocol-kit/tests/e2e/moduleManager.test.ts b/packages/protocol-kit/tests/e2e/moduleManager.test.ts index 8040fd530..79d4cb397 100644 --- a/packages/protocol-kit/tests/e2e/moduleManager.test.ts +++ b/packages/protocol-kit/tests/e2e/moduleManager.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PredictedSafeProps, SafeTransactionOptionalProps diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 47c2ea302..1746ce278 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PredictedSafeProps, SigningMethod } from '@safe-global/protocol-kit/index' import { SafeMultisigTransactionResponse } from '@safe-global/safe-core-sdk-types' import chai from 'chai' diff --git a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts index 8f42793e4..9a6724fc5 100644 --- a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' diff --git a/packages/protocol-kit/tests/e2e/ownerManager.test.ts b/packages/protocol-kit/tests/e2e/ownerManager.test.ts index 0fa757244..6c3213b91 100644 --- a/packages/protocol-kit/tests/e2e/ownerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/ownerManager.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PredictedSafeProps, SafeTransactionOptionalProps diff --git a/packages/protocol-kit/tests/e2e/passkey.test.ts b/packages/protocol-kit/tests/e2e/passkey.test.ts index 59c381656..89f5f2031 100644 --- a/packages/protocol-kit/tests/e2e/passkey.test.ts +++ b/packages/protocol-kit/tests/e2e/passkey.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import { OperationType } from '@safe-global/safe-core-sdk-types' import Safe, { getPasskeyOwnerAddress, diff --git a/packages/protocol-kit/tests/e2e/safeFactory.test.ts b/packages/protocol-kit/tests/e2e/safeFactory.test.ts index fd58c0a03..88cef595c 100644 --- a/packages/protocol-kit/tests/e2e/safeFactory.test.ts +++ b/packages/protocol-kit/tests/e2e/safeFactory.test.ts @@ -1,5 +1,5 @@ import { DEFAULT_SAFE_VERSION } from '@safe-global/protocol-kit/contracts/config' -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import { ContractNetworksConfig, DeploySafeProps, diff --git a/packages/protocol-kit/tests/e2e/safeProvider.test.ts b/packages/protocol-kit/tests/e2e/safeProvider.test.ts index 42bed157d..0b1be306d 100644 --- a/packages/protocol-kit/tests/e2e/safeProvider.test.ts +++ b/packages/protocol-kit/tests/e2e/safeProvider.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' diff --git a/packages/protocol-kit/tests/e2e/threshold.test.ts b/packages/protocol-kit/tests/e2e/threshold.test.ts index 2629bb76f..1a60608bb 100644 --- a/packages/protocol-kit/tests/e2e/threshold.test.ts +++ b/packages/protocol-kit/tests/e2e/threshold.test.ts @@ -1,4 +1,4 @@ -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PredictedSafeProps, SafeTransactionOptionalProps diff --git a/packages/protocol-kit/tests/e2e/utils/setupContracts.ts b/packages/protocol-kit/tests/e2e/utils/setupContracts.ts index fdd50ab1c..990407e80 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupContracts.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupContracts.ts @@ -12,7 +12,7 @@ import { safeWebAuthnSignerFactoryDeployed, signMessageLibDeployed, simulateTxAccessorDeployed -} from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +} from '@safe-global/testing-kit' import { deployments, viem } from 'hardhat' import semverSatisfies from 'semver/functions/satisfies' import { getDeployer, waitTransactionReceipt } from './transactions' diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index c2827e7f4..47c2468b8 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -8,7 +8,7 @@ import { PREDETERMINED_SALT_NONCE, predictSafeAddress } from '@safe-global/protocol-kit/contracts/utils' -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import { SafeDeploymentConfig, SafeAccountConfig, diff --git a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts index 74b3a7eb5..56c8abb7f 100644 --- a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts @@ -1,7 +1,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' -import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' +import { safeVersionDeployed } from '@safe-global/testing-kit' import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit/index' import { getContractNetworks } from './utils/setupContractNetworks' import { itif } from './utils/helpers' diff --git a/packages/testing-kit/hardhat.config.ts b/packages/testing-kit/hardhat.config.ts index 10273de4d..531e9b991 100644 --- a/packages/testing-kit/hardhat.config.ts +++ b/packages/testing-kit/hardhat.config.ts @@ -3,6 +3,7 @@ import 'hardhat-deploy' import 'tsconfig-paths/register' import dotenv from 'dotenv' import { HardhatUserConfig, HttpNetworkUserConfig } from 'hardhat/types' +import path from 'path' import yargs from 'yargs' yargs @@ -53,10 +54,9 @@ const config: HardhatUserConfig = { } }, paths: { - artifacts: 'artifacts', - deploy: 'hardhat/deploy', - sources: 'contracts', - tests: 'tests/e2e' + artifacts: path.resolve(__dirname, './artifacts'), + deploy: path.resolve(__dirname, './hardhat/deploy'), + sources: path.resolve(__dirname, './contracts') }, networks: { localhost: { diff --git a/packages/testing-kit/index.ts b/packages/testing-kit/index.ts new file mode 100644 index 000000000..aee0f3194 --- /dev/null +++ b/packages/testing-kit/index.ts @@ -0,0 +1 @@ +export * from './hardhat/deploy/deploy-contracts' From e21b240b6bb10c42cbbe12cc3c58249d608ed069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 15:23:10 +0200 Subject: [PATCH 06/55] Remove yargs --- packages/testing-kit/hardhat.config.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/testing-kit/hardhat.config.ts b/packages/testing-kit/hardhat.config.ts index 531e9b991..8985680fa 100644 --- a/packages/testing-kit/hardhat.config.ts +++ b/packages/testing-kit/hardhat.config.ts @@ -4,15 +4,6 @@ import 'tsconfig-paths/register' import dotenv from 'dotenv' import { HardhatUserConfig, HttpNetworkUserConfig } from 'hardhat/types' import path from 'path' -import yargs from 'yargs' - -yargs - .option('network', { - type: 'string', - default: 'hardhat' - }) - .help(false) - .version(false).argv dotenv.config() const { MNEMONIC, PK } = process.env From 9256e1f2d08dc02d4e5de98d5ab66922364707df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 15:45:58 +0200 Subject: [PATCH 07/55] Include deploy compile --- packages/testing-kit/hardhat/deploy/deploy-contracts.ts | 1 + packages/testing-kit/tsconfig.build.json | 2 +- packages/testing-kit/tsconfig.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/testing-kit/hardhat/deploy/deploy-contracts.ts b/packages/testing-kit/hardhat/deploy/deploy-contracts.ts index cce7a44ec..46547106f 100644 --- a/packages/testing-kit/hardhat/deploy/deploy-contracts.ts +++ b/packages/testing-kit/hardhat/deploy/deploy-contracts.ts @@ -101,6 +101,7 @@ export const safeWebAuthnSharedSignerDeployed = safeWebAuthnSharedSignerContracts[safeVersionDeployed] const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment): Promise => { + //@ts-expect-error - Property 'deployments' does not exist on type 'HardhatRuntimeEnvironment' const { deployments, getNamedAccounts } = hre const { deployer } = await getNamedAccounts() diff --git a/packages/testing-kit/tsconfig.build.json b/packages/testing-kit/tsconfig.build.json index 67123d322..22c319a8e 100644 --- a/packages/testing-kit/tsconfig.build.json +++ b/packages/testing-kit/tsconfig.build.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["bin/**/*"] + "include": ["bin/**/*", "hardhat/**/*", "./index.ts"] } diff --git a/packages/testing-kit/tsconfig.json b/packages/testing-kit/tsconfig.json index a6c89343b..bd596e285 100644 --- a/packages/testing-kit/tsconfig.json +++ b/packages/testing-kit/tsconfig.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["./hardhat.config.ts", "bin/**/*", "hardhat/**/*"] + "include": ["./hardhat.config.ts", "bin/**/*", "hardhat/**/*", "./index.ts"] } From efa6e6d635f60cdae7a62d29719784777d308dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 15:56:36 +0200 Subject: [PATCH 08/55] Add .bin to the PATH --- .github/workflows/protocol-kit-e2e-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 7e790f43f..542fcd9a7 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -24,6 +24,9 @@ jobs: - run: | yarn install --frozen-lockfile yarn build + - name: Add node_modules/.bin to PATH + run: | + echo '::add-path::$(yarn bin)' # Add node_modules/.bin to the PATH - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit From 48b2ffd384086e973d7469ec9190c954ae7d9a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 16:00:15 +0200 Subject: [PATCH 09/55] Add .bin to the path --- .github/workflows/protocol-kit-e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 542fcd9a7..ba0437b8e 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -26,7 +26,7 @@ jobs: yarn build - name: Add node_modules/.bin to PATH run: | - echo '::add-path::$(yarn bin)' # Add node_modules/.bin to the PATH + echo "$(yarn bin)" >> $GITHUB_PATH - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit From 6726060b23554dc90d0da626896310583d642392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 16:01:27 +0200 Subject: [PATCH 10/55] Add .bin to path --- .github/workflows/protocol-kit-e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index ba0437b8e..2b4f85380 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -24,7 +24,7 @@ jobs: - run: | yarn install --frozen-lockfile yarn build - - name: Add node_modules/.bin to PATH + - name: Add node_modules/.bin to the PATH run: | echo "$(yarn bin)" >> $GITHUB_PATH - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} From 3bc136ded03cf60911d2f2a8f6c4993767a1bd24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 16:20:49 +0200 Subject: [PATCH 11/55] Debug testing-kit --- .github/workflows/protocol-kit-e2e-test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 2b4f85380..83a45a0a3 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -24,9 +24,15 @@ jobs: - run: | yarn install --frozen-lockfile yarn build + - name: Verify testing-kit installation + run: | + yarn list @safe-global/testing-kit - name: Add node_modules/.bin to the PATH run: | echo "$(yarn bin)" >> $GITHUB_PATH + - name: Debug node_modules/.bin + run: | + ls -la $(yarn bin) - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit From f2df79e647a7403830974f5b26de62390e3046e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 16:49:26 +0200 Subject: [PATCH 12/55] Print current dir --- .github/workflows/protocol-kit-e2e-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 83a45a0a3..6adf54645 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -29,10 +29,10 @@ jobs: yarn list @safe-global/testing-kit - name: Add node_modules/.bin to the PATH run: | - echo "$(yarn bin)" >> $GITHUB_PATH + echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH - name: Debug node_modules/.bin run: | - ls -la $(yarn bin) + ls -la $(pwd)/node_modules/.bin - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit From 82b6aba376f898be4135012a426ab59554747d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 16:53:56 +0200 Subject: [PATCH 13/55] Try to add to the path --- .github/workflows/protocol-kit-e2e-test.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 6adf54645..ebb1a02e1 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -27,13 +27,9 @@ jobs: - name: Verify testing-kit installation run: | yarn list @safe-global/testing-kit - - name: Add node_modules/.bin to the PATH - run: | - echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH - - name: Debug node_modules/.bin - run: | - ls -la $(pwd)/node_modules/.bin - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit + echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH + ls -la $(pwd)/node_modules/.bin yarn test:hardhat:${{ matrix.provider }}:${{ matrix.contract-version }} From 5673940152437995a388dc6ecad8ca4c4a31a1d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 17:02:50 +0200 Subject: [PATCH 14/55] Add reference as file: --- packages/protocol-kit/package.json | 8 +------- yarn.lock | 3 +++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index 1ece075b7..3775eb706 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -51,10 +51,6 @@ ], "homepage": "https://github.com/safe-global/safe-core-sdk#readme", "devDependencies": { - "@gnosis.pm/safe-contracts-v1.3.0": "npm:@gnosis.pm/safe-contracts@1.3.0", - "@nomicfoundation/hardhat-viem": "^2.0.2", - "@openzeppelin/contracts": "^2.5.1", - "@safe-global/safe-contracts-v1.4.1": "npm:@safe-global/safe-contracts@1.4.1", "@safe-global/safe-passkey": "0.2.0-alpha.1", "@types/chai": "^4.3.16", "@types/chai-as-promised": "^7.1.8", @@ -65,14 +61,12 @@ "chai-as-promised": "^7.1.1", "dotenv": "^16.4.5", "ethers": "^6.13.1", - "hardhat": "^2.19.3", - "hardhat-deploy": "^0.12.4", "mocha": "^10.2.0", "nyc": "^15.1.0", "tsconfig-paths": "^4.2.0", "web3": "^4.7.0", "yargs": "^17.7.2", - "@safe-global/testing-kit": "^1.0.0" + "@safe-global/testing-kit": "file:../testing-kit" }, "dependencies": { "@noble/hashes": "^1.3.3", diff --git a/yarn.lock b/yarn.lock index 26e5583c0..6237e4d9b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1890,6 +1890,9 @@ "@safe-global/safe-contracts" "^1.4.1-build.0" cbor "^9.0.2" +"@safe-global/testing-kit@file:packages/testing-kit": + version "1.0.0" + "@scure/base@^1.1.1", "@scure/base@^1.1.3", "@scure/base@~1.1.0": version "1.1.6" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.6.tgz#8ce5d304b436e4c84f896e0550c83e4d88cb917d" From 7764f54e449e731752d58e6380be76d02f051c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 17:08:41 +0200 Subject: [PATCH 15/55] Move to the root --- .github/workflows/protocol-kit-e2e-test.yml | 2 ++ packages/api-kit/package.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index ebb1a02e1..7a3097281 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -29,6 +29,8 @@ jobs: yarn list @safe-global/testing-kit - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | + echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH + ls -la $(pwd)/node_modules/.bin cd packages/protocol-kit echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH ls -la $(pwd)/node_modules/.bin diff --git a/packages/api-kit/package.json b/packages/api-kit/package.json index 71d3e7558..23641cccf 100644 --- a/packages/api-kit/package.json +++ b/packages/api-kit/package.json @@ -58,7 +58,8 @@ "sinon-chai": "^3.7.0", "tsconfig-paths": "^4.2.0", "web3": "^4.7.0", - "yargs": "^17.7.2" + "yargs": "^17.7.2", + "@safe-global/testing-kit": "file:../testing-kit" }, "dependencies": { "@safe-global/protocol-kit": "^4.1.0", From 38922c152ecb930e9027eaac619823f8ac3b8f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 17:17:25 +0200 Subject: [PATCH 16/55] debug --- .github/workflows/protocol-kit-e2e-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 7a3097281..99380e6de 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -34,4 +34,6 @@ jobs: cd packages/protocol-kit echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH ls -la $(pwd)/node_modules/.bin + printenv + find $(pwd)/node_modules -name testing-kit -type f yarn test:hardhat:${{ matrix.provider }}:${{ matrix.contract-version }} From bd411a4ef7e0ded11add24f4d43640679b96c6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 17:30:02 +0200 Subject: [PATCH 17/55] Add yarnrc --- .yarnrc.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .yarnrc.yml diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 000000000..3186f3f07 --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules From 0c3ef9f8ad78d163f686d14aa82d163d9ff38315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 17:33:05 +0200 Subject: [PATCH 18/55] Remove frozen lockfile --- .github/workflows/protocol-kit-e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 99380e6de..8df9ea326 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -22,7 +22,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: | - yarn install --frozen-lockfile + yarn install yarn build - name: Verify testing-kit installation run: | From 3b34257421f939e3712a38ab4417b8f7c123f1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 17:54:55 +0200 Subject: [PATCH 19/55] Some changes --- .github/workflows/protocol-kit-e2e-test.yml | 2 +- .yarnrc.yml | 1 - packages/api-kit/package.json | 2 +- packages/protocol-kit/package.json | 33 +++++++++++---------- yarn.lock | 3 -- 5 files changed, 19 insertions(+), 22 deletions(-) delete mode 100644 .yarnrc.yml diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 8df9ea326..99380e6de 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -22,7 +22,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: | - yarn install + yarn install --frozen-lockfile yarn build - name: Verify testing-kit installation run: | diff --git a/.yarnrc.yml b/.yarnrc.yml deleted file mode 100644 index 3186f3f07..000000000 --- a/.yarnrc.yml +++ /dev/null @@ -1 +0,0 @@ -nodeLinker: node-modules diff --git a/packages/api-kit/package.json b/packages/api-kit/package.json index 23641cccf..98d72f5f1 100644 --- a/packages/api-kit/package.json +++ b/packages/api-kit/package.json @@ -59,7 +59,7 @@ "tsconfig-paths": "^4.2.0", "web3": "^4.7.0", "yargs": "^17.7.2", - "@safe-global/testing-kit": "file:../testing-kit" + "@safe-global/testing-kit": "^1.0.0" }, "dependencies": { "@safe-global/protocol-kit": "^4.1.0", diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index 3775eb706..84b71b8b4 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -16,21 +16,21 @@ "update-safe-deployments": "ts-node scripts/safe-deployments/updateLocalNetworks.ts", "check-short-name-integrity": "ts-node scripts/safe-deployments/checkShortNameIntegrity.ts", "test": "mocha -r ts-node/register -r tsconfig-paths/register tests/unit/**/*.ts", - "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", "coverage": "nyc report --reporter=lcov", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", @@ -64,9 +64,10 @@ "mocha": "^10.2.0", "nyc": "^15.1.0", "tsconfig-paths": "^4.2.0", + "hardhat": "^2.19.3", "web3": "^4.7.0", "yargs": "^17.7.2", - "@safe-global/testing-kit": "file:../testing-kit" + "@safe-global/testing-kit": "^1.0.0" }, "dependencies": { "@noble/hashes": "^1.3.3", diff --git a/yarn.lock b/yarn.lock index 6237e4d9b..26e5583c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1890,9 +1890,6 @@ "@safe-global/safe-contracts" "^1.4.1-build.0" cbor "^9.0.2" -"@safe-global/testing-kit@file:packages/testing-kit": - version "1.0.0" - "@scure/base@^1.1.1", "@scure/base@^1.1.3", "@scure/base@~1.1.0": version "1.1.6" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.6.tgz#8ce5d304b436e4c84f896e0550c83e4d88cb917d" From 45c00f499164115833d2b679fe0689c76205e9eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 17:58:16 +0200 Subject: [PATCH 20/55] Remove node_modules --- packages/protocol-kit/package.json | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index 84b71b8b4..fc0edcb5f 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -16,21 +16,21 @@ "update-safe-deployments": "ts-node scripts/safe-deployments/updateLocalNetworks.ts", "check-short-name-integrity": "ts-node scripts/safe-deployments/checkShortNameIntegrity.ts", "test": "mocha -r ts-node/register -r tsconfig-paths/register tests/unit/**/*.ts", - "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && ./node_modules/.bin/testing-kit deploy && nyc ./node_modules/.bin/testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", "coverage": "nyc report --reporter=lcov", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", From 274fe7d9d6afea8934be521e4acb44e87937450d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 18:04:56 +0200 Subject: [PATCH 21/55] Add testing kit to the root --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index af9c677b4..a1002b181 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,8 @@ "ts-jest": "^29.1.5", "ts-node": "^10.9.2", "tsc-alias": "^1.8.8", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "@safe-global/testing-kit": "^1.0.0" }, "lint-staged": { "./packages/**/*.{js,jsx,ts,tsx}": [ From 563473b4a39ad709aeeb7caa8e90c0aa80159702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 18:13:29 +0200 Subject: [PATCH 22/55] more tezsting --- .github/workflows/protocol-kit-e2e-test.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 99380e6de..5da87c6e6 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -31,9 +31,12 @@ jobs: run: | echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH ls -la $(pwd)/node_modules/.bin - cd packages/protocol-kit + cd packages/testing-kit echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH + echo "$(pwd)/dist/bin" >> $GITHUB_PATH ls -la $(pwd)/node_modules/.bin - printenv - find $(pwd)/node_modules -name testing-kit -type f + ls -la $(pwd)/dist/bin + cd ../protocol-kit + echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH + ls -la $(pwd)/node_modules/.bin yarn test:hardhat:${{ matrix.provider }}:${{ matrix.contract-version }} From b8817bc04c43f08a79a407c15cc40646897ec14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 18:27:35 +0200 Subject: [PATCH 23/55] try --force --- .github/workflows/protocol-kit-e2e-test.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 5da87c6e6..b7e537ebc 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -22,7 +22,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: | - yarn install --frozen-lockfile + yarn install --frozen-lockfile --force yarn build - name: Verify testing-kit installation run: | @@ -31,12 +31,9 @@ jobs: run: | echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH ls -la $(pwd)/node_modules/.bin - cd packages/testing-kit - echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH - echo "$(pwd)/dist/bin" >> $GITHUB_PATH ls -la $(pwd)/node_modules/.bin ls -la $(pwd)/dist/bin - cd ../protocol-kit + cd packages/protocol-kit echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH ls -la $(pwd)/node_modules/.bin yarn test:hardhat:${{ matrix.provider }}:${{ matrix.contract-version }} From f66309b7eff4fc45cec0c10fbddc0e159ddc03d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 18:31:38 +0200 Subject: [PATCH 24/55] REmove echoes --- .github/workflows/protocol-kit-e2e-test.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index b7e537ebc..a78b3be47 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -29,11 +29,6 @@ jobs: yarn list @safe-global/testing-kit - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | - echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH - ls -la $(pwd)/node_modules/.bin - ls -la $(pwd)/node_modules/.bin - ls -la $(pwd)/dist/bin cd packages/protocol-kit - echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH - ls -la $(pwd)/node_modules/.bin + ls -la $(pwd)/node_modules/.bin yarn test:hardhat:${{ matrix.provider }}:${{ matrix.contract-version }} From 3f08cc5302bc3a8c972327f07d1a7b78576c47ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 19:10:55 +0200 Subject: [PATCH 25/55] Remove --force --- .github/workflows/protocol-kit-e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index a78b3be47..d40c0f5c6 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -22,7 +22,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: | - yarn install --frozen-lockfile --force + yarn install --frozen-lockfile yarn build - name: Verify testing-kit installation run: | From 4b38bb8c20462585783543bf0452ea6e9e7a1da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 19:41:58 +0200 Subject: [PATCH 26/55] Try to ad manually to path --- .github/workflows/protocol-kit-e2e-test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index d40c0f5c6..ff4ead552 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -24,9 +24,11 @@ jobs: - run: | yarn install --frozen-lockfile yarn build - - name: Verify testing-kit installation + - name: Manually add testing-kit to PATH run: | - yarn list @safe-global/testing-kit + echo "packages/testing-kit/dist/bin" >> $GITHUB_PATH + ls -la $(pwd)/packages/testing-kit/dist/bin + - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit From e309e4924b412a1d43396b0af5b86a7ad650d82e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 19:45:03 +0200 Subject: [PATCH 27/55] concrete file --- .github/workflows/protocol-kit-e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index ff4ead552..3db6dcf16 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -26,7 +26,7 @@ jobs: yarn build - name: Manually add testing-kit to PATH run: | - echo "packages/testing-kit/dist/bin" >> $GITHUB_PATH + echo "packages/testing-kit/dist/bin/testing-kit.js" >> $GITHUB_PATH ls -la $(pwd)/packages/testing-kit/dist/bin - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} From d3d33b69b376709e09363062f6c97c1a36cead95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 20:18:52 +0200 Subject: [PATCH 28/55] Try with the script --- .github/workflows/protocol-kit-e2e-test.yml | 11 ++++---- packages/protocol-kit/package.json | 30 ++++++++++----------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 3db6dcf16..ee8a29c41 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -24,11 +24,12 @@ jobs: - run: | yarn install --frozen-lockfile yarn build - - name: Manually add testing-kit to PATH - run: | - echo "packages/testing-kit/dist/bin/testing-kit.js" >> $GITHUB_PATH - ls -la $(pwd)/packages/testing-kit/dist/bin - + - name: Make testing-kit.js executable + run: chmod +x packages/testing-kit/bin/testing-kit.js + - name: Add script directory to PATH + run: echo "$(pwd)/packages/testing-kit/bin" >> $GITHUB_PATH + - name: Debug PATH + run: echo $PATH - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index fc0edcb5f..53629e020 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -16,21 +16,21 @@ "update-safe-deployments": "ts-node scripts/safe-deployments/updateLocalNetworks.ts", "check-short-name-integrity": "ts-node scripts/safe-deployments/checkShortNameIntegrity.ts", "test": "mocha -r ts-node/register -r tsconfig-paths/register tests/unit/**/*.ts", - "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", "coverage": "nyc report --reporter=lcov", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", From a30ae86fae0ae7cf299dacd448a3eca48df1f07c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 27 Aug 2024 20:22:29 +0200 Subject: [PATCH 29/55] fix --- .github/workflows/protocol-kit-e2e-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index ee8a29c41..8bfdb2ef7 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -25,9 +25,9 @@ jobs: yarn install --frozen-lockfile yarn build - name: Make testing-kit.js executable - run: chmod +x packages/testing-kit/bin/testing-kit.js + run: chmod +x packages/testing-kit/dist/bin/testing-kit.js - name: Add script directory to PATH - run: echo "$(pwd)/packages/testing-kit/bin" >> $GITHUB_PATH + run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH - name: Debug PATH run: echo $PATH - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} From 610a084535cc282d8c8d673d6176a9e33b31f993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 28 Aug 2024 11:13:48 +0200 Subject: [PATCH 30/55] Remove hardhat --- packages/protocol-kit/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index 53629e020..f79a04058 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -64,7 +64,6 @@ "mocha": "^10.2.0", "nyc": "^15.1.0", "tsconfig-paths": "^4.2.0", - "hardhat": "^2.19.3", "web3": "^4.7.0", "yargs": "^17.7.2", "@safe-global/testing-kit": "^1.0.0" From b2ee1bb031df823d1d51a888283a56f7a35a0594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 28 Aug 2024 12:21:30 +0200 Subject: [PATCH 31/55] Update api-kit to use testing-kit --- .github/workflows/api-kit-e2e-test.yml | 6 + .github/workflows/protocol-kit-e2e-test.yml | 2 - .github/workflows/sdk-test.yml | 6 + packages/api-kit/.env.example | 3 +- packages/api-kit/hardhat.config.ts | 52 ---- packages/api-kit/package.json | 15 +- packages/api-kit/tsconfig.json | 2 +- yarn.lock | 257 +------------------- 8 files changed, 24 insertions(+), 319 deletions(-) delete mode 100644 packages/api-kit/hardhat.config.ts diff --git a/.github/workflows/api-kit-e2e-test.yml b/.github/workflows/api-kit-e2e-test.yml index b1e12d337..4c005b276 100644 --- a/.github/workflows/api-kit-e2e-test.yml +++ b/.github/workflows/api-kit-e2e-test.yml @@ -24,6 +24,12 @@ jobs: - name: Build run: yarn build + - name: Make testing-kit.js executable + run: chmod +x packages/testing-kit/dist/bin/testing-kit.js + + - name: Add script directory to PATH + run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH + - name: Test run: | cd packages/api-kit diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 8bfdb2ef7..8bd3b7490 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -28,8 +28,6 @@ jobs: run: chmod +x packages/testing-kit/dist/bin/testing-kit.js - name: Add script directory to PATH run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH - - name: Debug PATH - run: echo $PATH - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit diff --git a/.github/workflows/sdk-test.yml b/.github/workflows/sdk-test.yml index 6ad7e67c1..236c7d65a 100644 --- a/.github/workflows/sdk-test.yml +++ b/.github/workflows/sdk-test.yml @@ -25,6 +25,12 @@ jobs: - name: Build run: yarn build + - name: Make testing-kit.js executable + run: chmod +x packages/testing-kit/dist/bin/testing-kit.js + + - name: Add script directory to PATH + run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH + - name: Test env: PRIVATE_KEY: ${{ secrets.TESTING_PRIVATE_KEY }} diff --git a/packages/api-kit/.env.example b/packages/api-kit/.env.example index c519ed0be..01c40bd16 100644 --- a/packages/api-kit/.env.example +++ b/packages/api-kit/.env.example @@ -1,2 +1 @@ -MNEMONIC= -PK= \ No newline at end of file +INFURA_KEY= \ No newline at end of file diff --git a/packages/api-kit/hardhat.config.ts b/packages/api-kit/hardhat.config.ts deleted file mode 100644 index c5c5e2710..000000000 --- a/packages/api-kit/hardhat.config.ts +++ /dev/null @@ -1,52 +0,0 @@ -import '@nomicfoundation/hardhat-viem' -import dotenv from 'dotenv' -import { HardhatUserConfig, HttpNetworkUserConfig } from 'hardhat/types' -import yargs from 'yargs' - -import 'tsconfig-paths/register' - -yargs - .option('network', { - type: 'string', - default: 'hardhat' - }) - .help(false) - .version(false).argv - -dotenv.config() -const { MNEMONIC, PK, TESTS_PATH } = process.env -const DEFAULT_MNEMONIC = - 'myth like bonus scare over problem client lizard pioneer submit female collect' - -const sharedNetworkConfig: HttpNetworkUserConfig = {} -if (PK) { - sharedNetworkConfig.accounts = [PK] -} else { - sharedNetworkConfig.accounts = { - mnemonic: MNEMONIC || DEFAULT_MNEMONIC - } -} - -const config: HardhatUserConfig = { - defaultNetwork: 'sepolia', - paths: { - tests: TESTS_PATH - }, - networks: { - hardhat: { - allowUnlimitedContractSize: true, - blockGasLimit: 100000000, - gas: 100000000 - }, - sepolia: { - ...sharedNetworkConfig, - url: 'https://sepolia.gateway.tenderly.co' - } - }, - //@ts-expect-error Type not found - compilerOptions: { - paths: { '^@safe-global/protocol-kit/(.*)$': ['../protocol-kit/src/*'] } - } -} - -export default config diff --git a/packages/api-kit/package.json b/packages/api-kit/package.json index 98d72f5f1..d4dccc4a2 100644 --- a/packages/api-kit/package.json +++ b/packages/api-kit/package.json @@ -12,13 +12,13 @@ "API" ], "scripts": { - "test:web3": "export TESTS_PATH=tests/endpoint && export ETH_LIB=web3 && nyc --reporter=lcov hardhat test", - "test:ethers": "export TESTS_PATH=tests/endpoint && export ETH_LIB=ethers && nyc --reporter=lcov hardhat test", - "test:viem": "export TESTS_PATH=tests/endpoint && export ETH_LIB=viem && nyc --reporter=lcov hardhat test", + "test:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", + "test:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", + "test:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", "test": "yarn test:viem", - "test:ci:web3": "export TESTS_PATH=tests/e2e && export ETH_LIB=web3 && nyc --reporter=lcov hardhat test", - "test:ci:ethers": "export TESTS_PATH=tests/e2e && export ETH_LIB=ethers && nyc --reporter=lcov hardhat test", - "test:ci:viem": "export TESTS_PATH=tests/e2e && export ETH_LIB=viem && nyc --reporter=lcov hardhat test", + "test:ci:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", + "test:ci:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", + "test:ci:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", "test:ci": "yarn test:ci:viem", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", @@ -46,11 +46,9 @@ "@types/mocha": "^10.0.6", "@types/node-fetch": "^2.6.11", "@types/sinon-chai": "^3.2.11", - "@types/yargs": "^17.0.32", "chai": "^4.3.10", "chai-as-promised": "^7.1.1", "ethers": "^6.13.1", - "hardhat": "2.20.1", "mocha": "^10.2.0", "nyc": "^15.1.0", "semver": "^7.6.1", @@ -58,7 +56,6 @@ "sinon-chai": "^3.7.0", "tsconfig-paths": "^4.2.0", "web3": "^4.7.0", - "yargs": "^17.7.2", "@safe-global/testing-kit": "^1.0.0" }, "dependencies": { diff --git a/packages/api-kit/tsconfig.json b/packages/api-kit/tsconfig.json index 65d73d641..18bfaf51a 100644 --- a/packages/api-kit/tsconfig.json +++ b/packages/api-kit/tsconfig.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["src/**/*", "tests/**/*", "hardhat.config.ts"] + "include": ["src/**/*", "tests/**/*"] } diff --git a/yarn.lock b/yarn.lock index 26e5583c0..c44b824ad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1345,34 +1345,6 @@ "@nomicfoundation/edr-linux-x64-musl" "0.5.0" "@nomicfoundation/edr-win32-x64-msvc" "0.5.0" -"@nomicfoundation/ethereumjs-block@5.0.4": - version "5.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-block/-/ethereumjs-block-5.0.4.tgz#ff2acb98a86b9290e35e315a6abfb9aebb9cf39e" - integrity sha512-AcyacJ9eX/uPEvqsPiB+WO1ymE+kyH48qGGiGV+YTojdtas8itUTW5dehDSOXEEItWGbbzEJ4PRqnQZlWaPvDw== - dependencies: - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-trie" "6.0.4" - "@nomicfoundation/ethereumjs-tx" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - ethereum-cryptography "0.1.3" - -"@nomicfoundation/ethereumjs-blockchain@7.0.4": - version "7.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-blockchain/-/ethereumjs-blockchain-7.0.4.tgz#b77511b389290b186c8d999e70f4b15c27ef44ea" - integrity sha512-jYsd/kwzbmpnxx86tXsYV8wZ5xGvFL+7/P0c6OlzpClHsbFzeF41KrYA9scON8Rg6bZu3ZTv6JOAgj3t7USUfg== - dependencies: - "@nomicfoundation/ethereumjs-block" "5.0.4" - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-ethash" "3.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-trie" "6.0.4" - "@nomicfoundation/ethereumjs-tx" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - debug "^4.3.3" - ethereum-cryptography "0.1.3" - lru-cache "^10.0.0" - "@nomicfoundation/ethereumjs-common@4.0.4": version "4.0.4" resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.4.tgz#9901f513af2d4802da87c66d6f255b510bef5acb" @@ -1380,62 +1352,11 @@ dependencies: "@nomicfoundation/ethereumjs-util" "9.0.4" -"@nomicfoundation/ethereumjs-ethash@3.0.4": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-ethash/-/ethereumjs-ethash-3.0.4.tgz#06cb2502b3012fb6c11cffd44af08aecf71310da" - integrity sha512-xvIrwIMl9sSaiYKRem68+O7vYdj7Q2XWv5P7JXiIkn83918QzWHvqbswTRsH7+r6X1UEvdsURRnZbvZszEjAaQ== - dependencies: - "@nomicfoundation/ethereumjs-block" "5.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - bigint-crypto-utils "^3.2.2" - ethereum-cryptography "0.1.3" - -"@nomicfoundation/ethereumjs-evm@2.0.4": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-evm/-/ethereumjs-evm-2.0.4.tgz#c9c761767283ac53946185474362230b169f8f63" - integrity sha512-lTyZZi1KpeMHzaO6cSVisR2tjiTTedjo7PcmhI/+GNFo9BmyY6QYzGeSti0sFttmjbEMioHgXxl5yrLNRg6+1w== - dependencies: - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-statemanager" "2.0.4" - "@nomicfoundation/ethereumjs-tx" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - "@types/debug" "^4.1.9" - debug "^4.3.3" - ethereum-cryptography "0.1.3" - rustbn-wasm "^0.2.0" - "@nomicfoundation/ethereumjs-rlp@5.0.4": version "5.0.4" resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.4.tgz#66c95256fc3c909f6fb18f6a586475fc9762fa30" integrity sha512-8H1S3s8F6QueOc/X92SdrA4RDenpiAEqMg5vJH99kcQaCy/a3Q6fgseo75mgWlbanGJXSlAPtnCeG9jvfTYXlw== -"@nomicfoundation/ethereumjs-statemanager@2.0.4": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-statemanager/-/ethereumjs-statemanager-2.0.4.tgz#bf14415e1f31b5ea8b98a0c027c547d0555059b6" - integrity sha512-HPDjeFrxw6llEi+BzqXkZ+KkvFnTOPczuHBtk21hRlDiuKuZz32dPzlhpRsDBGV1b5JTmRDUVqCS1lp3Gghw4Q== - dependencies: - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-trie" "6.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - debug "^4.3.3" - ethereum-cryptography "0.1.3" - js-sdsl "^4.1.4" - lru-cache "^10.0.0" - -"@nomicfoundation/ethereumjs-trie@6.0.4": - version "6.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-trie/-/ethereumjs-trie-6.0.4.tgz#688a3f76646c209365ee6d959c3d7330ede5e609" - integrity sha512-3nSwQiFMvr2VFe/aZUyinuohYvtytUqZCUCvIWcPJ/BwJH6oQdZRB42aNFBJ/8nAh2s3OcroWpBLskzW01mFKA== - dependencies: - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - "@types/readable-stream" "^2.3.13" - ethereum-cryptography "0.1.3" - lru-cache "^10.0.0" - readable-stream "^3.6.0" - "@nomicfoundation/ethereumjs-tx@5.0.4": version "5.0.4" resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.4.tgz#b0ceb58c98cc34367d40a30d255d6315b2f456da" @@ -1454,33 +1375,6 @@ "@nomicfoundation/ethereumjs-rlp" "5.0.4" ethereum-cryptography "0.1.3" -"@nomicfoundation/ethereumjs-verkle@0.0.2": - version "0.0.2" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-verkle/-/ethereumjs-verkle-0.0.2.tgz#7686689edec775b2efea5a71548f417c18f7dea4" - integrity sha512-bjnfZElpYGK/XuuVRmLS3yDvr+cDs85D9oonZ0YUa5A3lgFgokWMp76zXrxX2jVQ0BfHaw12y860n1+iOi6yFQ== - dependencies: - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - lru-cache "^10.0.0" - rust-verkle-wasm "^0.0.1" - -"@nomicfoundation/ethereumjs-vm@7.0.4": - version "7.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-vm/-/ethereumjs-vm-7.0.4.tgz#e5a6eec4877dc62dda93003c6d7afd1fe4b9625b" - integrity sha512-gsA4IhmtWHI4BofKy3kio9W+dqZQs5Ji5mLjLYxHCkat+JQBUt5szjRKra2F9nGDJ2XcI/wWb0YWUFNgln4zRQ== - dependencies: - "@nomicfoundation/ethereumjs-block" "5.0.4" - "@nomicfoundation/ethereumjs-blockchain" "7.0.4" - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-evm" "2.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-statemanager" "2.0.4" - "@nomicfoundation/ethereumjs-trie" "6.0.4" - "@nomicfoundation/ethereumjs-tx" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - debug "^4.3.3" - ethereum-cryptography "0.1.3" - "@nomicfoundation/hardhat-viem@^2.0.2": version "2.0.2" resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-viem/-/hardhat-viem-2.0.2.tgz#91d7a6d3e66c93bc39b2322420a1bad82360df7d" @@ -1890,7 +1784,7 @@ "@safe-global/safe-contracts" "^1.4.1-build.0" cbor "^9.0.2" -"@scure/base@^1.1.1", "@scure/base@^1.1.3", "@scure/base@~1.1.0": +"@scure/base@^1.1.3", "@scure/base@~1.1.0": version "1.1.6" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.6.tgz#8ce5d304b436e4c84f896e0550c83e4d88cb917d" integrity sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g== @@ -2371,7 +2265,7 @@ resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.16.tgz#b1572967f0b8b60bf3f87fe1d854a5604ea70c82" integrity sha512-PatH4iOdyh3MyWtmHVFXLWCCIhUbopaltqddG9BzB+gMIzee2MJrvd+jouii9Z3wzQJruGWAm7WOMjgfG8hQlQ== -"@types/debug@^4.1.7", "@types/debug@^4.1.9": +"@types/debug@^4.1.7": version "4.1.12" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" integrity sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ== @@ -2483,14 +2377,6 @@ resolved "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz" integrity sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw== -"@types/readable-stream@^2.3.13": - version "2.3.15" - resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-2.3.15.tgz#3d79c9ceb1b6a57d5f6e6976f489b9b5384321ae" - integrity sha512-oM5JSKQCcICF1wvGgmecmHldZ48OZamtMxcGGVICOJA8o8cahXC1zEVAif8iwoc5j8etxFaRFnf095+CDsuoFQ== - dependencies: - "@types/node" "*" - safe-buffer "~5.1.1" - "@types/secp256k1@^4.0.1": version "4.0.3" resolved "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz" @@ -3165,11 +3051,6 @@ before-after-hook@^2.2.0: resolved "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz" integrity sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ== -bigint-crypto-utils@^3.2.2: - version "3.3.0" - resolved "https://registry.yarnpkg.com/bigint-crypto-utils/-/bigint-crypto-utils-3.3.0.tgz#72ad00ae91062cf07f2b1def9594006c279c1d77" - integrity sha512-jOTSb+drvEDxEq6OuUybOAv/xxoh3cuYRUIPyu8sSHQNKM303UQ2R1DAo45o1AkcIXw6fzbaFI1+xGGdaXs2lg== - bignumber.js@^9.1.2: version "9.1.2" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" @@ -3800,11 +3681,6 @@ command-exists@^1.2.8: resolved "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz" integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== -commander@3.0.2: - version "3.0.2" - resolved "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz" - integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== - commander@^8.1.0: version "8.3.0" resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" @@ -5141,17 +5017,6 @@ fs-constants@^1.0.0: resolved "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@^0.30.0: - version "0.30.0" - resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz" - integrity sha512-UvSPKyhMn6LEd/WpUaV9C9t3zATuqoqfWc3QdPhPLb58prN9tqYPlPWi8Krxi44loBoUzlobqZ3+8tGpxxSzwA== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^2.1.0" - klaw "^1.0.0" - path-is-absolute "^1.0.0" - rimraf "^2.2.8" - fs-extra@^10.0.0: version "10.1.0" resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz" @@ -5471,7 +5336,7 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" -graceful-fs@4.2.11, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9: +graceful-fs@4.2.11, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== @@ -5528,62 +5393,6 @@ hardhat-deploy@^0.12.4: qs "^6.9.4" zksync-ethers "^5.0.0" -hardhat@2.20.1: - version "2.20.1" - resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.20.1.tgz#3ad8f2b003a96c9ce80a55fec3575580ff2ddcd4" - integrity sha512-q75xDQiQtCZcTMBwjTovrXEU5ECr49baxr4/OBkIu/ULTPzlB20yk1dRWNmD2IFbAeAeXggaWvQAdpiScaHtPw== - dependencies: - "@ethersproject/abi" "^5.1.2" - "@metamask/eth-sig-util" "^4.0.0" - "@nomicfoundation/ethereumjs-block" "5.0.4" - "@nomicfoundation/ethereumjs-blockchain" "7.0.4" - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-evm" "2.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-statemanager" "2.0.4" - "@nomicfoundation/ethereumjs-trie" "6.0.4" - "@nomicfoundation/ethereumjs-tx" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - "@nomicfoundation/ethereumjs-verkle" "0.0.2" - "@nomicfoundation/ethereumjs-vm" "7.0.4" - "@nomicfoundation/solidity-analyzer" "^0.1.0" - "@sentry/node" "^5.18.1" - "@types/bn.js" "^5.1.0" - "@types/lru-cache" "^5.1.0" - adm-zip "^0.4.16" - aggregate-error "^3.0.0" - ansi-escapes "^4.3.0" - boxen "^5.1.2" - chalk "^2.4.2" - chokidar "^3.4.0" - ci-info "^2.0.0" - debug "^4.1.1" - enquirer "^2.3.0" - env-paths "^2.2.0" - ethereum-cryptography "^1.0.3" - ethereumjs-abi "^0.6.8" - find-up "^2.1.0" - fp-ts "1.19.3" - fs-extra "^7.0.1" - glob "7.2.0" - immutable "^4.0.0-rc.12" - io-ts "1.10.4" - keccak "^3.0.2" - lodash "^4.17.11" - mnemonist "^0.38.0" - mocha "^10.0.0" - p-map "^4.0.0" - raw-body "^2.4.1" - resolve "1.17.0" - semver "^6.3.0" - solc "0.7.3" - source-map-support "^0.5.13" - stacktrace-parser "^0.1.10" - tsort "0.0.1" - undici "^5.14.0" - uuid "^8.3.2" - ws "^7.4.6" - hardhat@^2.19.3: version "2.22.7" resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.7.tgz#3de0ce5074063cf468876c5e62f84c66d2408e8e" @@ -6858,11 +6667,6 @@ jest@^29.7.0: import-local "^3.0.2" jest-cli "^29.7.0" -js-sdsl@^4.1.4: - version "4.4.2" - resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.4.2.tgz#2e3c031b1f47d3aca8b775532e3ebb0818e7f847" - integrity sha512-dwXFwByc/ajSV6m5bcKAPwe4yDDF6D614pxmIi5odytzxRlwqF6nwoiCek80Ixc7Cvma5awClxrzFtxCQvcM8w== - js-sha3@0.8.0: version "0.8.0" resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz" @@ -6980,13 +6784,6 @@ jsonc-parser@3.2.0: resolved "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz" integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== -jsonfile@^2.1.0: - version "2.4.0" - resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz" - integrity sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw== - optionalDependencies: - graceful-fs "^4.1.6" - jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz" @@ -7051,13 +6848,6 @@ kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== -klaw@^1.0.0: - version "1.3.1" - resolved "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz" - integrity sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw== - optionalDependencies: - graceful-fs "^4.1.9" - kleur@^3.0.3: version "3.0.3" resolved "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz" @@ -7339,7 +7129,7 @@ loupe@^2.3.6: dependencies: get-func-name "^2.0.0" -lru-cache@^10.0.0, lru-cache@^10.0.1, lru-cache@^10.2.0: +lru-cache@^10.0.1, lru-cache@^10.2.0: version "10.4.3" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== @@ -9130,11 +8920,6 @@ require-directory@^2.1.1: resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -require-from-string@^2.0.0: - version "2.0.2" - resolved "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz" - integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== - require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz" @@ -9233,13 +9018,6 @@ rfdc@^1.3.1: resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.4.1.tgz#778f76c4fb731d93414e8f925fbecf64cce7f6ca" integrity sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA== -rimraf@^2.2.8: - version "2.7.1" - resolved "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" @@ -9281,18 +9059,6 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -rust-verkle-wasm@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/rust-verkle-wasm/-/rust-verkle-wasm-0.0.1.tgz#fd8396a7060d8ee8ea10da50ab6e862948095a74" - integrity sha512-BN6fiTsxcd2dCECz/cHtGTt9cdLJR925nh7iAuRcj8ymKw7OOaPmCneQZ7JePOJ/ia27TjEL91VdOi88Yf+mcA== - -rustbn-wasm@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/rustbn-wasm/-/rustbn-wasm-0.2.0.tgz#0407521fb55ae69eeb4968d01885d63efd1c4ff9" - integrity sha512-FThvYFNTqrEKGqXuseeg0zR7yROh/6U1617mCHF68OVqrN1tNKRN7Tdwy4WayPVsCmmK+eMxtIZX1qL6JxTkMg== - dependencies: - "@scure/base" "^1.1.1" - rxjs@^7.5.5: version "7.8.0" resolved "https://registry.npmjs.org/rxjs/-/rxjs-7.8.0.tgz" @@ -9603,21 +9369,6 @@ socks@^2.6.2, socks@^2.7.1: ip-address "^9.0.5" smart-buffer "^4.2.0" -solc@0.7.3: - version "0.7.3" - resolved "https://registry.npmjs.org/solc/-/solc-0.7.3.tgz" - integrity sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA== - dependencies: - command-exists "^1.2.8" - commander "3.0.2" - follow-redirects "^1.12.1" - fs-extra "^0.30.0" - js-sha3 "0.8.0" - memorystream "^0.3.1" - require-from-string "^2.0.0" - semver "^5.5.0" - tmp "0.0.33" - solc@0.8.26: version "0.8.26" resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.26.tgz#afc78078953f6ab3e727c338a2fefcd80dd5b01a" From 5d663471774ec1d6c5904a2357052c861eb6a379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 28 Aug 2024 13:27:52 +0200 Subject: [PATCH 32/55] Add hardhat as peer for testing-kit --- packages/testing-kit/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index a89aa5492..04e5750cc 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -48,5 +48,8 @@ }, "bin": { "testing-kit": "./dist/bin/testing-kit.js" + }, + "peerDependencies": { + "hardhat": "^2.19.3" } } From 841b21cd9830ac950685b27a10e49fd4987418a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 28 Aug 2024 16:11:17 +0200 Subject: [PATCH 33/55] Remove @ts-expect-error --- packages/testing-kit/hardhat.config.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/testing-kit/hardhat.config.ts b/packages/testing-kit/hardhat.config.ts index 8985680fa..b0cdd66cf 100644 --- a/packages/testing-kit/hardhat.config.ts +++ b/packages/testing-kit/hardhat.config.ts @@ -105,10 +105,6 @@ const config: HardhatUserConfig = { url: 'https://sepolia.gateway.tenderly.co' } }, - //@ts-expect-error Type not found - compilerOptions: { - paths: { '^@safe-global/protocol-kit/(.*)$': ['../protocol-kit/src/*'] } - }, namedAccounts: { deployer: { default: 0 From e1ce2c16ae7760f8d67dc4544b19275f95e4167f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 29 Aug 2024 10:57:31 +0200 Subject: [PATCH 34/55] Move files around --- packages/testing-kit/hardhat.config.ts | 6 +++--- packages/testing-kit/index.ts | 1 - packages/testing-kit/package.json | 4 ++-- packages/testing-kit/{ => src}/contracts/Deps_V1_0_0.sol | 0 packages/testing-kit/{ => src}/contracts/Deps_V1_1_1.sol | 0 packages/testing-kit/{ => src}/contracts/Deps_V1_2_0.sol | 0 packages/testing-kit/{ => src}/contracts/Deps_V1_3_0.sol | 0 packages/testing-kit/{ => src}/contracts/Deps_V1_4_1.sol | 0 packages/testing-kit/{ => src}/contracts/Deps_passkeys.sol | 0 .../{ => src}/contracts/safe_V1_0_0/GnosisSafe.sol | 0 .../{ => src}/contracts/safe_V1_0_0/Migrations.sol | 0 .../{ => src}/contracts/safe_V1_0_0/base/BaseSafe.sol | 0 .../{ => src}/contracts/safe_V1_0_0/base/Executor.sol | 0 .../{ => src}/contracts/safe_V1_0_0/base/Module.sol | 0 .../{ => src}/contracts/safe_V1_0_0/base/ModuleManager.sol | 0 .../{ => src}/contracts/safe_V1_0_0/base/OwnerManager.sol | 0 .../{ => src}/contracts/safe_V1_0_0/common/Enum.sol | 0 .../contracts/safe_V1_0_0/common/EtherPaymentFallback.sol | 0 .../{ => src}/contracts/safe_V1_0_0/common/MasterCopy.sol | 0 .../contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol | 0 .../contracts/safe_V1_0_0/common/SelfAuthorized.sol | 0 .../contracts/safe_V1_0_0/common/SignatureDecoder.sol | 0 .../{ => src}/contracts/safe_V1_0_0/external/SafeMath.sol | 0 .../safe_V1_0_0/interfaces/ISignatureValidator.sol | 0 .../contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol | 0 .../{ => src}/contracts/safe_V1_0_0/libraries/MultiSend.sol | 0 .../safe_V1_0_0/proxies/DelegateConstructorProxy.sol | 0 .../{ => src}/contracts/safe_V1_0_0/proxies/PayingProxy.sol | 0 .../{ => src}/contracts/safe_V1_0_0/proxies/Proxy.sol | 0 .../contracts/safe_V1_0_0/proxies/ProxyFactory.sol | 0 .../{ => src}/contracts/safe_V1_1_1/GnosisSafe.sol | 0 .../{ => src}/contracts/safe_V1_1_1/Migrations.sol | 0 .../{ => src}/contracts/safe_V1_1_1/base/Executor.sol | 0 .../contracts/safe_V1_1_1/base/FallbackManager.sol | 0 .../{ => src}/contracts/safe_V1_1_1/base/Module.sol | 0 .../{ => src}/contracts/safe_V1_1_1/base/ModuleManager.sol | 0 .../{ => src}/contracts/safe_V1_1_1/base/OwnerManager.sol | 0 .../{ => src}/contracts/safe_V1_1_1/common/Enum.sol | 0 .../contracts/safe_V1_1_1/common/EtherPaymentFallback.sol | 0 .../{ => src}/contracts/safe_V1_1_1/common/MasterCopy.sol | 0 .../contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol | 0 .../contracts/safe_V1_1_1/common/SelfAuthorized.sol | 0 .../contracts/safe_V1_1_1/common/SignatureDecoder.sol | 0 .../{ => src}/contracts/safe_V1_1_1/external/SafeMath.sol | 0 .../safe_V1_1_1/handler/DefaultCallbackHandler.sol | 0 .../safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol | 0 .../safe_V1_1_1/interfaces/ERC721TokenReceiver.sol | 0 .../safe_V1_1_1/interfaces/ERC777TokensRecipient.sol | 0 .../safe_V1_1_1/interfaces/ISignatureValidator.sol | 0 .../contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol | 0 .../contracts/safe_V1_1_1/libraries/CreateCall.sol | 0 .../{ => src}/contracts/safe_V1_1_1/libraries/MultiSend.sol | 0 .../safe_V1_1_1/proxies/DelegateConstructorProxy.sol | 0 .../safe_V1_1_1/proxies/IProxyCreationCallback.sol | 0 .../{ => src}/contracts/safe_V1_1_1/proxies/PayingProxy.sol | 0 .../{ => src}/contracts/safe_V1_1_1/proxies/Proxy.sol | 0 .../contracts/safe_V1_1_1/proxies/ProxyFactory.sol | 0 .../{ => src}/contracts/safe_V1_2_0/GnosisSafe.sol | 0 .../{ => src}/contracts/safe_V1_2_0/Migrations.sol | 0 .../{ => src}/contracts/safe_V1_2_0/base/Executor.sol | 0 .../contracts/safe_V1_2_0/base/FallbackManager.sol | 0 .../{ => src}/contracts/safe_V1_2_0/base/Module.sol | 0 .../{ => src}/contracts/safe_V1_2_0/base/ModuleManager.sol | 0 .../{ => src}/contracts/safe_V1_2_0/base/OwnerManager.sol | 0 .../{ => src}/contracts/safe_V1_2_0/common/Enum.sol | 0 .../contracts/safe_V1_2_0/common/EtherPaymentFallback.sol | 0 .../{ => src}/contracts/safe_V1_2_0/common/MasterCopy.sol | 0 .../contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol | 0 .../contracts/safe_V1_2_0/common/SelfAuthorized.sol | 0 .../contracts/safe_V1_2_0/common/SignatureDecoder.sol | 0 .../contracts/safe_V1_2_0/external/GnosisSafeMath.sol | 0 .../safe_V1_2_0/handler/DefaultCallbackHandler.sol | 0 .../safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol | 0 .../safe_V1_2_0/interfaces/ERC721TokenReceiver.sol | 0 .../safe_V1_2_0/interfaces/ERC777TokensRecipient.sol | 0 .../safe_V1_2_0/interfaces/ISignatureValidator.sol | 0 .../contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol | 0 .../contracts/safe_V1_2_0/libraries/CreateCall.sol | 0 .../{ => src}/contracts/safe_V1_2_0/libraries/MultiSend.sol | 0 .../contracts/safe_V1_2_0/modules/DailyLimitModule.sol | 0 .../contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol | 0 .../contracts/safe_V1_2_0/modules/StateChannelModule.sol | 0 .../contracts/safe_V1_2_0/modules/WhitelistModule.sol | 0 .../safe_V1_2_0/proxies/DelegateConstructorProxy.sol | 0 .../contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol | 0 .../safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol | 0 .../safe_V1_2_0/proxies/IProxyCreationCallback.sol | 0 .../{ => src}/contracts/safe_V1_2_0/proxies/PayingProxy.sol | 0 .../testing-kit/{hardhat => src}/deploy/deploy-contracts.ts | 0 packages/testing-kit/src/index.ts | 1 + packages/testing-kit/tsconfig.build.json | 2 +- packages/testing-kit/tsconfig.json | 2 +- 92 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 packages/testing-kit/index.ts rename packages/testing-kit/{ => src}/contracts/Deps_V1_0_0.sol (100%) rename packages/testing-kit/{ => src}/contracts/Deps_V1_1_1.sol (100%) rename packages/testing-kit/{ => src}/contracts/Deps_V1_2_0.sol (100%) rename packages/testing-kit/{ => src}/contracts/Deps_V1_3_0.sol (100%) rename packages/testing-kit/{ => src}/contracts/Deps_V1_4_1.sol (100%) rename packages/testing-kit/{ => src}/contracts/Deps_passkeys.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/GnosisSafe.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/Migrations.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/base/BaseSafe.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/base/Executor.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/base/Module.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/base/ModuleManager.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/base/OwnerManager.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/common/Enum.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/common/MasterCopy.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/common/SelfAuthorized.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/common/SignatureDecoder.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/external/SafeMath.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/libraries/MultiSend.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/proxies/PayingProxy.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/proxies/Proxy.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_0_0/proxies/ProxyFactory.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/GnosisSafe.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/Migrations.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/base/Executor.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/base/FallbackManager.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/base/Module.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/base/ModuleManager.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/base/OwnerManager.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/common/Enum.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/common/MasterCopy.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/common/SelfAuthorized.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/common/SignatureDecoder.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/external/SafeMath.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/libraries/CreateCall.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/libraries/MultiSend.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/proxies/PayingProxy.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/proxies/Proxy.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_1_1/proxies/ProxyFactory.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/GnosisSafe.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/Migrations.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/base/Executor.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/base/FallbackManager.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/base/Module.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/base/ModuleManager.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/base/OwnerManager.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/common/Enum.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/common/MasterCopy.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/common/SelfAuthorized.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/common/SignatureDecoder.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/external/GnosisSafeMath.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/libraries/CreateCall.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/libraries/MultiSend.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/modules/DailyLimitModule.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/modules/StateChannelModule.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/modules/WhitelistModule.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol (100%) rename packages/testing-kit/{ => src}/contracts/safe_V1_2_0/proxies/PayingProxy.sol (100%) rename packages/testing-kit/{hardhat => src}/deploy/deploy-contracts.ts (100%) create mode 100644 packages/testing-kit/src/index.ts diff --git a/packages/testing-kit/hardhat.config.ts b/packages/testing-kit/hardhat.config.ts index b0cdd66cf..e22890455 100644 --- a/packages/testing-kit/hardhat.config.ts +++ b/packages/testing-kit/hardhat.config.ts @@ -45,9 +45,9 @@ const config: HardhatUserConfig = { } }, paths: { - artifacts: path.resolve(__dirname, './artifacts'), - deploy: path.resolve(__dirname, './hardhat/deploy'), - sources: path.resolve(__dirname, './contracts') + artifacts: path.resolve(__dirname, 'artifacts'), + deploy: path.resolve(__dirname, 'src/deploy'), + sources: path.resolve(__dirname, './src/contracts') }, networks: { localhost: { diff --git a/packages/testing-kit/index.ts b/packages/testing-kit/index.ts deleted file mode 100644 index aee0f3194..000000000 --- a/packages/testing-kit/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './hardhat/deploy/deploy-contracts' diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index 04e5750cc..5d144bab6 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -2,8 +2,8 @@ "name": "@safe-global/testing-kit", "version": "1.0.0", "description": "Helper package providing testing utilities", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "dist/src/index.js", + "types": "dist/src/index.d.ts", "keywords": [ "Ethereum", "Wallet", diff --git a/packages/testing-kit/contracts/Deps_V1_0_0.sol b/packages/testing-kit/src/contracts/Deps_V1_0_0.sol similarity index 100% rename from packages/testing-kit/contracts/Deps_V1_0_0.sol rename to packages/testing-kit/src/contracts/Deps_V1_0_0.sol diff --git a/packages/testing-kit/contracts/Deps_V1_1_1.sol b/packages/testing-kit/src/contracts/Deps_V1_1_1.sol similarity index 100% rename from packages/testing-kit/contracts/Deps_V1_1_1.sol rename to packages/testing-kit/src/contracts/Deps_V1_1_1.sol diff --git a/packages/testing-kit/contracts/Deps_V1_2_0.sol b/packages/testing-kit/src/contracts/Deps_V1_2_0.sol similarity index 100% rename from packages/testing-kit/contracts/Deps_V1_2_0.sol rename to packages/testing-kit/src/contracts/Deps_V1_2_0.sol diff --git a/packages/testing-kit/contracts/Deps_V1_3_0.sol b/packages/testing-kit/src/contracts/Deps_V1_3_0.sol similarity index 100% rename from packages/testing-kit/contracts/Deps_V1_3_0.sol rename to packages/testing-kit/src/contracts/Deps_V1_3_0.sol diff --git a/packages/testing-kit/contracts/Deps_V1_4_1.sol b/packages/testing-kit/src/contracts/Deps_V1_4_1.sol similarity index 100% rename from packages/testing-kit/contracts/Deps_V1_4_1.sol rename to packages/testing-kit/src/contracts/Deps_V1_4_1.sol diff --git a/packages/testing-kit/contracts/Deps_passkeys.sol b/packages/testing-kit/src/contracts/Deps_passkeys.sol similarity index 100% rename from packages/testing-kit/contracts/Deps_passkeys.sol rename to packages/testing-kit/src/contracts/Deps_passkeys.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/GnosisSafe.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/GnosisSafe.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/GnosisSafe.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/GnosisSafe.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/Migrations.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/Migrations.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/Migrations.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/Migrations.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/base/BaseSafe.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/base/BaseSafe.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/base/BaseSafe.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/base/BaseSafe.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/base/Executor.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/base/Executor.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/base/Executor.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/base/Executor.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/base/Module.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/base/Module.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/base/Module.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/base/Module.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/base/ModuleManager.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/base/ModuleManager.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/base/ModuleManager.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/base/ModuleManager.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/base/OwnerManager.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/base/OwnerManager.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/base/OwnerManager.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/base/OwnerManager.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/common/Enum.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/Enum.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/common/Enum.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/common/Enum.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/common/MasterCopy.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/MasterCopy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/common/MasterCopy.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/common/MasterCopy.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/common/SelfAuthorized.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/SelfAuthorized.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/common/SelfAuthorized.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/common/SelfAuthorized.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/common/SignatureDecoder.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/common/SignatureDecoder.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/common/SignatureDecoder.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/common/SignatureDecoder.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/external/SafeMath.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/external/SafeMath.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/external/SafeMath.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/external/SafeMath.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/libraries/MultiSend.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/MultiSend.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/libraries/MultiSend.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/libraries/MultiSend.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/proxies/PayingProxy.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/PayingProxy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/proxies/PayingProxy.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/proxies/PayingProxy.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/proxies/Proxy.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/Proxy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/proxies/Proxy.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/proxies/Proxy.sol diff --git a/packages/testing-kit/contracts/safe_V1_0_0/proxies/ProxyFactory.sol b/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/ProxyFactory.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_0_0/proxies/ProxyFactory.sol rename to packages/testing-kit/src/contracts/safe_V1_0_0/proxies/ProxyFactory.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/GnosisSafe.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/GnosisSafe.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/GnosisSafe.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/GnosisSafe.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/Migrations.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/Migrations.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/Migrations.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/Migrations.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/base/Executor.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/base/Executor.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/base/Executor.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/base/Executor.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/base/FallbackManager.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/base/FallbackManager.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/base/FallbackManager.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/base/FallbackManager.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/base/Module.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/base/Module.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/base/Module.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/base/Module.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/base/ModuleManager.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/base/ModuleManager.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/base/ModuleManager.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/base/ModuleManager.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/base/OwnerManager.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/base/OwnerManager.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/base/OwnerManager.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/base/OwnerManager.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/common/Enum.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/Enum.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/common/Enum.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/common/Enum.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/common/MasterCopy.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/MasterCopy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/common/MasterCopy.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/common/MasterCopy.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/common/SelfAuthorized.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/SelfAuthorized.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/common/SelfAuthorized.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/common/SelfAuthorized.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/common/SignatureDecoder.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/common/SignatureDecoder.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/common/SignatureDecoder.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/common/SignatureDecoder.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/external/SafeMath.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/external/SafeMath.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/external/SafeMath.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/external/SafeMath.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateCall.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateCall.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateCall.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateCall.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/libraries/MultiSend.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/MultiSend.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/libraries/MultiSend.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/libraries/MultiSend.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/proxies/PayingProxy.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/PayingProxy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/proxies/PayingProxy.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/proxies/PayingProxy.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/proxies/Proxy.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/Proxy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/proxies/Proxy.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/proxies/Proxy.sol diff --git a/packages/testing-kit/contracts/safe_V1_1_1/proxies/ProxyFactory.sol b/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/ProxyFactory.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_1_1/proxies/ProxyFactory.sol rename to packages/testing-kit/src/contracts/safe_V1_1_1/proxies/ProxyFactory.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/GnosisSafe.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/GnosisSafe.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/GnosisSafe.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/GnosisSafe.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/Migrations.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/Migrations.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/Migrations.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/Migrations.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/base/Executor.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/base/Executor.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/base/Executor.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/base/Executor.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/base/FallbackManager.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/base/FallbackManager.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/base/FallbackManager.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/base/FallbackManager.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/base/Module.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/base/Module.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/base/Module.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/base/Module.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/base/ModuleManager.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/base/ModuleManager.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/base/ModuleManager.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/base/ModuleManager.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/base/OwnerManager.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/base/OwnerManager.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/base/OwnerManager.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/base/OwnerManager.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/common/Enum.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/Enum.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/common/Enum.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/common/Enum.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/common/MasterCopy.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/MasterCopy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/common/MasterCopy.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/common/MasterCopy.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/common/SelfAuthorized.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/SelfAuthorized.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/common/SelfAuthorized.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/common/SelfAuthorized.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/common/SignatureDecoder.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/common/SignatureDecoder.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/common/SignatureDecoder.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/common/SignatureDecoder.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/external/GnosisSafeMath.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/external/GnosisSafeMath.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/external/GnosisSafeMath.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/external/GnosisSafeMath.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateCall.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateCall.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateCall.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateCall.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/libraries/MultiSend.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/MultiSend.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/libraries/MultiSend.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/libraries/MultiSend.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/modules/DailyLimitModule.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/DailyLimitModule.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/modules/DailyLimitModule.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/modules/DailyLimitModule.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/modules/StateChannelModule.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/StateChannelModule.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/modules/StateChannelModule.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/modules/StateChannelModule.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/modules/WhitelistModule.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/modules/WhitelistModule.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/modules/WhitelistModule.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/modules/WhitelistModule.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol diff --git a/packages/testing-kit/contracts/safe_V1_2_0/proxies/PayingProxy.sol b/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/PayingProxy.sol similarity index 100% rename from packages/testing-kit/contracts/safe_V1_2_0/proxies/PayingProxy.sol rename to packages/testing-kit/src/contracts/safe_V1_2_0/proxies/PayingProxy.sol diff --git a/packages/testing-kit/hardhat/deploy/deploy-contracts.ts b/packages/testing-kit/src/deploy/deploy-contracts.ts similarity index 100% rename from packages/testing-kit/hardhat/deploy/deploy-contracts.ts rename to packages/testing-kit/src/deploy/deploy-contracts.ts diff --git a/packages/testing-kit/src/index.ts b/packages/testing-kit/src/index.ts new file mode 100644 index 000000000..1c3907f47 --- /dev/null +++ b/packages/testing-kit/src/index.ts @@ -0,0 +1 @@ +export * from './deploy/deploy-contracts' diff --git a/packages/testing-kit/tsconfig.build.json b/packages/testing-kit/tsconfig.build.json index 22c319a8e..c35515726 100644 --- a/packages/testing-kit/tsconfig.build.json +++ b/packages/testing-kit/tsconfig.build.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["bin/**/*", "hardhat/**/*", "./index.ts"] + "include": ["bin/**/*", "src/**/*"] } diff --git a/packages/testing-kit/tsconfig.json b/packages/testing-kit/tsconfig.json index bd596e285..f15cccd2a 100644 --- a/packages/testing-kit/tsconfig.json +++ b/packages/testing-kit/tsconfig.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["./hardhat.config.ts", "bin/**/*", "hardhat/**/*", "./index.ts"] + "include": ["./hardhat.config.ts", "bin/**/*", "src/**/*"] } From 29270727e47b9b48c5073184612aaf75892e641d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 29 Aug 2024 11:31:23 +0200 Subject: [PATCH 35/55] Revert "Move files around" This reverts commit 2ace5b5c8d3b49f734f5af56ba7ecacdb736dc12. --- packages/testing-kit/{src => }/contracts/Deps_V1_0_0.sol | 0 packages/testing-kit/{src => }/contracts/Deps_V1_1_1.sol | 0 packages/testing-kit/{src => }/contracts/Deps_V1_2_0.sol | 0 packages/testing-kit/{src => }/contracts/Deps_V1_3_0.sol | 0 packages/testing-kit/{src => }/contracts/Deps_V1_4_1.sol | 0 packages/testing-kit/{src => }/contracts/Deps_passkeys.sol | 0 .../{src => }/contracts/safe_V1_0_0/GnosisSafe.sol | 0 .../{src => }/contracts/safe_V1_0_0/Migrations.sol | 0 .../{src => }/contracts/safe_V1_0_0/base/BaseSafe.sol | 0 .../{src => }/contracts/safe_V1_0_0/base/Executor.sol | 0 .../{src => }/contracts/safe_V1_0_0/base/Module.sol | 0 .../{src => }/contracts/safe_V1_0_0/base/ModuleManager.sol | 0 .../{src => }/contracts/safe_V1_0_0/base/OwnerManager.sol | 0 .../{src => }/contracts/safe_V1_0_0/common/Enum.sol | 0 .../contracts/safe_V1_0_0/common/EtherPaymentFallback.sol | 0 .../{src => }/contracts/safe_V1_0_0/common/MasterCopy.sol | 0 .../contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol | 0 .../contracts/safe_V1_0_0/common/SelfAuthorized.sol | 0 .../contracts/safe_V1_0_0/common/SignatureDecoder.sol | 0 .../{src => }/contracts/safe_V1_0_0/external/SafeMath.sol | 0 .../safe_V1_0_0/interfaces/ISignatureValidator.sol | 0 .../contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol | 0 .../{src => }/contracts/safe_V1_0_0/libraries/MultiSend.sol | 0 .../safe_V1_0_0/proxies/DelegateConstructorProxy.sol | 0 .../{src => }/contracts/safe_V1_0_0/proxies/PayingProxy.sol | 0 .../{src => }/contracts/safe_V1_0_0/proxies/Proxy.sol | 0 .../contracts/safe_V1_0_0/proxies/ProxyFactory.sol | 0 .../{src => }/contracts/safe_V1_1_1/GnosisSafe.sol | 0 .../{src => }/contracts/safe_V1_1_1/Migrations.sol | 0 .../{src => }/contracts/safe_V1_1_1/base/Executor.sol | 0 .../contracts/safe_V1_1_1/base/FallbackManager.sol | 0 .../{src => }/contracts/safe_V1_1_1/base/Module.sol | 0 .../{src => }/contracts/safe_V1_1_1/base/ModuleManager.sol | 0 .../{src => }/contracts/safe_V1_1_1/base/OwnerManager.sol | 0 .../{src => }/contracts/safe_V1_1_1/common/Enum.sol | 0 .../contracts/safe_V1_1_1/common/EtherPaymentFallback.sol | 0 .../{src => }/contracts/safe_V1_1_1/common/MasterCopy.sol | 0 .../contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol | 0 .../contracts/safe_V1_1_1/common/SelfAuthorized.sol | 0 .../contracts/safe_V1_1_1/common/SignatureDecoder.sol | 0 .../{src => }/contracts/safe_V1_1_1/external/SafeMath.sol | 0 .../safe_V1_1_1/handler/DefaultCallbackHandler.sol | 0 .../safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol | 0 .../safe_V1_1_1/interfaces/ERC721TokenReceiver.sol | 0 .../safe_V1_1_1/interfaces/ERC777TokensRecipient.sol | 0 .../safe_V1_1_1/interfaces/ISignatureValidator.sol | 0 .../contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol | 0 .../contracts/safe_V1_1_1/libraries/CreateCall.sol | 0 .../{src => }/contracts/safe_V1_1_1/libraries/MultiSend.sol | 0 .../safe_V1_1_1/proxies/DelegateConstructorProxy.sol | 0 .../safe_V1_1_1/proxies/IProxyCreationCallback.sol | 0 .../{src => }/contracts/safe_V1_1_1/proxies/PayingProxy.sol | 0 .../{src => }/contracts/safe_V1_1_1/proxies/Proxy.sol | 0 .../contracts/safe_V1_1_1/proxies/ProxyFactory.sol | 0 .../{src => }/contracts/safe_V1_2_0/GnosisSafe.sol | 0 .../{src => }/contracts/safe_V1_2_0/Migrations.sol | 0 .../{src => }/contracts/safe_V1_2_0/base/Executor.sol | 0 .../contracts/safe_V1_2_0/base/FallbackManager.sol | 0 .../{src => }/contracts/safe_V1_2_0/base/Module.sol | 0 .../{src => }/contracts/safe_V1_2_0/base/ModuleManager.sol | 0 .../{src => }/contracts/safe_V1_2_0/base/OwnerManager.sol | 0 .../{src => }/contracts/safe_V1_2_0/common/Enum.sol | 0 .../contracts/safe_V1_2_0/common/EtherPaymentFallback.sol | 0 .../{src => }/contracts/safe_V1_2_0/common/MasterCopy.sol | 0 .../contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol | 0 .../contracts/safe_V1_2_0/common/SelfAuthorized.sol | 0 .../contracts/safe_V1_2_0/common/SignatureDecoder.sol | 0 .../contracts/safe_V1_2_0/external/GnosisSafeMath.sol | 0 .../safe_V1_2_0/handler/DefaultCallbackHandler.sol | 0 .../safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol | 0 .../safe_V1_2_0/interfaces/ERC721TokenReceiver.sol | 0 .../safe_V1_2_0/interfaces/ERC777TokensRecipient.sol | 0 .../safe_V1_2_0/interfaces/ISignatureValidator.sol | 0 .../contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol | 0 .../contracts/safe_V1_2_0/libraries/CreateCall.sol | 0 .../{src => }/contracts/safe_V1_2_0/libraries/MultiSend.sol | 0 .../contracts/safe_V1_2_0/modules/DailyLimitModule.sol | 0 .../contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol | 0 .../contracts/safe_V1_2_0/modules/StateChannelModule.sol | 0 .../contracts/safe_V1_2_0/modules/WhitelistModule.sol | 0 .../safe_V1_2_0/proxies/DelegateConstructorProxy.sol | 0 .../contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol | 0 .../safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol | 0 .../safe_V1_2_0/proxies/IProxyCreationCallback.sol | 0 .../{src => }/contracts/safe_V1_2_0/proxies/PayingProxy.sol | 0 packages/testing-kit/hardhat.config.ts | 6 +++--- .../testing-kit/{src => hardhat}/deploy/deploy-contracts.ts | 0 packages/testing-kit/index.ts | 1 + packages/testing-kit/package.json | 4 ++-- packages/testing-kit/src/index.ts | 1 - packages/testing-kit/tsconfig.build.json | 2 +- packages/testing-kit/tsconfig.json | 2 +- 92 files changed, 8 insertions(+), 8 deletions(-) rename packages/testing-kit/{src => }/contracts/Deps_V1_0_0.sol (100%) rename packages/testing-kit/{src => }/contracts/Deps_V1_1_1.sol (100%) rename packages/testing-kit/{src => }/contracts/Deps_V1_2_0.sol (100%) rename packages/testing-kit/{src => }/contracts/Deps_V1_3_0.sol (100%) rename packages/testing-kit/{src => }/contracts/Deps_V1_4_1.sol (100%) rename packages/testing-kit/{src => }/contracts/Deps_passkeys.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/GnosisSafe.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/Migrations.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/base/BaseSafe.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/base/Executor.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/base/Module.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/base/ModuleManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/base/OwnerManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/Enum.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/MasterCopy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/SelfAuthorized.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/common/SignatureDecoder.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/external/SafeMath.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/libraries/MultiSend.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/proxies/PayingProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/proxies/Proxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_0_0/proxies/ProxyFactory.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/GnosisSafe.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/Migrations.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/base/Executor.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/base/FallbackManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/base/Module.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/base/ModuleManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/base/OwnerManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/Enum.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/MasterCopy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/SelfAuthorized.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/common/SignatureDecoder.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/external/SafeMath.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/libraries/CreateCall.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/libraries/MultiSend.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/proxies/PayingProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/proxies/Proxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_1_1/proxies/ProxyFactory.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/GnosisSafe.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/Migrations.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/base/Executor.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/base/FallbackManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/base/Module.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/base/ModuleManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/base/OwnerManager.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/Enum.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/MasterCopy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/SelfAuthorized.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/common/SignatureDecoder.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/external/GnosisSafeMath.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/libraries/CreateCall.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/libraries/MultiSend.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/modules/DailyLimitModule.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/modules/StateChannelModule.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/modules/WhitelistModule.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol (100%) rename packages/testing-kit/{src => }/contracts/safe_V1_2_0/proxies/PayingProxy.sol (100%) rename packages/testing-kit/{src => hardhat}/deploy/deploy-contracts.ts (100%) create mode 100644 packages/testing-kit/index.ts delete mode 100644 packages/testing-kit/src/index.ts diff --git a/packages/testing-kit/src/contracts/Deps_V1_0_0.sol b/packages/testing-kit/contracts/Deps_V1_0_0.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_V1_0_0.sol rename to packages/testing-kit/contracts/Deps_V1_0_0.sol diff --git a/packages/testing-kit/src/contracts/Deps_V1_1_1.sol b/packages/testing-kit/contracts/Deps_V1_1_1.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_V1_1_1.sol rename to packages/testing-kit/contracts/Deps_V1_1_1.sol diff --git a/packages/testing-kit/src/contracts/Deps_V1_2_0.sol b/packages/testing-kit/contracts/Deps_V1_2_0.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_V1_2_0.sol rename to packages/testing-kit/contracts/Deps_V1_2_0.sol diff --git a/packages/testing-kit/src/contracts/Deps_V1_3_0.sol b/packages/testing-kit/contracts/Deps_V1_3_0.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_V1_3_0.sol rename to packages/testing-kit/contracts/Deps_V1_3_0.sol diff --git a/packages/testing-kit/src/contracts/Deps_V1_4_1.sol b/packages/testing-kit/contracts/Deps_V1_4_1.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_V1_4_1.sol rename to packages/testing-kit/contracts/Deps_V1_4_1.sol diff --git a/packages/testing-kit/src/contracts/Deps_passkeys.sol b/packages/testing-kit/contracts/Deps_passkeys.sol similarity index 100% rename from packages/testing-kit/src/contracts/Deps_passkeys.sol rename to packages/testing-kit/contracts/Deps_passkeys.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/GnosisSafe.sol b/packages/testing-kit/contracts/safe_V1_0_0/GnosisSafe.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/GnosisSafe.sol rename to packages/testing-kit/contracts/safe_V1_0_0/GnosisSafe.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/Migrations.sol b/packages/testing-kit/contracts/safe_V1_0_0/Migrations.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/Migrations.sol rename to packages/testing-kit/contracts/safe_V1_0_0/Migrations.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/BaseSafe.sol b/packages/testing-kit/contracts/safe_V1_0_0/base/BaseSafe.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/base/BaseSafe.sol rename to packages/testing-kit/contracts/safe_V1_0_0/base/BaseSafe.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/Executor.sol b/packages/testing-kit/contracts/safe_V1_0_0/base/Executor.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/base/Executor.sol rename to packages/testing-kit/contracts/safe_V1_0_0/base/Executor.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/Module.sol b/packages/testing-kit/contracts/safe_V1_0_0/base/Module.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/base/Module.sol rename to packages/testing-kit/contracts/safe_V1_0_0/base/Module.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/ModuleManager.sol b/packages/testing-kit/contracts/safe_V1_0_0/base/ModuleManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/base/ModuleManager.sol rename to packages/testing-kit/contracts/safe_V1_0_0/base/ModuleManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/base/OwnerManager.sol b/packages/testing-kit/contracts/safe_V1_0_0/base/OwnerManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/base/OwnerManager.sol rename to packages/testing-kit/contracts/safe_V1_0_0/base/OwnerManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/Enum.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/Enum.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/Enum.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/Enum.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/EtherPaymentFallback.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/MasterCopy.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/MasterCopy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/MasterCopy.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/MasterCopy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/SecuredTokenTransfer.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/SelfAuthorized.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/SelfAuthorized.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/SelfAuthorized.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/SelfAuthorized.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/common/SignatureDecoder.sol b/packages/testing-kit/contracts/safe_V1_0_0/common/SignatureDecoder.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/common/SignatureDecoder.sol rename to packages/testing-kit/contracts/safe_V1_0_0/common/SignatureDecoder.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/external/SafeMath.sol b/packages/testing-kit/contracts/safe_V1_0_0/external/SafeMath.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/external/SafeMath.sol rename to packages/testing-kit/contracts/safe_V1_0_0/external/SafeMath.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol b/packages/testing-kit/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol rename to packages/testing-kit/contracts/safe_V1_0_0/interfaces/ISignatureValidator.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol b/packages/testing-kit/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol rename to packages/testing-kit/contracts/safe_V1_0_0/libraries/CreateAndAddModules.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/libraries/MultiSend.sol b/packages/testing-kit/contracts/safe_V1_0_0/libraries/MultiSend.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/libraries/MultiSend.sol rename to packages/testing-kit/contracts/safe_V1_0_0/libraries/MultiSend.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol rename to packages/testing-kit/contracts/safe_V1_0_0/proxies/DelegateConstructorProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/PayingProxy.sol b/packages/testing-kit/contracts/safe_V1_0_0/proxies/PayingProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/proxies/PayingProxy.sol rename to packages/testing-kit/contracts/safe_V1_0_0/proxies/PayingProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/Proxy.sol b/packages/testing-kit/contracts/safe_V1_0_0/proxies/Proxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/proxies/Proxy.sol rename to packages/testing-kit/contracts/safe_V1_0_0/proxies/Proxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_0_0/proxies/ProxyFactory.sol b/packages/testing-kit/contracts/safe_V1_0_0/proxies/ProxyFactory.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_0_0/proxies/ProxyFactory.sol rename to packages/testing-kit/contracts/safe_V1_0_0/proxies/ProxyFactory.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/GnosisSafe.sol b/packages/testing-kit/contracts/safe_V1_1_1/GnosisSafe.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/GnosisSafe.sol rename to packages/testing-kit/contracts/safe_V1_1_1/GnosisSafe.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/Migrations.sol b/packages/testing-kit/contracts/safe_V1_1_1/Migrations.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/Migrations.sol rename to packages/testing-kit/contracts/safe_V1_1_1/Migrations.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/Executor.sol b/packages/testing-kit/contracts/safe_V1_1_1/base/Executor.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/base/Executor.sol rename to packages/testing-kit/contracts/safe_V1_1_1/base/Executor.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/FallbackManager.sol b/packages/testing-kit/contracts/safe_V1_1_1/base/FallbackManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/base/FallbackManager.sol rename to packages/testing-kit/contracts/safe_V1_1_1/base/FallbackManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/Module.sol b/packages/testing-kit/contracts/safe_V1_1_1/base/Module.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/base/Module.sol rename to packages/testing-kit/contracts/safe_V1_1_1/base/Module.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/ModuleManager.sol b/packages/testing-kit/contracts/safe_V1_1_1/base/ModuleManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/base/ModuleManager.sol rename to packages/testing-kit/contracts/safe_V1_1_1/base/ModuleManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/base/OwnerManager.sol b/packages/testing-kit/contracts/safe_V1_1_1/base/OwnerManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/base/OwnerManager.sol rename to packages/testing-kit/contracts/safe_V1_1_1/base/OwnerManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/Enum.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/Enum.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/Enum.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/Enum.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/EtherPaymentFallback.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/MasterCopy.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/MasterCopy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/MasterCopy.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/MasterCopy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/SecuredTokenTransfer.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/SelfAuthorized.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/SelfAuthorized.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/SelfAuthorized.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/SelfAuthorized.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/common/SignatureDecoder.sol b/packages/testing-kit/contracts/safe_V1_1_1/common/SignatureDecoder.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/common/SignatureDecoder.sol rename to packages/testing-kit/contracts/safe_V1_1_1/common/SignatureDecoder.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/external/SafeMath.sol b/packages/testing-kit/contracts/safe_V1_1_1/external/SafeMath.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/external/SafeMath.sol rename to packages/testing-kit/contracts/safe_V1_1_1/external/SafeMath.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol b/packages/testing-kit/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol rename to packages/testing-kit/contracts/safe_V1_1_1/handler/DefaultCallbackHandler.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol b/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol rename to packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC1155TokenReceiver.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol b/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol rename to packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC721TokenReceiver.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol b/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol rename to packages/testing-kit/contracts/safe_V1_1_1/interfaces/ERC777TokensRecipient.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol b/packages/testing-kit/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol rename to packages/testing-kit/contracts/safe_V1_1_1/interfaces/ISignatureValidator.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol b/packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol rename to packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateAndAddModules.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateCall.sol b/packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateCall.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/libraries/CreateCall.sol rename to packages/testing-kit/contracts/safe_V1_1_1/libraries/CreateCall.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/libraries/MultiSend.sol b/packages/testing-kit/contracts/safe_V1_1_1/libraries/MultiSend.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/libraries/MultiSend.sol rename to packages/testing-kit/contracts/safe_V1_1_1/libraries/MultiSend.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol rename to packages/testing-kit/contracts/safe_V1_1_1/proxies/DelegateConstructorProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol b/packages/testing-kit/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol rename to packages/testing-kit/contracts/safe_V1_1_1/proxies/IProxyCreationCallback.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/PayingProxy.sol b/packages/testing-kit/contracts/safe_V1_1_1/proxies/PayingProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/proxies/PayingProxy.sol rename to packages/testing-kit/contracts/safe_V1_1_1/proxies/PayingProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/Proxy.sol b/packages/testing-kit/contracts/safe_V1_1_1/proxies/Proxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/proxies/Proxy.sol rename to packages/testing-kit/contracts/safe_V1_1_1/proxies/Proxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_1_1/proxies/ProxyFactory.sol b/packages/testing-kit/contracts/safe_V1_1_1/proxies/ProxyFactory.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_1_1/proxies/ProxyFactory.sol rename to packages/testing-kit/contracts/safe_V1_1_1/proxies/ProxyFactory.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/GnosisSafe.sol b/packages/testing-kit/contracts/safe_V1_2_0/GnosisSafe.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/GnosisSafe.sol rename to packages/testing-kit/contracts/safe_V1_2_0/GnosisSafe.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/Migrations.sol b/packages/testing-kit/contracts/safe_V1_2_0/Migrations.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/Migrations.sol rename to packages/testing-kit/contracts/safe_V1_2_0/Migrations.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/Executor.sol b/packages/testing-kit/contracts/safe_V1_2_0/base/Executor.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/base/Executor.sol rename to packages/testing-kit/contracts/safe_V1_2_0/base/Executor.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/FallbackManager.sol b/packages/testing-kit/contracts/safe_V1_2_0/base/FallbackManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/base/FallbackManager.sol rename to packages/testing-kit/contracts/safe_V1_2_0/base/FallbackManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/Module.sol b/packages/testing-kit/contracts/safe_V1_2_0/base/Module.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/base/Module.sol rename to packages/testing-kit/contracts/safe_V1_2_0/base/Module.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/ModuleManager.sol b/packages/testing-kit/contracts/safe_V1_2_0/base/ModuleManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/base/ModuleManager.sol rename to packages/testing-kit/contracts/safe_V1_2_0/base/ModuleManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/base/OwnerManager.sol b/packages/testing-kit/contracts/safe_V1_2_0/base/OwnerManager.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/base/OwnerManager.sol rename to packages/testing-kit/contracts/safe_V1_2_0/base/OwnerManager.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/Enum.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/Enum.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/Enum.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/Enum.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/EtherPaymentFallback.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/MasterCopy.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/MasterCopy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/MasterCopy.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/MasterCopy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/SecuredTokenTransfer.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/SelfAuthorized.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/SelfAuthorized.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/SelfAuthorized.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/SelfAuthorized.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/common/SignatureDecoder.sol b/packages/testing-kit/contracts/safe_V1_2_0/common/SignatureDecoder.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/common/SignatureDecoder.sol rename to packages/testing-kit/contracts/safe_V1_2_0/common/SignatureDecoder.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/external/GnosisSafeMath.sol b/packages/testing-kit/contracts/safe_V1_2_0/external/GnosisSafeMath.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/external/GnosisSafeMath.sol rename to packages/testing-kit/contracts/safe_V1_2_0/external/GnosisSafeMath.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol b/packages/testing-kit/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol rename to packages/testing-kit/contracts/safe_V1_2_0/handler/DefaultCallbackHandler.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol b/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol rename to packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC1155TokenReceiver.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol b/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol rename to packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC721TokenReceiver.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol b/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol rename to packages/testing-kit/contracts/safe_V1_2_0/interfaces/ERC777TokensRecipient.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol b/packages/testing-kit/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol rename to packages/testing-kit/contracts/safe_V1_2_0/interfaces/ISignatureValidator.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol b/packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol rename to packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateAndAddModules.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateCall.sol b/packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateCall.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/libraries/CreateCall.sol rename to packages/testing-kit/contracts/safe_V1_2_0/libraries/CreateCall.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/libraries/MultiSend.sol b/packages/testing-kit/contracts/safe_V1_2_0/libraries/MultiSend.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/libraries/MultiSend.sol rename to packages/testing-kit/contracts/safe_V1_2_0/libraries/MultiSend.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/DailyLimitModule.sol b/packages/testing-kit/contracts/safe_V1_2_0/modules/DailyLimitModule.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/modules/DailyLimitModule.sol rename to packages/testing-kit/contracts/safe_V1_2_0/modules/DailyLimitModule.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol b/packages/testing-kit/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol rename to packages/testing-kit/contracts/safe_V1_2_0/modules/SocialRecoveryModule.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/StateChannelModule.sol b/packages/testing-kit/contracts/safe_V1_2_0/modules/StateChannelModule.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/modules/StateChannelModule.sol rename to packages/testing-kit/contracts/safe_V1_2_0/modules/StateChannelModule.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/modules/WhitelistModule.sol b/packages/testing-kit/contracts/safe_V1_2_0/modules/WhitelistModule.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/modules/WhitelistModule.sol rename to packages/testing-kit/contracts/safe_V1_2_0/modules/WhitelistModule.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol b/packages/testing-kit/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol rename to packages/testing-kit/contracts/safe_V1_2_0/proxies/DelegateConstructorProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol b/packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol rename to packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxy.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol b/packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol rename to packages/testing-kit/contracts/safe_V1_2_0/proxies/GnosisSafeProxyFactory.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol b/packages/testing-kit/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol rename to packages/testing-kit/contracts/safe_V1_2_0/proxies/IProxyCreationCallback.sol diff --git a/packages/testing-kit/src/contracts/safe_V1_2_0/proxies/PayingProxy.sol b/packages/testing-kit/contracts/safe_V1_2_0/proxies/PayingProxy.sol similarity index 100% rename from packages/testing-kit/src/contracts/safe_V1_2_0/proxies/PayingProxy.sol rename to packages/testing-kit/contracts/safe_V1_2_0/proxies/PayingProxy.sol diff --git a/packages/testing-kit/hardhat.config.ts b/packages/testing-kit/hardhat.config.ts index e22890455..b0cdd66cf 100644 --- a/packages/testing-kit/hardhat.config.ts +++ b/packages/testing-kit/hardhat.config.ts @@ -45,9 +45,9 @@ const config: HardhatUserConfig = { } }, paths: { - artifacts: path.resolve(__dirname, 'artifacts'), - deploy: path.resolve(__dirname, 'src/deploy'), - sources: path.resolve(__dirname, './src/contracts') + artifacts: path.resolve(__dirname, './artifacts'), + deploy: path.resolve(__dirname, './hardhat/deploy'), + sources: path.resolve(__dirname, './contracts') }, networks: { localhost: { diff --git a/packages/testing-kit/src/deploy/deploy-contracts.ts b/packages/testing-kit/hardhat/deploy/deploy-contracts.ts similarity index 100% rename from packages/testing-kit/src/deploy/deploy-contracts.ts rename to packages/testing-kit/hardhat/deploy/deploy-contracts.ts diff --git a/packages/testing-kit/index.ts b/packages/testing-kit/index.ts new file mode 100644 index 000000000..aee0f3194 --- /dev/null +++ b/packages/testing-kit/index.ts @@ -0,0 +1 @@ +export * from './hardhat/deploy/deploy-contracts' diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index 5d144bab6..04e5750cc 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -2,8 +2,8 @@ "name": "@safe-global/testing-kit", "version": "1.0.0", "description": "Helper package providing testing utilities", - "main": "dist/src/index.js", - "types": "dist/src/index.d.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", "keywords": [ "Ethereum", "Wallet", diff --git a/packages/testing-kit/src/index.ts b/packages/testing-kit/src/index.ts deleted file mode 100644 index 1c3907f47..000000000 --- a/packages/testing-kit/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './deploy/deploy-contracts' diff --git a/packages/testing-kit/tsconfig.build.json b/packages/testing-kit/tsconfig.build.json index c35515726..22c319a8e 100644 --- a/packages/testing-kit/tsconfig.build.json +++ b/packages/testing-kit/tsconfig.build.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["bin/**/*", "src/**/*"] + "include": ["bin/**/*", "hardhat/**/*", "./index.ts"] } diff --git a/packages/testing-kit/tsconfig.json b/packages/testing-kit/tsconfig.json index f15cccd2a..bd596e285 100644 --- a/packages/testing-kit/tsconfig.json +++ b/packages/testing-kit/tsconfig.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["./hardhat.config.ts", "bin/**/*", "src/**/*"] + "include": ["./hardhat.config.ts", "bin/**/*", "hardhat/**/*", "./index.ts"] } From 3104abbaeba99c2d3364f6244c2d07e9a1898ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 29 Aug 2024 11:32:10 +0200 Subject: [PATCH 36/55] Recvert some changes --- packages/testing-kit/hardhat.config.ts | 2 +- packages/testing-kit/package.json | 4 ++-- .../testing-kit/{ => src}/hardhat/deploy/deploy-contracts.ts | 0 packages/testing-kit/{ => src}/index.ts | 0 packages/testing-kit/tsconfig.build.json | 2 +- packages/testing-kit/tsconfig.json | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) rename packages/testing-kit/{ => src}/hardhat/deploy/deploy-contracts.ts (100%) rename packages/testing-kit/{ => src}/index.ts (100%) diff --git a/packages/testing-kit/hardhat.config.ts b/packages/testing-kit/hardhat.config.ts index b0cdd66cf..3c3492eee 100644 --- a/packages/testing-kit/hardhat.config.ts +++ b/packages/testing-kit/hardhat.config.ts @@ -46,7 +46,7 @@ const config: HardhatUserConfig = { }, paths: { artifacts: path.resolve(__dirname, './artifacts'), - deploy: path.resolve(__dirname, './hardhat/deploy'), + deploy: path.resolve(__dirname, './src/hardhat/deploy'), sources: path.resolve(__dirname, './contracts') }, networks: { diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index 04e5750cc..5d144bab6 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -2,8 +2,8 @@ "name": "@safe-global/testing-kit", "version": "1.0.0", "description": "Helper package providing testing utilities", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "dist/src/index.js", + "types": "dist/src/index.d.ts", "keywords": [ "Ethereum", "Wallet", diff --git a/packages/testing-kit/hardhat/deploy/deploy-contracts.ts b/packages/testing-kit/src/hardhat/deploy/deploy-contracts.ts similarity index 100% rename from packages/testing-kit/hardhat/deploy/deploy-contracts.ts rename to packages/testing-kit/src/hardhat/deploy/deploy-contracts.ts diff --git a/packages/testing-kit/index.ts b/packages/testing-kit/src/index.ts similarity index 100% rename from packages/testing-kit/index.ts rename to packages/testing-kit/src/index.ts diff --git a/packages/testing-kit/tsconfig.build.json b/packages/testing-kit/tsconfig.build.json index 22c319a8e..b40c79f0d 100644 --- a/packages/testing-kit/tsconfig.build.json +++ b/packages/testing-kit/tsconfig.build.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["bin/**/*", "hardhat/**/*", "./index.ts"] + "include": ["bin/**/*", "hardhat/**/*", "./src/**/*"] } diff --git a/packages/testing-kit/tsconfig.json b/packages/testing-kit/tsconfig.json index bd596e285..476c559ca 100644 --- a/packages/testing-kit/tsconfig.json +++ b/packages/testing-kit/tsconfig.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["./hardhat.config.ts", "bin/**/*", "hardhat/**/*", "./index.ts"] + "include": ["./hardhat.config.ts", "bin/**/*", "./src/**/*"] } From ef9a7f277542b80f428ed525dcd1e1bbcd97b011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 29 Aug 2024 19:25:52 +0200 Subject: [PATCH 37/55] Update tests in protocol-kit and remove duplicates --- packages/protocol-kit/package.json | 2 +- .../tests/e2e/contractManager.test.ts | 46 ++--- packages/protocol-kit/tests/e2e/core.test.ts | 74 +++---- .../createSafeDeploymentTransaction.test.ts | 59 ++---- .../tests/e2e/createTransaction.test.ts | 128 ++++-------- .../tests/e2e/createTransactionBatch.test.ts | 36 +--- .../e2e/eip1271-contract-signatures.test.ts | 23 +-- .../protocol-kit/tests/e2e/eip1271.test.ts | 23 +-- .../protocol-kit/tests/e2e/erc-20.test.ts | 35 +--- .../protocol-kit/tests/e2e/execution.test.ts | 111 ++++------- .../tests/e2e/fallbackHandlerManager.test.ts | 97 ++++----- .../tests/e2e/getEncodedTransaction.test.ts | 38 +--- .../tests/e2e/guardManager.test.ts | 90 +++------ .../tests/e2e/moduleManager.test.ts | 148 ++++++-------- .../tests/e2e/offChainSignatures.test.ts | 66 ++----- .../tests/e2e/onChainSignatures.test.ts | 58 ++---- .../tests/e2e/ownerManager.test.ts | 187 ++++++++---------- .../protocol-kit/tests/e2e/passkey.test.ts | 24 +-- .../tests/e2e/safeFactory.test.ts | 93 ++++----- .../tests/e2e/safeProvider.test.ts | 48 ++--- .../protocol-kit/tests/e2e/threshold.test.ts | 50 +---- .../tests/e2e/utils/setupContractNetworks.ts | 40 ---- .../tests/e2e/utils/transactions.ts | 12 +- .../tests/e2e/utilsContracts.test.ts | 43 ++-- ...SafeTransactionIntoDeploymentBatch.test.ts | 49 ++--- packages/testing-kit/package.json | 5 + .../src/hardhat/deploy/deploy-contracts.ts | 1 - packages/testing-kit/src/index.ts | 6 + .../e2e => testing-kit/src}/utils/helpers.ts | 0 .../src/utils/setupContractNetworks.ts | 90 +++++++++ .../src}/utils/setupContracts.ts | 48 +++-- .../src}/utils/setupTestNetwork.ts | 3 +- packages/testing-kit/src/utils/setupTests.ts | 80 ++++++++ .../testing-kit/src/utils/transactions.ts | 11 ++ packages/testing-kit/tsconfig.build.json | 3 +- packages/testing-kit/tsconfig.json | 2 +- 36 files changed, 747 insertions(+), 1082 deletions(-) delete mode 100644 packages/protocol-kit/tests/e2e/utils/setupContractNetworks.ts rename packages/{protocol-kit/tests/e2e => testing-kit/src}/utils/helpers.ts (100%) create mode 100644 packages/testing-kit/src/utils/setupContractNetworks.ts rename packages/{protocol-kit/tests/e2e => testing-kit/src}/utils/setupContracts.ts (89%) rename packages/{protocol-kit/tests/e2e => testing-kit/src}/utils/setupTestNetwork.ts (95%) create mode 100644 packages/testing-kit/src/utils/setupTests.ts create mode 100644 packages/testing-kit/src/utils/transactions.ts diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index f79a04058..fbbe499e8 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -30,7 +30,7 @@ "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", "coverage": "nyc report --reporter=lcov", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", diff --git a/packages/protocol-kit/tests/e2e/contractManager.test.ts b/packages/protocol-kit/tests/e2e/contractManager.test.ts index cae664a6f..56d853071 100644 --- a/packages/protocol-kit/tests/e2e/contractManager.test.ts +++ b/packages/protocol-kit/tests/e2e/contractManager.test.ts @@ -1,45 +1,29 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' -import Safe, { ContractNetworksConfig, PredictedSafeProps } from '@safe-global/protocol-kit/index' -import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' -import chai from 'chai' -import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { getContractNetworks } from './utils/setupContractNetworks' import { + safeVersionDeployed, + setupTests, getCompatibilityFallbackHandler, getCreateCall, getFactory, getMultiSend, getMultiSendCallOnly, getSafeSingleton, - getSafeWithOwners, getSignMessageLib, getSimulateTxAccessor -} from './utils/setupContracts' +} from '@safe-global/testing-kit' +import Safe, { ContractNetworksConfig, PredictedSafeProps } from '@safe-global/protocol-kit/index' +import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' +import chai from 'chai' +import chaiAsPromised from 'chai-as-promised' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) describe('Safe contracts manager', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const provider = getEip1193Provider() - return { - safe: await getSafeWithOwners([accounts[0].address]), - accounts, - contractNetworks, - chainId, - provider - } - }) + const provider = getEip1193Provider() describe('create', async () => { it('should initialize the SDK with a Safe that is not deployed', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const predictedSafe: PredictedSafeProps = { safeAccountConfig: { owners: [accounts[0].address], @@ -59,7 +43,7 @@ describe('Safe contracts manager', () => { }) it('should fail if the current network is not a default network and no contractNetworks is provided', async () => { - const { safe, provider } = await setupTests() + const { safe } = await setupTests() const safeAddress = safe.address await chai .expect( @@ -72,7 +56,7 @@ describe('Safe contracts manager', () => { }) it('should fail if SafeProxy contract is not deployed on the current network', async () => { - const { contractNetworks, provider } = await setupTests() + const { contractNetworks } = await setupTests() await chai .expect( Safe.init({ @@ -85,8 +69,8 @@ describe('Safe contracts manager', () => { }) it('should fail if MultiSend contract is specified in contractNetworks but not deployed', async () => { - const { safe, chainId, provider } = await setupTests() - const customContractNetworks: ContractNetworksConfig = { + const { safe, chainId } = await setupTests() + const customContractNetworks = { [chainId.toString()]: { safeSingletonAddress: ZERO_ADDRESS, safeSingletonAbi: (await getSafeSingleton()).abi, @@ -113,14 +97,14 @@ describe('Safe contracts manager', () => { Safe.init({ provider, safeAddress, - contractNetworks: customContractNetworks + contractNetworks: customContractNetworks as ContractNetworksConfig }) ) .to.be.rejectedWith('MultiSend contract is not deployed on the current network') }) it('should set the MultiSend contract available on the current network', async () => { - const { safe, chainId, contractNetworks, provider } = await setupTests() + const { safe, chainId, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, diff --git a/packages/protocol-kit/tests/e2e/core.test.ts b/packages/protocol-kit/tests/e2e/core.test.ts index 5182e4bdc..c1f04cd53 100644 --- a/packages/protocol-kit/tests/e2e/core.test.ts +++ b/packages/protocol-kit/tests/e2e/core.test.ts @@ -1,51 +1,29 @@ import { DEFAULT_SAFE_VERSION } from '@safe-global/protocol-kit/contracts/config' -import { safeVersionDeployed } from '@safe-global/testing-kit' +import { + safeVersionDeployed, + setupTests, + itif, + getSafeWithOwners, + waitTransactionReceipt +} from '@safe-global/testing-kit' import Safe, { PredictedSafeProps, SafeFactory } from '@safe-global/protocol-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { itif } from './utils/helpers' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' + import { waitSafeTxReceipt } from './utils/transactions' -import { waitTransactionReceipt } from './utils/transactions' import { sameString } from '@safe-global/protocol-kit/utils' chai.use(chaiAsPromised) describe('Safe Info', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - const provider = getEip1193Provider() - return { - chainId, - safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]), - provider, - predictedSafe, - accounts, - contractNetworks - } - }) + const provider = getEip1193Provider() describe('connect', async () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to connect a Safe { - const { predictedSafe, safe, contractNetworks, provider } = await setupTests() + const { predictedSafe, safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -62,7 +40,7 @@ describe('Safe Info', () => { ) it('should connect a Safe >=v1.3.0 that is not deployed', async () => { - const { predictedSafe, safe, accounts, contractNetworks, provider } = await setupTests() + const { predictedSafe, safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -80,7 +58,7 @@ describe('Safe Info', () => { }) it('should connect a deployed Safe', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -129,7 +107,7 @@ describe('Safe Info', () => { describe('getContractVersion', async () => { it('should return the contract version of a Safe that is not deployed with a custom version configuration', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -140,7 +118,7 @@ describe('Safe Info', () => { }) it('should return the contract version of a Safe that is not deployed with a default version configuration', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeConfig: PredictedSafeProps = { ...predictedSafe, safeDeploymentConfig: {} @@ -155,7 +133,7 @@ describe('Safe Info', () => { }) it('should return the Safe contract version', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -171,7 +149,7 @@ describe('Safe Info', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to return the address of a Safe { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -189,7 +167,7 @@ describe('Safe Info', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return the address of a Safe >=v1.3.0 that is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -210,7 +188,7 @@ describe('Safe Info', () => { ) it('should return the address of a deployed Safe', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -223,7 +201,7 @@ describe('Safe Info', () => { describe('getEip1193Provider', async () => { it('should return the connected SafeProvider', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -243,7 +221,7 @@ describe('Safe Info', () => { describe('getNonce', async () => { it('should return the nonce of a Safe that is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -253,7 +231,7 @@ describe('Safe Info', () => { }) it('should return the Safe nonce', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address @@ -278,7 +256,7 @@ describe('Safe Info', () => { describe('getChainId', async () => { it('should return the chainId of a Safe that is not deployed', async () => { - const { predictedSafe, chainId, contractNetworks, provider } = await setupTests() + const { predictedSafe, chainId, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -288,7 +266,7 @@ describe('Safe Info', () => { }) it('should return the chainId of the current network', async () => { - const { safe, chainId, contractNetworks, provider } = await setupTests() + const { safe, chainId, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -303,7 +281,7 @@ describe('Safe Info', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to return the balance of a Safe { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -320,7 +298,7 @@ describe('Safe Info', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return the balance of a Safe >=v1.3.0 that is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() + const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts const safeSdk = await Safe.init({ provider, @@ -343,7 +321,7 @@ describe('Safe Info', () => { ) it('should return the balance of a deployed Safe', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts const safeAddress = safe.address const safeSdk = await Safe.init({ diff --git a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts index 92a3f5689..c18eb4dd1 100644 --- a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts @@ -1,50 +1,27 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' import { keccak256, toHex } from 'viem' -import { safeVersionDeployed } from '@safe-global/testing-kit' +import { + safeVersionDeployed, + setupTests, + itif, + getSafeWithOwners, + getFactory +} from '@safe-global/testing-kit' import Safe, { PREDETERMINED_SALT_NONCE, - PredictedSafeProps, SafeProvider, encodeSetupCallData } from '@safe-global/protocol-kit/index' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners, getFactory } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' -import { itif } from './utils/helpers' chai.use(chaiAsPromised) describe('createSafeDeploymentTransaction', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const provider = getEip1193Provider() - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - - return { - accounts, - contractNetworks, - predictedSafe, - chainId, - provider - } - }) + const provider = getEip1193Provider() itif(safeVersionDeployed == '1.4.1')('should return a Safe deployment transactions', async () => { - const { contractNetworks, predictedSafe, provider } = await setupTests() + const { contractNetworks, predictedSafe } = await setupTests() const safeSdk = await Safe.init({ provider, @@ -65,7 +42,7 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.3.0')('should return a Safe deployment transactions', async () => { - const { contractNetworks, predictedSafe, provider } = await setupTests() + const { contractNetworks, predictedSafe } = await setupTests() const safeSdk = await Safe.init({ provider, @@ -86,7 +63,7 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.2.0')('should return a Safe deployment transactions', async () => { - const { contractNetworks, predictedSafe, provider } = await setupTests() + const { contractNetworks, predictedSafe } = await setupTests() const safeSdk = await Safe.init({ provider, @@ -107,7 +84,7 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.1.1')('should return a Safe deployment transactions', async () => { - const { contractNetworks, predictedSafe, provider } = await setupTests() + const { contractNetworks, predictedSafe } = await setupTests() const safeSdk = await Safe.init({ provider, @@ -128,7 +105,7 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.0.0')('should return a Safe deployment transactions', async () => { - const { contractNetworks, predictedSafe, provider } = await setupTests() + const { contractNetworks, predictedSafe } = await setupTests() const safeSdk = await Safe.init({ provider, @@ -149,7 +126,7 @@ describe('createSafeDeploymentTransaction', () => { }) it('should contain the initializer setup call in the deployment data to sets the threshold & owners of the deployed Safe', async () => { - const { contractNetworks, predictedSafe, chainId, provider } = await setupTests() + const { contractNetworks, predictedSafe, chainId } = await setupTests() const safeSdk = await Safe.init({ provider, @@ -180,7 +157,7 @@ describe('createSafeDeploymentTransaction', () => { describe('salt nonce', () => { it('should include the predetermined salt nonce in the Safe deployment data', async () => { - const { contractNetworks, predictedSafe, chainId, provider } = await setupTests() + const { contractNetworks, predictedSafe, chainId } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeSdk = await Safe.init({ @@ -202,7 +179,7 @@ describe('createSafeDeploymentTransaction', () => { }) it('should include the custom salt nonce in the Safe deployment data', async () => { - const { contractNetworks, predictedSafe, provider } = await setupTests() + const { contractNetworks, predictedSafe } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeSdk = await Safe.init({ @@ -222,7 +199,7 @@ describe('createSafeDeploymentTransaction', () => { }) it('should include the salt nonce included in the safeDeploymentConfig in the Safe deployment data', async () => { - const { contractNetworks, predictedSafe, provider } = await setupTests() + const { contractNetworks, predictedSafe } = await setupTests() const customSaltNonce = '123456789' @@ -250,7 +227,7 @@ describe('createSafeDeploymentTransaction', () => { }) it('should throw an error if predicted Safe is not present', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) diff --git a/packages/protocol-kit/tests/e2e/createTransaction.test.ts b/packages/protocol-kit/tests/e2e/createTransaction.test.ts index de7c4caaa..83dd982ef 100644 --- a/packages/protocol-kit/tests/e2e/createTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransaction.test.ts @@ -1,6 +1,5 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' +import { safeVersionDeployed, setupTests, getERC20Mintable, itif } from '@safe-global/testing-kit' import Safe, { - PredictedSafeProps, SafeTransactionOptionalProps, standardizeSafeTransactionData, SafeContractImplementationType as SafeContract @@ -8,12 +7,7 @@ import Safe, { import { SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { itif } from './utils/helpers' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getERC20Mintable, getSafeWithOwners } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { encodeFunctionData } from 'viem' chai.use(chaiAsPromised) @@ -28,39 +22,13 @@ const BASE_OPTIONS: SafeTransactionOptionalProps = { } describe('Transactions creation', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const provider = getEip1193Provider() - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - return { - erc20Mintable: await getERC20Mintable(), - safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]), - accounts, - chainId, - contractNetworks, - predictedSafe, - provider - } - }) + const provider = getEip1193Provider() describe('standardizeSafeTransactionData', async () => { itif(safeVersionDeployed >= '1.3.0')( 'should return a transaction with safeTxGas=0 if safeVersion>=1.3.0 and gasPrice=0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -68,7 +36,7 @@ describe('Transactions creation', () => { contractNetworks }) const txDataPartial: SafeTransactionDataPartial = { - to: account2.address, + to: accounts[1].address, value: '0', data: '0x' } @@ -85,9 +53,7 @@ describe('Transactions creation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return a transaction with estimated safeTxGas if safeVersion>=1.3.0 and gasPrice>0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -95,7 +61,7 @@ describe('Transactions creation', () => { contractNetworks }) const txDataPartial: SafeTransactionDataPartial = { - to: account2.address, + to: accounts[1].address, value: '0', data: '0x', gasPrice: BASE_OPTIONS.gasPrice @@ -113,9 +79,7 @@ describe('Transactions creation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return a transaction with defined safeTxGas if safeVersion>=1.3.0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -124,7 +88,7 @@ describe('Transactions creation', () => { }) const safeTxGas = BASE_OPTIONS.safeTxGas const txDataPartial: SafeTransactionDataPartial = { - to: account2.address, + to: accounts[1].address, value: '0', data: '0x', safeTxGas @@ -142,9 +106,7 @@ describe('Transactions creation', () => { itif(safeVersionDeployed < '1.3.0')( 'should return a transaction with estimated safeTxGas if safeVersion<1.3.0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -152,7 +114,7 @@ describe('Transactions creation', () => { contractNetworks }) const txDataPartial: SafeTransactionDataPartial = { - to: account2.address, + to: accounts[1].address, value: '0', data: '0x' } @@ -169,9 +131,7 @@ describe('Transactions creation', () => { itif(safeVersionDeployed < '1.3.0')( 'should return a transaction with defined safeTxGas of 0 if safeVersion<1.3.0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -180,7 +140,7 @@ describe('Transactions creation', () => { }) const safeTxGas = '0' const txDataPartial: SafeTransactionDataPartial = { - to: account2.address, + to: accounts[1].address, value: '0', data: '0x', safeTxGas @@ -198,9 +158,7 @@ describe('Transactions creation', () => { itif(safeVersionDeployed < '1.3.0')( 'should return a transaction with defined safeTxGas if safeVersion<1.3.0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -209,7 +167,7 @@ describe('Transactions creation', () => { }) const safeTxGas = BASE_OPTIONS.safeTxGas const txDataPartial: SafeTransactionDataPartial = { - to: account2.address, + to: accounts[1].address, value: '0', data: '0x', safeTxGas @@ -227,7 +185,7 @@ describe('Transactions creation', () => { describe('createTransaction', async () => { it('should create a single transaction with gasPrice=0', async () => { - const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() + const { predictedSafe, accounts, contractNetworks } = await setupTests() const [, account2] = accounts const safeSdk = await Safe.init({ provider, @@ -248,9 +206,7 @@ describe('Transactions creation', () => { }) it('should create a single transaction with gasPrice=0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -258,7 +214,7 @@ describe('Transactions creation', () => { contractNetworks }) const safeTransactionData = { - to: account2.address, + to: accounts[1].address, value: '500000000000000000', // 0.5 ETH data: '0x' } @@ -266,7 +222,7 @@ describe('Transactions creation', () => { transactions: [safeTransactionData], options: BASE_OPTIONS }) - chai.expect(tx.data.to).to.be.eq(account2.address) + chai.expect(tx.data.to).to.be.eq(accounts[1].address) chai.expect(tx.data.value).to.be.eq('500000000000000000') chai.expect(tx.data.data).to.be.eq('0x') chai.expect(tx.data.baseGas).to.be.eq(BASE_OPTIONS.baseGas) @@ -278,9 +234,7 @@ describe('Transactions creation', () => { }) it('should create a single transaction with gasPrice>0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -288,7 +242,7 @@ describe('Transactions creation', () => { contractNetworks }) const safeTransactionData = { - to: account2.address, + to: accounts[1].address, value: '500000000000000000', // 0.5 ETH data: '0x' } @@ -296,7 +250,7 @@ describe('Transactions creation', () => { transactions: [safeTransactionData], options: BASE_OPTIONS }) - chai.expect(tx.data.to).to.be.eq(account2.address) + chai.expect(tx.data.to).to.be.eq(accounts[1].address) chai.expect(tx.data.value).to.be.eq('500000000000000000') chai.expect(tx.data.data).to.be.eq('0x') chai.expect(tx.data.baseGas).to.be.eq(BASE_OPTIONS.baseGas) @@ -308,9 +262,7 @@ describe('Transactions creation', () => { }) it('should create a single transaction when passing a transaction array with length=1', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -318,20 +270,18 @@ describe('Transactions creation', () => { contractNetworks }) const safeTransactionData = { - to: account2.address, + to: accounts[1].address, value: '500000000000000000', // 0.5 ETH data: '0x' } const tx = await safeSdk.createTransaction({ transactions: [safeTransactionData] }) - chai.expect(tx.data.to).to.be.eq(account2.address) + chai.expect(tx.data.to).to.be.eq(accounts[1].address) chai.expect(tx.data.value).to.be.eq('500000000000000000') chai.expect(tx.data.data).to.be.eq('0x') }) it('should create a single transaction when passing a transaction array with length=1 and options', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -339,13 +289,13 @@ describe('Transactions creation', () => { contractNetworks }) const safeTransactionData = { - to: account2.address, + to: accounts[1].address, value: '500000000000000000', // 0.5 ETH data: '0x' } const options: SafeTransactionOptionalProps = BASE_OPTIONS const tx = await safeSdk.createTransaction({ transactions: [safeTransactionData], options }) - chai.expect(tx.data.to).to.be.eq(account2.address) + chai.expect(tx.data.to).to.be.eq(accounts[1].address) chai.expect(tx.data.value).to.be.eq('500000000000000000') chai.expect(tx.data.data).to.be.eq('0x') chai.expect(tx.data.baseGas).to.be.eq(BASE_OPTIONS.baseGas) @@ -357,9 +307,7 @@ describe('Transactions creation', () => { }) it('should fail when creating a MultiSend transaction passing a transaction array with length=0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -371,9 +319,8 @@ describe('Transactions creation', () => { }) it('should create a MultiSend transaction', async () => { - const { accounts, contractNetworks, erc20Mintable, chainId, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks, chainId } = await setupTests() + const erc20Mintable = await getERC20Mintable() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -387,7 +334,7 @@ describe('Transactions creation', () => { data: encodeFunctionData({ abi: erc20Mintable.abi, functionName: 'transfer', - args: [account2.address, '1100000000000000000'] // 1.1 ERC20 + args: [accounts[1].address, '1100000000000000000'] // 1.1 ERC20 }) }, { @@ -396,7 +343,7 @@ describe('Transactions creation', () => { data: encodeFunctionData({ abi: erc20Mintable.abi, functionName: 'transfer', - args: [account2.address, '100000000000000000'] // 0.1 ERC20 + args: [accounts[1].address, '100000000000000000'] // 0.1 ERC20 }) } ] @@ -407,9 +354,8 @@ describe('Transactions creation', () => { }) it('should create a MultiSend transaction with options', async () => { - const { accounts, contractNetworks, erc20Mintable, chainId, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks, chainId } = await setupTests() + const erc20Mintable = await getERC20Mintable() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -425,7 +371,7 @@ describe('Transactions creation', () => { data: encodeFunctionData({ abi: erc20Mintable.abi, functionName: 'transfer', - args: [account2.address, '1100000000000000000'] // 1.1 ERC20 + args: [accounts[1].address, '1100000000000000000'] // 1.1 ERC20 }) }, { @@ -434,7 +380,7 @@ describe('Transactions creation', () => { data: encodeFunctionData({ abi: erc20Mintable.abi, functionName: 'transfer', - args: [account2.address, '100000000000000000'] // 0.1 ERC20 + args: [accounts[1].address, '100000000000000000'] // 0.1 ERC20 }) } ] @@ -454,7 +400,7 @@ describe('Transactions creation', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to create a transaction if the Safe with version { - const { safe, predictedSafe, contractNetworks, provider } = await setupTests() + const { safe, predictedSafe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, diff --git a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts index 899a11bad..62ed90d4b 100644 --- a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts @@ -1,12 +1,8 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { safeVersionDeployed } from '@safe-global/testing-kit' -import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit/index' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners, getMultiSendCallOnly } from './utils/setupContracts' +import { setupTests, getMultiSendCallOnly } from '@safe-global/testing-kit' +import Safe from '@safe-global/protocol-kit/index' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { OperationType } from '@safe-global/safe-core-sdk-types' import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' @@ -15,35 +11,9 @@ chai.use(chaiAsPromised) const AMOUNT_TO_TRANSFER = '500000000000000000' // 0.5 ETH describe('createTransactionBatch', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - - return { - accounts, - contractNetworks, - predictedSafe, - chainId - } - }) - it('should return a batch of the provided transactions', async () => { - const { accounts, contractNetworks } = await setupTests() - const [account1] = accounts + const { safe, contractNetworks } = await setupTests() - const safe = await getSafeWithOwners([account1.address]) const provider = getEip1193Provider() const safeAddress = safe.address diff --git a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts index ff76522f1..58e00b76f 100644 --- a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts @@ -1,27 +1,24 @@ import Safe, { buildContractSignature, hashSafeMessage } from '@safe-global/protocol-kit/index' -import { safeVersionDeployed } from '@safe-global/testing-kit' +import { + safeVersionDeployed, + setupTests as testingKitSetupTests, + getSafeWithOwners, + itif +} from '@safe-global/testing-kit' import { SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' import { SigningMethod } from '@safe-global/protocol-kit/types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' -import { itif } from './utils/helpers' chai.use(chaiAsPromised) describe('The EIP1271 implementation', () => { describe('In the context of a 3/3 Safe account with a 4/4 signer Safe account owner', async () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = await getChainId() - const contractNetworks = await getContractNetworks(BigInt(chainId)) - const fallbackHandlerAddress = contractNetworks[chainId].fallbackHandlerAddress + const setupTests = async () => { + const { chainId, accounts, contractNetworks } = await testingKitSetupTests() + const fallbackHandlerAddress = contractNetworks[Number(chainId)].fallbackHandlerAddress const [account1, account2, account3, account4, account5] = accounts const provider = getEip1193Provider() @@ -63,7 +60,7 @@ describe('The EIP1271 implementation', () => { fallbackHandlerAddress, provider } - }) + } itif(safeVersionDeployed >= '1.3.0')( 'should allow to sign and execute transactions', diff --git a/packages/protocol-kit/tests/e2e/eip1271.test.ts b/packages/protocol-kit/tests/e2e/eip1271.test.ts index 4ffa84d61..8447a6900 100644 --- a/packages/protocol-kit/tests/e2e/eip1271.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271.test.ts @@ -6,19 +6,19 @@ import Safe, { buildContractSignature, EthSafeSignature } from '@safe-global/protocol-kit/index' -import { safeVersionDeployed } from '@safe-global/testing-kit' +import { + safeVersionDeployed, + setupTests as testingKitSetupTests, + getSafeWithOwners, + itif +} from '@safe-global/testing-kit' import SafeMessage from '@safe-global/protocol-kit/utils/messages/SafeMessage' import { OperationType, SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' import { SigningMethod } from '@safe-global/protocol-kit/types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' -import { itif } from './utils/helpers' import semverSatisfies from 'semver/functions/satisfies' import { asHash } from '@safe-global/protocol-kit/utils/types' @@ -42,12 +42,9 @@ const MESSAGE = 'I am the owner of this Safe account' describe('The EIP1271 implementation', () => { describe('In the context of a 2/3 Safe and a 1/1 signer Safe account', async () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = await getChainId() - const contractNetworks = await getContractNetworks(BigInt(chainId)) - const fallbackHandlerAddress = contractNetworks[chainId].fallbackHandlerAddress + const setupTests = async () => { + const { accounts, contractNetworks, chainId } = await testingKitSetupTests() + const fallbackHandlerAddress = contractNetworks[Number(chainId)].fallbackHandlerAddress const [account1, account2] = accounts const provider = getEip1193Provider() @@ -103,7 +100,7 @@ describe('The EIP1271 implementation', () => { safeSdk3, fallbackHandlerAddress } - }) + } itif(safeVersionDeployed >= '1.3.0')( 'should validate on-chain messages (Approved hashes)', diff --git a/packages/protocol-kit/tests/e2e/erc-20.test.ts b/packages/protocol-kit/tests/e2e/erc-20.test.ts index de27538be..0f840a398 100644 --- a/packages/protocol-kit/tests/e2e/erc-20.test.ts +++ b/packages/protocol-kit/tests/e2e/erc-20.test.ts @@ -4,18 +4,12 @@ import Safe, { getERC20Decimals, isGasTokenCompatibleWithHandlePayment } from '@safe-global/protocol-kit/index' -import { safeVersionDeployed } from '@safe-global/testing-kit' +import { safeVersionDeployed, setupTests, itif } from '@safe-global/testing-kit' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import sinon from 'sinon' import sinonChai from 'sinon-chai' -import { deployments } from 'hardhat' - -import { itif } from './utils/helpers' import { getEip1193Provider } from './utils/setupProvider' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners } from './utils/setupContracts' -import { getAccounts } from './utils/setupTestNetwork' import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' chai.use(sinonChai) @@ -30,26 +24,13 @@ describe('ERC-20 utils', () => { callStub.restore() }) - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const provider = getEip1193Provider() - - return { - safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]), - contractNetworks, - accounts, - provider - } - }) + const provider = getEip1193Provider() describe('getERC20Decimals', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return the correct decimals for a standard ERC20 token', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address @@ -71,7 +52,7 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return the correct decimals for a non-standard ERC20 token', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address // mock decimals() call @@ -92,7 +73,7 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should throw an error if decimals() fn is not defined', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address // mock decimals() call @@ -115,7 +96,7 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return true if it is the Native token', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -136,7 +117,7 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return true if it is an standard ERC20 token', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address // mock decimals() call @@ -160,7 +141,7 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return false for a non-standard ERC20 token', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address // mock decimals() call diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index 07e4821ce..0daefcca0 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -1,41 +1,20 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' +import { getERC20Mintable, safeVersionDeployed, setupTests, itif } from '@safe-global/testing-kit' import Safe, { SigningMethod } from '@safe-global/protocol-kit/index' import { TransactionOptions, MetaTransactionData } from '@safe-global/safe-core-sdk-types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { itif } from './utils/helpers' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getERC20Mintable, getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' import { encodeFunctionData } from 'viem' +import { getEip1193Provider } from './utils/setupProvider' chai.use(chaiAsPromised) describe('Transactions execution', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const provider = getEip1193Provider() - - return { - erc20Mintable: await getERC20Mintable(), - safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]), - accounts, - contractNetworks, - provider - } - }) - + const provider = getEip1193Provider() describe('isValidTransaction', async () => { it('should return false if a transaction will not be executed successfully', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -69,9 +48,8 @@ describe('Transactions execution', () => { }) it('should return true if a transaction will execute successfully', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -98,9 +76,8 @@ describe('Transactions execution', () => { describe('executeTransaction', async () => { it('should fail if there are not enough Ether funds', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2] = accounts const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -121,9 +98,10 @@ describe('Transactions execution', () => { }) it('should fail if there are not enough signatures (1 missing)', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2, account3] = accounts - const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) + const [, account2] = accounts const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -150,9 +128,9 @@ describe('Transactions execution', () => { }) it('should fail if there are not enough signatures (>1 missing)', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2, account3] = accounts - const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) + const { safe, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -171,9 +149,8 @@ describe('Transactions execution', () => { }) it('should fail if the user tries to execute a transaction that was rejected', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -220,9 +197,8 @@ describe('Transactions execution', () => { }) it('should fail if a user tries to execute a transaction with options: { nonce: }', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -246,9 +222,8 @@ describe('Transactions execution', () => { }) it('should execute a transaction with threshold 1', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -278,15 +253,10 @@ describe('Transactions execution', () => { itif(safeVersionDeployed === '1.0.0')( 'should execute a transaction with threshold >1 and all different kind of signatures and safeVersion===1.0.0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 5, threshold: 5 } + }) const [account1, account2, account3, account4, account5] = accounts - const safe = await getSafeWithOwners([ - account1.address, - account2.address, - account3.address, - account4.address, - account5.address - ]) const safeAddress = safe.address await account1.signer.sendTransaction({ to: safeAddress, @@ -345,16 +315,10 @@ describe('Transactions execution', () => { itif(safeVersionDeployed > '1.0.0')( 'should execute a transaction with threshold >1 and all different kind of signatures and safeVersion>1.0.0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 6, threshold: 6 } + }) const [account1, account2, account3, account4, account5, account6] = accounts - const safe = await getSafeWithOwners([ - account1.address, - account2.address, - account3.address, - account4.address, - account5.address, - account6.address - ]) const safeAddress = safe.address await account1.signer.sendTransaction({ to: safeAddress, @@ -417,7 +381,9 @@ describe('Transactions execution', () => { ) it('should execute a transaction when is not submitted by an owner', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 2, threshold: 2 } + }) const [, account2, account3] = accounts const safeAddress = safe.address const safeSdk1 = await Safe.init({ @@ -455,9 +421,8 @@ describe('Transactions execution', () => { }) it('should execute a transaction with options: { gasLimit }', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -482,9 +447,8 @@ describe('Transactions execution', () => { }) it('should execute a transaction with options: { gasLimit, gasPrice }', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -513,9 +477,8 @@ describe('Transactions execution', () => { }) it('should execute a transaction with options: { maxFeePerGas, maxPriorityFeePerGas }', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -546,9 +509,8 @@ describe('Transactions execution', () => { }) it('should execute a transaction with options: { nonce }', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -576,9 +538,10 @@ describe('Transactions execution', () => { describe('executeTransaction (MultiSend)', async () => { it('should execute a batch transaction with threshold >1', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const [account1, account2, account3] = accounts - const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, @@ -624,9 +587,11 @@ describe('Transactions execution', () => { }) it('should execute a batch transaction with contract calls and threshold >1', async () => { - const { accounts, contractNetworks, erc20Mintable, provider } = await setupTests() - const [account1, account2, account3] = accounts - const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) + const erc20Mintable = await getERC20Mintable() + const [, account2, account3] = accounts const safeAddress = safe.address const safeSdk1 = await Safe.init({ provider, diff --git a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts index a9342999f..6e516cf8b 100644 --- a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts @@ -1,57 +1,28 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' -import Safe, { - PredictedSafeProps, - SafeTransactionOptionalProps -} from '@safe-global/protocol-kit/index' -import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' -import chai from 'chai' -import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { itif } from './utils/helpers' -import { getContractNetworks } from './utils/setupContractNetworks' import { + safeVersionDeployed, + setupTests, getCompatibilityFallbackHandler, getDefaultCallbackHandler, - getSafeWithOwners -} from './utils/setupContracts' + getSafeWithOwners, + itif +} from '@safe-global/testing-kit' +import Safe, { SafeTransactionOptionalProps } from '@safe-global/protocol-kit/index' +import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' +import chai from 'chai' +import chaiAsPromised from 'chai-as-promised' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' chai.use(chaiAsPromised) describe('Fallback handler manager', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - const provider = getEip1193Provider() - - return { - safe: await getSafeWithOwners([accounts[0].address]), - accounts, - contractNetworks, - defaultCallbackHandler: await getDefaultCallbackHandler(), - predictedSafe, - provider - } - }) + const provider = getEip1193Provider() describe('getFallbackHandler', async () => { itif(safeVersionDeployed < '1.1.1')( 'should fail if getting the enabled fallback handler is not supported', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -68,7 +39,7 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -78,7 +49,8 @@ describe('Fallback handler manager', () => { }) itif(safeVersionDeployed >= '1.1.1')('should return the enabled fallback handler', async () => { - const { safe, contractNetworks, defaultCallbackHandler, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const defaultCallbackHandler = await getDefaultCallbackHandler() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -99,8 +71,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if the Safe with version { - const { predictedSafe, contractNetworks, defaultCallbackHandler, provider } = - await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() + const defaultCallbackHandler = await getDefaultCallbackHandler() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -118,8 +90,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should fail if the Safe with version >=v1.3.0 is not deployed', async () => { - const { predictedSafe, contractNetworks, defaultCallbackHandler, provider } = - await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() + const defaultCallbackHandler = await getDefaultCallbackHandler() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -133,7 +105,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.1.1')( 'should fail if enabling a fallback handler is not supported', async () => { - const { safe, contractNetworks, defaultCallbackHandler, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const defaultCallbackHandler = await getDefaultCallbackHandler() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -150,7 +123,7 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should fail if address is invalid', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -164,7 +137,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')( 'should fail if address is equal to 0x address', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -177,7 +150,8 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should fail if address is already enabled', async () => { - const { safe, contractNetworks, defaultCallbackHandler, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const defaultCallbackHandler = await getDefaultCallbackHandler() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -194,7 +168,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')( 'should build the transaction with the optional props', async () => { - const { safe, contractNetworks, defaultCallbackHandler, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const defaultCallbackHandler = await getDefaultCallbackHandler() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -223,7 +198,8 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should enable a fallback handler', async () => { - const { safe, contractNetworks, defaultCallbackHandler, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const defaultCallbackHandler = await getDefaultCallbackHandler() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -244,7 +220,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if the Safe with version { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -262,14 +238,13 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should fail if the Safe with version >=v1.3.0 is not deployed', async () => { - const { predictedSafe, contractNetworks, defaultCallbackHandler, provider } = - await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, contractNetworks }) - const tx = safeSdk.createDisableFallbackHandlerTx(defaultCallbackHandler.address) + const tx = safeSdk.createDisableFallbackHandlerTx() await chai.expect(tx).to.be.rejectedWith('Safe is not deployed') } ) @@ -277,7 +252,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.1.1')( 'should fail if disabling a fallback handler is not supported', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address @@ -298,7 +273,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')( 'should fail if no fallback handler is enabled', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -319,7 +294,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')( 'should build the transaction with the optional props', async () => { - const { accounts, contractNetworks, defaultCallbackHandler, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() + const defaultCallbackHandler = await getDefaultCallbackHandler() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address @@ -352,7 +328,8 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should disable an enabled fallback handler', async () => { - const { accounts, contractNetworks, defaultCallbackHandler, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() + const defaultCallbackHandler = await getDefaultCallbackHandler() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address diff --git a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts index 150a2116c..a19c34668 100644 --- a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts @@ -1,33 +1,15 @@ import Safe from '@safe-global/protocol-kit/index' -import { safeVersionDeployed } from '@safe-global/testing-kit' +import { safeVersionDeployed, setupTests, itif } from '@safe-global/testing-kit' import chai from 'chai' -import { deployments } from 'hardhat' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' -import { itif } from './utils/helpers' describe('getEncodedTransaction', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const provider = getEip1193Provider() - - return { - accounts, - contractNetworks, - provider - } - }) + const provider = getEip1193Provider() itif(safeVersionDeployed >= '1.3.0')('should return a transaction encoded', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -54,10 +36,8 @@ describe('getEncodedTransaction', () => { }) itif(safeVersionDeployed <= '1.2.0')('should return a transaction encoded', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2] = accounts const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -84,10 +64,8 @@ describe('getEncodedTransaction', () => { }) it('should return a signed transaction with the signatures encoded', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2] = accounts const safeAddress = safe.address const safeSdk = await Safe.init({ diff --git a/packages/protocol-kit/tests/e2e/guardManager.test.ts b/packages/protocol-kit/tests/e2e/guardManager.test.ts index f1c13d026..38cc9ea9f 100644 --- a/packages/protocol-kit/tests/e2e/guardManager.test.ts +++ b/packages/protocol-kit/tests/e2e/guardManager.test.ts @@ -1,52 +1,26 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' -import Safe, { - PredictedSafeProps, - SafeTransactionOptionalProps -} from '@safe-global/protocol-kit/index' +import { + safeVersionDeployed, + setupTests, + getDebugTransactionGuard, + itif +} from '@safe-global/testing-kit' +import Safe, { SafeTransactionOptionalProps } from '@safe-global/protocol-kit/index' import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { itif } from './utils/helpers' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getDebugTransactionGuard, getSafeWithOwners } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' chai.use(chaiAsPromised) describe('Safe guard manager', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const provider = getEip1193Provider() - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - return { - debugTransactionGuard: await getDebugTransactionGuard(), - safe: await getSafeWithOwners([accounts[0].address]), - accounts, - contractNetworks, - predictedSafe, - provider - } - }) + const provider = getEip1193Provider() describe('getGuard', async () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if getting the enabled guard is not supported', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -63,7 +37,7 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -75,7 +49,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return 0x address when no Safe guard is enabled', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -87,7 +61,8 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should return the enabled Safe guard', async () => { - const { safe, contractNetworks, debugTransactionGuard, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const debugTransactionGuard = await getDebugTransactionGuard() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -106,7 +81,8 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if enabling a Safe guard is not supported', async () => { - const { safe, contractNetworks, debugTransactionGuard, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const debugTransactionGuard = await getDebugTransactionGuard() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -123,9 +99,8 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { - const { predictedSafe, debugTransactionGuard, contractNetworks, provider } = - await setupTests() - + const { predictedSafe, contractNetworks } = await setupTests() + const debugTransactionGuard = await getDebugTransactionGuard() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -136,7 +111,7 @@ describe('Safe guard manager', () => { }) itif(safeVersionDeployed >= '1.3.0')('should fail if address is invalid', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -150,7 +125,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should fail if address is equal to 0x address', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -164,7 +139,8 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if address is already enabled', async () => { - const { safe, contractNetworks, debugTransactionGuard, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const debugTransactionGuard = await getDebugTransactionGuard() const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -182,7 +158,8 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should build the transaction with the optional props', async () => { - const { safe, contractNetworks, debugTransactionGuard, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const debugTransactionGuard = await getDebugTransactionGuard() const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -209,7 +186,8 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should enable a Safe guard', async () => { - const { safe, contractNetworks, debugTransactionGuard, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const debugTransactionGuard = await getDebugTransactionGuard() const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -229,9 +207,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if disabling a Safe guard is not supported', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -248,7 +224,7 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, @@ -260,7 +236,7 @@ describe('Safe guard manager', () => { }) itif(safeVersionDeployed >= '1.3.0')('should fail if no Safe guard is enabled', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -275,9 +251,8 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should build the transaction with the optional props', async () => { - const { accounts, contractNetworks, debugTransactionGuard, provider } = await setupTests() - const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, contractNetworks } = await setupTests() + const debugTransactionGuard = await getDebugTransactionGuard() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -307,9 +282,8 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should disable an enabled Safe guard', async () => { - const { accounts, contractNetworks, debugTransactionGuard, provider } = await setupTests() - const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, contractNetworks } = await setupTests() + const debugTransactionGuard = await getDebugTransactionGuard() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, diff --git a/packages/protocol-kit/tests/e2e/moduleManager.test.ts b/packages/protocol-kit/tests/e2e/moduleManager.test.ts index 79d4cb397..72cceb1d9 100644 --- a/packages/protocol-kit/tests/e2e/moduleManager.test.ts +++ b/packages/protocol-kit/tests/e2e/moduleManager.test.ts @@ -1,60 +1,27 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' -import Safe, { - PredictedSafeProps, - SafeTransactionOptionalProps -} from '@safe-global/protocol-kit/index' -import { SENTINEL_ADDRESS, ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' -import chai from 'chai' -import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { getContractNetworks } from './utils/setupContractNetworks' import { getDailyLimitModule, getSafeWithOwners, getSocialRecoveryModule, getStateChannelModule, - getWhiteListModule -} from './utils/setupContracts' + getWhiteListModule, + setupTests +} from '@safe-global/testing-kit' +import Safe, { SafeTransactionOptionalProps } from '@safe-global/protocol-kit/index' +import { SENTINEL_ADDRESS, ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' +import chai from 'chai' +import chaiAsPromised from 'chai-as-promised' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' import semverSatisfies from 'semver/functions/satisfies' chai.use(chaiAsPromised) describe('Safe modules manager', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - const provider = getEip1193Provider() - - return { - dailyLimitModule: await getDailyLimitModule(), - socialRecoveryModule: await getSocialRecoveryModule(), - stateChannelModule: await getStateChannelModule(), - whiteListModule: await getWhiteListModule(), - safe: await getSafeWithOwners([accounts[0].address]), - accounts, - contractNetworks, - predictedSafe, - provider - } - }) + const provider = getEip1193Provider() describe('getModules', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -64,8 +31,9 @@ describe('Safe modules manager', () => { }) it('should return all the enabled modules', async () => { - const { safe, dailyLimitModule, socialRecoveryModule, contractNetworks, provider } = - await setupTests() + const { safe, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() + const socialRecoveryModule = await getSocialRecoveryModule() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -91,7 +59,7 @@ describe('Safe modules manager', () => { describe('getModulesPaginated', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -103,7 +71,8 @@ describe('Safe modules manager', () => { }) it('should return the enabled modules', async () => { - const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -124,15 +93,11 @@ describe('Safe modules manager', () => { }) it('should constraint returned modules by pageSize', async () => { - const { - safe, - dailyLimitModule, - contractNetworks, - socialRecoveryModule, - stateChannelModule, - whiteListModule, - provider - } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() + const socialRecoveryModule = await getSocialRecoveryModule() + const stateChannelModule = await getStateChannelModule() + const whiteListModule = await getWhiteListModule() const safeAddress = safe.address const dailyLimitsAddress = dailyLimitModule.address const socialRecoveryAddress = socialRecoveryModule.address @@ -192,20 +157,13 @@ describe('Safe modules manager', () => { }) it('should offset the returned modules', async () => { - const { - safe, - dailyLimitModule, - contractNetworks, - socialRecoveryModule, - stateChannelModule, - whiteListModule, - provider - } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address - const dailyLimitsAddress = dailyLimitModule.address - const socialRecoveryAddress = socialRecoveryModule.address - const stateChannelAddress = stateChannelModule.address - const whiteListAddress = whiteListModule.address + const dailyLimitModule = await getDailyLimitModule() + const socialRecoveryModule = await getSocialRecoveryModule() + const stateChannelModule = await getStateChannelModule() + const whiteListModule = await getWhiteListModule() + const safeSdk = await Safe.init({ provider, safeAddress, @@ -214,10 +172,10 @@ describe('Safe modules manager', () => { const currentPageNext = semverSatisfies(await safeSdk.getContractVersion(), '>=1.4.1') const moduleDeployment = [ - dailyLimitsAddress, - socialRecoveryAddress, - stateChannelAddress, - whiteListAddress + dailyLimitModule.address, + socialRecoveryModule.address, + stateChannelModule.address, + whiteListModule.address ].map(async (moduleAddress) => { const txModule = await safeSdk.createEnableModuleTx(moduleAddress) const moduleResponse = await safeSdk.executeTransaction(txModule) @@ -246,7 +204,7 @@ describe('Safe modules manager', () => { }) it('should fail if pageSize is invalid', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -261,7 +219,8 @@ describe('Safe modules manager', () => { describe('isModuleEnabled', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, dailyLimitModule, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -272,7 +231,8 @@ describe('Safe modules manager', () => { }) it('should return true if a module is enabled', async () => { - const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -289,7 +249,8 @@ describe('Safe modules manager', () => { describe('createEnableModuleTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, dailyLimitModule, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -300,7 +261,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is invalid', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -312,7 +273,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to sentinel', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -324,7 +285,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to 0x address', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -336,7 +297,8 @@ describe('Safe modules manager', () => { }) it('should fail if address is already enabled', async () => { - const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -351,7 +313,8 @@ describe('Safe modules manager', () => { }) it('should build the transaction with the optional props', async () => { - const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -376,7 +339,8 @@ describe('Safe modules manager', () => { }) it('should enable a Safe module', async () => { - const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -395,7 +359,8 @@ describe('Safe modules manager', () => { describe('createDisableModuleTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, dailyLimitModule, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -406,7 +371,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is invalid', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -418,7 +383,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to sentinel', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -430,7 +395,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to 0x address', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -442,7 +407,8 @@ describe('Safe modules manager', () => { }) it('should fail if address is not enabled', async () => { - const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -454,7 +420,8 @@ describe('Safe modules manager', () => { }) it('should build the transaction with the optional props', async () => { - const { dailyLimitModule, accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address @@ -488,8 +455,9 @@ describe('Safe modules manager', () => { }) it('should disable Safe modules', async () => { - const { dailyLimitModule, accounts, socialRecoveryModule, contractNetworks, provider } = - await setupTests() + const { accounts, contractNetworks } = await setupTests() + const dailyLimitModule = await getDailyLimitModule() + const socialRecoveryModule = await getSocialRecoveryModule() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = safe.address diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 1746ce278..539784ea1 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -1,46 +1,18 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' -import Safe, { PredictedSafeProps, SigningMethod } from '@safe-global/protocol-kit/index' +import { safeVersionDeployed, setupTests, itif } from '@safe-global/testing-kit' +import Safe, { SigningMethod } from '@safe-global/protocol-kit/index' import { SafeMultisigTransactionResponse } from '@safe-global/safe-core-sdk-types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { itif } from './utils/helpers' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) describe('Off-chain signatures', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - const provider = getEip1193Provider() - - return { - safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]), - accounts, - contractNetworks, - predictedSafe, - provider - } - }) + const provider = getEip1193Provider() describe('signHash', async () => { it('should sign a transaction hash with the current signer if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -52,7 +24,7 @@ describe('Off-chain signatures', () => { }) it('should sign a transaction hash with the current signer', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -75,7 +47,7 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to sign a transaction if the Safe with version { - const { safe, predictedSafe, contractNetworks, provider } = await setupTests() + const { safe, predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -107,7 +79,7 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed >= '1.3.0')( 'should sign a transaction with the current signer if the Safe with version >=v1.3.0 is using predicted config', async () => { - const { safe, predictedSafe, contractNetworks, provider } = await setupTests() + const { safe, predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -128,7 +100,7 @@ describe('Off-chain signatures', () => { ) it('should fail if the signature is added by an account that is not an owner', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const account3 = accounts[2] const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -149,7 +121,7 @@ describe('Off-chain signatures', () => { }) it('should ignore duplicated signatures', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -173,7 +145,7 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed === '1.0.0')( 'should fail if the signature of the current signer is added using eth_sign and safeVersion===1.0.0', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -195,7 +167,7 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed > '1.0.0')( 'should add the signature of the current signer using eth_sign if safeVersion>1.0.0', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -216,7 +188,7 @@ describe('Off-chain signatures', () => { ) it('should add the signature of the current signer using eth_signTypedData', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -236,7 +208,7 @@ describe('Off-chain signatures', () => { }) it('should add the signature of the current signer using eth_signTypedData_v3', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -256,7 +228,7 @@ describe('Off-chain signatures', () => { }) it('should add the signature of the current signer using eth_signTypedData_v4', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -276,7 +248,7 @@ describe('Off-chain signatures', () => { }) it('should add the signature of the current signer using eth_signTypedData_v4 by default', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = safe.address const safeSdk = await Safe.init({ provider, @@ -296,7 +268,7 @@ describe('Off-chain signatures', () => { }) it('should sign a transaction received from the Safe Transaction Service', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeAddress = safe.address const safeSdk = await Safe.init({ @@ -304,7 +276,7 @@ describe('Off-chain signatures', () => { safeAddress, contractNetworks }) - const safeServiceTransaction: SafeMultisigTransactionResponse = { + const safeServiceTransaction = { safe: '', to: account2.address, value: '500000000000000000', // 0.5 ETH @@ -352,7 +324,9 @@ describe('Off-chain signatures', () => { trusted: true, signatures: '0x111111222222' } - const signedTx = await safeSdk.signTransaction(safeServiceTransaction) + const signedTx = await safeSdk.signTransaction( + safeServiceTransaction as SafeMultisigTransactionResponse + ) chai.expect(safeServiceTransaction.confirmations?.length).to.be.eq(2) chai.expect(signedTx.signatures.size).to.be.eq(3) const signerAddress = account1.address diff --git a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts index 9a6724fc5..d9dba53a1 100644 --- a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts @@ -1,45 +1,19 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' -import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit/index' +import { setupTests } from '@safe-global/testing-kit' +import Safe from '@safe-global/protocol-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' chai.use(chaiAsPromised) describe('On-chain signatures', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - const provider = getEip1193Provider() - - return { - safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]), - accounts, - contractNetworks, - predictedSafe, - provider - } - }) - + const provider = getEip1193Provider() describe('approveTransactionHash', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 2, threshold: 2 } + }) const safeSdk1 = await Safe.init({ provider, predictedSafe, @@ -52,7 +26,9 @@ describe('On-chain signatures', () => { }) it('should fail if a transaction hash is approved by an account that is not an owner', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 2, threshold: 2 } + }) const account3 = accounts[2] const safeAddress = safe.address const safeSdk1 = await Safe.init({ @@ -74,7 +50,9 @@ describe('On-chain signatures', () => { }) it('should approve the transaction hash', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 2, threshold: 2 } + }) const [account1] = accounts const safeAddress = safe.address const safeSdk1 = await Safe.init({ @@ -95,7 +73,9 @@ describe('On-chain signatures', () => { }) it('should ignore a duplicated signatures', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 2, threshold: 2 } + }) const [account1] = accounts const safeAddress = safe.address const safeSdk1 = await Safe.init({ @@ -122,7 +102,9 @@ describe('On-chain signatures', () => { describe('getOwnersWhoApprovedTx', async () => { it('should fail if Safe is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 2, threshold: 2 } + }) const safeSdk1 = await Safe.init({ provider, predictedSafe, @@ -134,7 +116,9 @@ describe('On-chain signatures', () => { }) it('should return the list of owners who approved a transaction hash', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 2, threshold: 2 } + }) const [, account2] = accounts const safeAddress = safe.address const safeSdk1 = await Safe.init({ diff --git a/packages/protocol-kit/tests/e2e/ownerManager.test.ts b/packages/protocol-kit/tests/e2e/ownerManager.test.ts index 6c3213b91..ff1694a25 100644 --- a/packages/protocol-kit/tests/e2e/ownerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/ownerManager.test.ts @@ -1,52 +1,20 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' -import Safe, { - PredictedSafeProps, - SafeTransactionOptionalProps -} from '@safe-global/protocol-kit/index' +import { setupTests } from '@safe-global/testing-kit' +import Safe, { SafeTransactionOptionalProps } from '@safe-global/protocol-kit/index' import { SENTINEL_ADDRESS, ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' chai.use(chaiAsPromised) describe('Safe owners manager', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const provider = getEip1193Provider() - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - return { - safe: await getSafeWithOwners([ - accounts[0].address, - accounts[1].address, - accounts[2].address - ]), - accounts, - contractNetworks, - predictedSafe, - provider - } - }) - + const provider = getEip1193Provider() describe('getOwners', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const safeSdk = await Safe.init({ provider, predictedSafe, @@ -56,9 +24,10 @@ describe('Safe owners manager', () => { }) it('should return the list of Safe owners', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 2, threshold: 2 } + }) const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address, account2.address]) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -73,7 +42,9 @@ describe('Safe owners manager', () => { describe('isOwner', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() + const { predictedSafe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const [account1] = accounts const safeSdk = await Safe.init({ provider, @@ -84,9 +55,8 @@ describe('Safe owners manager', () => { }) it('should return true if an account is an owner of the connected Safe', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -97,9 +67,8 @@ describe('Safe owners manager', () => { }) it('should return false if an account is not an owner of the connected Safe', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2] = accounts const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -112,7 +81,9 @@ describe('Safe owners manager', () => { describe('createAddOwnerTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() + const { predictedSafe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const [, account2] = accounts const safeSdk = await Safe.init({ provider, @@ -124,9 +95,7 @@ describe('Safe owners manager', () => { }) it('should fail if address is invalid', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -137,9 +106,7 @@ describe('Safe owners manager', () => { }) it('should fail if address is equal to sentinel', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -150,9 +117,7 @@ describe('Safe owners manager', () => { }) it('should fail if address is equal to 0x address', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -163,9 +128,8 @@ describe('Safe owners manager', () => { }) it('should fail if address is already an owner', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -176,9 +140,8 @@ describe('Safe owners manager', () => { }) it('should fail if the threshold is bigger than the number of owners', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2] = accounts const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -195,9 +158,8 @@ describe('Safe owners manager', () => { }) it('should fail if the threshold is not bigger than 0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2] = accounts const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -208,9 +170,8 @@ describe('Safe owners manager', () => { }) it('should build the transaction with the optional props', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2] = accounts const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -234,9 +195,8 @@ describe('Safe owners manager', () => { }) it('should add an owner and keep the same threshold', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -258,9 +218,8 @@ describe('Safe owners manager', () => { }) it('should add an owner and update the threshold', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -286,7 +245,7 @@ describe('Safe owners manager', () => { describe('createRemoveOwnerTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() + const { predictedSafe, accounts, contractNetworks } = await setupTests() const [, account2] = accounts const safeSdk = await Safe.init({ provider, @@ -298,7 +257,9 @@ describe('Safe owners manager', () => { }) it('should fail if address is invalid', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -309,7 +270,9 @@ describe('Safe owners manager', () => { }) it('should fail if address is equal to sentinel', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -320,7 +283,9 @@ describe('Safe owners manager', () => { }) it('should fail if address is equal to 0x address', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -331,7 +296,9 @@ describe('Safe owners manager', () => { }) it('should fail if address is not an owner', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const [, , , account4] = accounts const safeSdk = await Safe.init({ provider, @@ -343,7 +310,9 @@ describe('Safe owners manager', () => { }) it('should fail if the threshold is bigger than the number of owners', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const [account1] = accounts const safeSdk = await Safe.init({ provider, @@ -361,7 +330,9 @@ describe('Safe owners manager', () => { }) it('should fail if the threshold is not bigger than 0', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const [account1] = accounts const safeSdk = await Safe.init({ provider, @@ -373,7 +344,9 @@ describe('Safe owners manager', () => { }) it('should build the transaction with the optional props', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const [account1] = accounts const safeSdk1 = await Safe.init({ provider, @@ -398,7 +371,9 @@ describe('Safe owners manager', () => { }) it('should remove the first owner of a Safe and decrease the threshold', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const [account1, account2, account3] = accounts const safeSdk1 = await Safe.init({ provider, @@ -431,7 +406,9 @@ describe('Safe owners manager', () => { }) it('should remove any owner of a Safe and decrease the threshold', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const [account1, account2, account3] = accounts const safeSdk1 = await Safe.init({ provider, @@ -465,7 +442,9 @@ describe('Safe owners manager', () => { }) it('should remove an owner and update the threshold', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const [account1, account2, account3] = accounts const safeSdk1 = await Safe.init({ provider, @@ -502,7 +481,7 @@ describe('Safe owners manager', () => { describe('createSwapOwnerTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() + const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts const safeSdk = await Safe.init({ provider, @@ -517,9 +496,8 @@ describe('Safe owners manager', () => { }) it('should fail if old address is invalid', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2] = accounts const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -533,9 +511,8 @@ describe('Safe owners manager', () => { }) it('should fail if new address is invalid', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -549,9 +526,8 @@ describe('Safe owners manager', () => { }) it('should fail if old address is equal to sentinel', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2] = accounts const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -565,9 +541,8 @@ describe('Safe owners manager', () => { }) it('should fail if new address is equal to sentinel', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -581,9 +556,8 @@ describe('Safe owners manager', () => { }) it('should fail if old address is equal to 0x address', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2] = accounts const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -597,9 +571,8 @@ describe('Safe owners manager', () => { }) it('should fail if new address is equal to 0x address', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -613,9 +586,8 @@ describe('Safe owners manager', () => { }) it('should fail if old address is not an owner', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2, , account4] = accounts - const safe = await getSafeWithOwners([account1.address]) + const { safe, accounts, contractNetworks } = await setupTests() + const [, account2, , account4] = accounts const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -629,9 +601,8 @@ describe('Safe owners manager', () => { }) it('should fail if new address is already an owner', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -645,9 +616,8 @@ describe('Safe owners manager', () => { }) it('should build the transaction with the optional props', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -674,9 +644,8 @@ describe('Safe owners manager', () => { }) it('should replace the first owner of a Safe', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -697,7 +666,9 @@ describe('Safe owners manager', () => { }) it('should replace any owner of a Safe', async () => { - const { safe, accounts, contractNetworks, provider } = await setupTests() + const { safe, accounts, contractNetworks } = await setupTests({ + safeConfig: { numberOfOwners: 3, threshold: 3 } + }) const [account1, account2, account3, account4] = accounts const safeSdk1 = await Safe.init({ provider, diff --git a/packages/protocol-kit/tests/e2e/passkey.test.ts b/packages/protocol-kit/tests/e2e/passkey.test.ts index 89f5f2031..21a072ca7 100644 --- a/packages/protocol-kit/tests/e2e/passkey.test.ts +++ b/packages/protocol-kit/tests/e2e/passkey.test.ts @@ -1,4 +1,11 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' +import { + safeVersionDeployed, + setupTests as testingKitSetupTests, + itif, + describeif, + getWebAuthnContract, + getSafeWithOwners +} from '@safe-global/testing-kit' import { OperationType } from '@safe-global/safe-core-sdk-types' import Safe, { getPasskeyOwnerAddress, @@ -9,18 +16,13 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import sinon from 'sinon' import sinonChai from 'sinon-chai' -import { deployments } from 'hardhat' import crypto from 'crypto' import { getSafeWebAuthnSignerFactoryContract, getSafeWebAuthnSharedSignerContract } from '@safe-global/protocol-kit/contracts/safeDeploymentContracts' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners, getWebAuthnContract } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' import { waitSafeTxReceipt } from './utils/transactions' -import { getAccounts } from './utils/setupTestNetwork' -import { itif, describeif } from './utils/helpers' import { createMockPasskey, getWebAuthnCredentials, deployPasskeysContract } from './utils/passkeys' chai.use(chaiAsPromised) @@ -43,8 +45,8 @@ Object.defineProperty(global, 'navigator', { }) describe('Passkey', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() + const setupTests = async () => { + const { accounts, chainId, contractNetworks } = await testingKitSetupTests() const webAuthnContract = await getWebAuthnContract() const customVerifierAddress = webAuthnContract.address @@ -52,8 +54,6 @@ describe('Passkey', () => { const passkey1 = { ...(await createMockPasskey('chucknorris')), customVerifierAddress } const passkey2 = { ...(await createMockPasskey('brucelee')), customVerifierAddress } - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) const provider = getEip1193Provider() const safeProvider = await SafeProvider.init(provider) const customContracts = contractNetworks?.[chainId.toString()] @@ -88,7 +88,7 @@ describe('Passkey', () => { return { safeProvider, - accounts: await getAccounts(), + accounts, contractNetworks, predictedSafe, provider, @@ -97,7 +97,7 @@ describe('Passkey', () => { safeWebAuthnSignerFactoryContract, safeWebAuthnSharedSignerContract } - }) + } describe('isOwner', async () => { itif(safeVersionDeployed < '1.3.0')( diff --git a/packages/protocol-kit/tests/e2e/safeFactory.test.ts b/packages/protocol-kit/tests/e2e/safeFactory.test.ts index 88cef595c..f28764185 100644 --- a/packages/protocol-kit/tests/e2e/safeFactory.test.ts +++ b/packages/protocol-kit/tests/e2e/safeFactory.test.ts @@ -1,19 +1,8 @@ import { DEFAULT_SAFE_VERSION } from '@safe-global/protocol-kit/contracts/config' -import { safeVersionDeployed } from '@safe-global/testing-kit' -import { - ContractNetworksConfig, - DeploySafeProps, - SafeAccountConfig, - SafeFactory, - SafeProvider -} from '@safe-global/protocol-kit/index' -import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' -import chai from 'chai' -import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { itif } from './utils/helpers' -import { getContractNetworks } from './utils/setupContractNetworks' import { + safeVersionDeployed, + setupTests, + itif, getCompatibilityFallbackHandler, getCreateCall, getDefaultCallbackHandler, @@ -23,37 +12,31 @@ import { getSafeSingleton, getSignMessageLib, getSimulateTxAccessor -} from './utils/setupContracts' +} from '@safe-global/testing-kit' +import { + ContractNetworksConfig, + DeploySafeProps, + SafeAccountConfig, + SafeFactory, + SafeProvider +} from '@safe-global/protocol-kit/index' +import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' +import chai from 'chai' +import chaiAsPromised from 'chai-as-promised' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) describe('SafeProxyFactory', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const provider = getEip1193Provider() - - return { - defaultCallbackHandler: await getDefaultCallbackHandler(), - chainId, - accounts, - contractNetworks, - provider - } - }) + const provider = getEip1193Provider() describe('create', async () => { it('should fail if the current network is not a default network and no contractNetworks is provided', async () => { - const { provider } = await setupTests() chai.expect(SafeFactory.init({ provider })).rejectedWith('Invalid SafeProxyFactory contract') }) it('should fail if the contractNetworks provided are not deployed', async () => { - const { chainId, provider } = await setupTests() + const { chainId } = await setupTests() const contractNetworks: ContractNetworksConfig = { [chainId.toString()]: { safeSingletonAddress: ZERO_ADDRESS, @@ -80,7 +63,7 @@ describe('SafeProxyFactory', () => { }) it('should instantiate the SafeProxyFactory', async () => { - const { contractNetworks, provider } = await setupTests() + const { contractNetworks } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeFactory = await SafeFactory.init({ provider, contractNetworks }) const networkId = await safeProvider.getChainId() @@ -92,7 +75,7 @@ describe('SafeProxyFactory', () => { describe('getEip1193Provider', async () => { it('should return the connected SafeProvider', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safeFactory = await SafeFactory.init({ provider, contractNetworks }) chai.expect(await safeFactory.getSafeProvider().getSignerAddress()).to.be.eq(account1.address) @@ -101,7 +84,7 @@ describe('SafeProxyFactory', () => { describe('getChainId', async () => { it('should return the chainId of the current network', async () => { - const { chainId, contractNetworks, provider } = await setupTests() + const { chainId, contractNetworks } = await setupTests() const safeFactory = await SafeFactory.init({ provider, contractNetworks }) chai.expect(await safeFactory.getChainId()).to.be.eq(chainId) }) @@ -109,7 +92,7 @@ describe('SafeProxyFactory', () => { describe('predictSafeAddress', async () => { it('should fail if there are no owners', async () => { - const { contractNetworks, provider } = await setupTests() + const { contractNetworks } = await setupTests() const safeFactory = await SafeFactory.init({ provider, contractNetworks }) const owners: string[] = [] const threshold = 2 @@ -122,7 +105,7 @@ describe('SafeProxyFactory', () => { }) it('should fail if the threshold is lower than 0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, contractNetworks }) const owners = [account1.address, account2.address] @@ -136,7 +119,7 @@ describe('SafeProxyFactory', () => { }) it('should fail if the threshold is higher than the threshold', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, contractNetworks }) const owners = [account1.address, account2.address] @@ -150,7 +133,7 @@ describe('SafeProxyFactory', () => { }) it('should fail if the saltNonce is lower than 0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, @@ -168,7 +151,7 @@ describe('SafeProxyFactory', () => { }) it('should predict a new Safe with saltNonce', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, @@ -194,7 +177,7 @@ describe('SafeProxyFactory', () => { itif(safeVersionDeployed > '1.0.0')( 'should predict a new Safe with the default CompatibilityFallbackHandler', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, @@ -222,7 +205,8 @@ describe('SafeProxyFactory', () => { itif(safeVersionDeployed > '1.0.0')( 'should predict a new Safe with a custom fallback handler', async () => { - const { accounts, contractNetworks, defaultCallbackHandler, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() + const defaultCallbackHandler = await getDefaultCallbackHandler() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, @@ -251,7 +235,7 @@ describe('SafeProxyFactory', () => { describe('deploySafe', async () => { it('should fail if there are no owners', async () => { - const { contractNetworks, provider } = await setupTests() + const { contractNetworks } = await setupTests() const safeFactory = await SafeFactory.init({ provider, contractNetworks }) const owners: string[] = [] const threshold = 2 @@ -263,7 +247,7 @@ describe('SafeProxyFactory', () => { }) it('should fail if the threshold is lower than 0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, contractNetworks }) const owners = [account1.address, account2.address] @@ -276,7 +260,7 @@ describe('SafeProxyFactory', () => { }) it('should fail if the threshold is higher than the threshold', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, contractNetworks }) const owners = [account1.address, account2.address] @@ -289,7 +273,7 @@ describe('SafeProxyFactory', () => { }) it('should fail if the saltNonce is lower than 0', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, @@ -309,7 +293,8 @@ describe('SafeProxyFactory', () => { itif(safeVersionDeployed > '1.0.0')( 'should deploy a new Safe with custom fallback handler', async () => { - const { accounts, contractNetworks, defaultCallbackHandler, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() + const defaultCallbackHandler = await getDefaultCallbackHandler() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, @@ -337,7 +322,7 @@ describe('SafeProxyFactory', () => { itif(safeVersionDeployed > '1.0.0')( 'should deploy a new Safe with the default CompatibilityFallbackHandler', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, @@ -358,7 +343,7 @@ describe('SafeProxyFactory', () => { ) it('should deploy a new Safe without saltNonce', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, @@ -377,7 +362,7 @@ describe('SafeProxyFactory', () => { }) it('should deploy a new Safe with saltNonce', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, @@ -397,7 +382,7 @@ describe('SafeProxyFactory', () => { }) it('should deploy a new Safe with callback', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts let callbackResult = '' const callback = (txHash: string) => { @@ -422,7 +407,7 @@ describe('SafeProxyFactory', () => { itif(safeVersionDeployed === DEFAULT_SAFE_VERSION)( 'should deploy last Safe version by default', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, contractNetworks }) const owners = [account1.address, account2.address] @@ -436,7 +421,7 @@ describe('SafeProxyFactory', () => { ) it('should deploy a specific Safe version', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safeFactory = await SafeFactory.init({ provider, diff --git a/packages/protocol-kit/tests/e2e/safeProvider.test.ts b/packages/protocol-kit/tests/e2e/safeProvider.test.ts index 0b1be306d..49cf533e5 100644 --- a/packages/protocol-kit/tests/e2e/safeProvider.test.ts +++ b/packages/protocol-kit/tests/e2e/safeProvider.test.ts @@ -1,10 +1,7 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import chai from 'chai' -import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { getContractNetworks } from './utils/setupContractNetworks' import { + safeVersionDeployed, + setupTests, + itif, getCompatibilityFallbackHandler, getCreateCall, getFactory, @@ -12,11 +9,12 @@ import { getMultiSendCallOnly, getSafeSingleton, getSignMessageLib -} from './utils/setupContracts' +} from '@safe-global/testing-kit' +import { SafeVersion } from '@safe-global/safe-core-sdk-types' +import chai from 'chai' +import chaiAsPromised from 'chai-as-promised' import { getEip1193Provider, getSafeProviderFromNetwork } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { SafeProvider } from '@safe-global/protocol-kit/index' -import { itif } from './utils/helpers' import sinon from 'sinon' import sinonChai from 'sinon-chai' import { createMockPasskey, getWebAuthnCredentials } from './utils/passkeys' @@ -42,26 +40,12 @@ Object.defineProperty(global, 'navigator', { }) describe('Safe contracts', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const provider = getEip1193Provider() - - return { - accounts, - contractNetworks, - chainId, - provider - } - }) + const provider = getEip1193Provider() describe('init', async () => { itif(safeVersionDeployed < '1.3.0')( 'should fail for a passkey signer and Safe { - const { provider } = await setupTests() const passKeySigner = await createMockPasskey('aName') chai @@ -113,7 +97,7 @@ describe('Safe contracts', () => { }) it('should return a Safe contract from the custom addresses', async () => { - const { contractNetworks, chainId, provider } = await setupTests() + const { contractNetworks, chainId } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -139,7 +123,7 @@ describe('Safe contracts', () => { }) it('should return a MultiSend contract from the custom addresses', async () => { - const { contractNetworks, chainId, provider } = await setupTests() + const { contractNetworks, chainId } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -165,7 +149,7 @@ describe('Safe contracts', () => { }) it('should return a MultiSendCallOnly contract from the custom addresses', async () => { - const { contractNetworks, chainId, provider } = await setupTests() + const { contractNetworks, chainId } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -194,7 +178,7 @@ describe('Safe contracts', () => { }) it('should return a CompatibilityFallbackHandler contract from the custom addresses', async () => { - const { contractNetworks, chainId, provider } = await setupTests() + const { contractNetworks, chainId } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -223,7 +207,7 @@ describe('Safe contracts', () => { }) it('should return a SafeProxyFactory contract from the custom addresses', async () => { - const { contractNetworks, chainId, provider } = await setupTests() + const { contractNetworks, chainId } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -249,7 +233,7 @@ describe('Safe contracts', () => { }) it('should return a SignMessageLib contract from the custom addresses', async () => { - const { contractNetworks, chainId, provider } = await setupTests() + const { contractNetworks, chainId } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -277,7 +261,7 @@ describe('Safe contracts', () => { }) it('should return a SafeProxyFactory contract from the custom addresses', async () => { - const { contractNetworks, chainId, provider } = await setupTests() + const { contractNetworks, chainId } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -292,8 +276,6 @@ describe('Safe contracts', () => { }) it('should return an external provider (PublicClient) and signer (WalletClient) when using an EIP1193 provider', async () => { - const { provider } = await setupTests() - const safeProvider = new SafeProvider({ provider }) chai.expect(safeProvider.getExternalProvider()).to.deep.include(publicActions) diff --git a/packages/protocol-kit/tests/e2e/threshold.test.ts b/packages/protocol-kit/tests/e2e/threshold.test.ts index 1a60608bb..df65b235a 100644 --- a/packages/protocol-kit/tests/e2e/threshold.test.ts +++ b/packages/protocol-kit/tests/e2e/threshold.test.ts @@ -1,48 +1,18 @@ -import { safeVersionDeployed } from '@safe-global/testing-kit' -import Safe, { - PredictedSafeProps, - SafeTransactionOptionalProps -} from '@safe-global/protocol-kit/index' +import { setupTests, getSafeWithOwners } from '@safe-global/testing-kit' +import Safe, { SafeTransactionOptionalProps } from '@safe-global/protocol-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getSafeWithOwners } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' chai.use(chaiAsPromised) describe('Safe Threshold', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - const provider = getEip1193Provider() - - return { - safe: await getSafeWithOwners([accounts[0].address]), - accounts, - contractNetworks, - predictedSafe, - provider - } - }) + const provider = getEip1193Provider() describe('getThreshold', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -52,7 +22,7 @@ describe('Safe Threshold', () => { }) it('should return the Safe threshold', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -64,7 +34,7 @@ describe('Safe Threshold', () => { describe('createChangeThresholdTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks, provider } = await setupTests() + const { predictedSafe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, predictedSafe, @@ -77,7 +47,7 @@ describe('Safe Threshold', () => { }) it('should fail if the threshold is bigger than the number of owners', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -92,7 +62,7 @@ describe('Safe Threshold', () => { }) it('should fail if the threshold is not bigger than 0', async () => { - const { safe, contractNetworks, provider } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeSdk = await Safe.init({ provider, safeAddress: safe.address, @@ -105,7 +75,7 @@ describe('Safe Threshold', () => { }) it('should build the transaction with the optional props', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address], 1) const safeSdk = await Safe.init({ @@ -133,7 +103,7 @@ describe('Safe Threshold', () => { }) it('should change the threshold', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address], 1) const safeSdk = await Safe.init({ diff --git a/packages/protocol-kit/tests/e2e/utils/setupContractNetworks.ts b/packages/protocol-kit/tests/e2e/utils/setupContractNetworks.ts deleted file mode 100644 index 781466f80..000000000 --- a/packages/protocol-kit/tests/e2e/utils/setupContractNetworks.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { ContractNetworksConfig } from '@safe-global/protocol-kit/index' -import { - getCompatibilityFallbackHandler, - getCreateCall, - getFactory, - getMultiSend, - getMultiSendCallOnly, - getSafeSingleton, - getSafeWebAuthnSharedSigner, - getSafeWebAuthnSignerFactory, - getSignMessageLib, - getSimulateTxAccessor -} from './setupContracts' - -export async function getContractNetworks(chainId: bigint): Promise { - return { - [chainId.toString()]: { - safeSingletonAddress: (await getSafeSingleton()).contract.address, - safeSingletonAbi: (await getSafeSingleton()).abi, - safeProxyFactoryAddress: (await getFactory()).contract.address, - safeProxyFactoryAbi: (await getFactory()).abi, - multiSendAddress: (await getMultiSend()).contract.address, - multiSendAbi: (await getMultiSend()).abi, - multiSendCallOnlyAddress: (await getMultiSendCallOnly()).contract.address, - multiSendCallOnlyAbi: (await getMultiSendCallOnly()).abi, - fallbackHandlerAddress: (await getCompatibilityFallbackHandler()).contract.address, - fallbackHandlerAbi: (await getCompatibilityFallbackHandler()).abi, - signMessageLibAddress: (await getSignMessageLib()).contract.address, - signMessageLibAbi: (await getSignMessageLib()).abi, - createCallAddress: (await getCreateCall()).contract.address, - createCallAbi: (await getCreateCall()).abi, - simulateTxAccessorAddress: (await getSimulateTxAccessor()).contract.address, - simulateTxAccessorAbi: (await getSimulateTxAccessor()).abi, - safeWebAuthnSignerFactoryAddress: (await getSafeWebAuthnSignerFactory()).contract.address, - safeWebAuthnSignerFactoryAbi: (await getSafeWebAuthnSignerFactory()).abi, - safeWebAuthnSharedSignerAddress: (await getSafeWebAuthnSharedSigner()).contract.address, - safeWebAuthnSharedSignerAbi: (await getSafeWebAuthnSharedSigner()).abi - } - } -} diff --git a/packages/protocol-kit/tests/e2e/utils/transactions.ts b/packages/protocol-kit/tests/e2e/utils/transactions.ts index 3f6ac3ffd..82e4b8b9a 100644 --- a/packages/protocol-kit/tests/e2e/utils/transactions.ts +++ b/packages/protocol-kit/tests/e2e/utils/transactions.ts @@ -1,7 +1,6 @@ -import { GetTransactionReceiptReturnType, Hex, WalletClient, Transport, Chain, Account } from 'viem' +import { GetTransactionReceiptReturnType } from 'viem' import { TransactionResult } from '@safe-global/safe-core-sdk-types' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' -import hre, { viem } from 'hardhat' export async function waitSafeTxReceipt( txResult: TransactionResult @@ -18,12 +17,3 @@ export async function getTransaction( ): Promise { return safeProvider.getTransaction(transactionHash) } - -export async function waitTransactionReceipt(hash: Hex) { - return (await viem.getPublicClient()).waitForTransactionReceipt({ hash }) -} - -export async function getDeployer(): Promise> { - const { deployer } = await hre.getNamedAccounts() - return viem.getWalletClient(deployer) -} diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index 47c2468b8..f60263336 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -1,14 +1,10 @@ import chai from 'chai' -import { deployments } from 'hardhat' -import { getAccounts } from './utils/setupTestNetwork' -import { getContractNetworks } from './utils/setupContractNetworks' -import { getDefaultCallbackHandler } from './utils/setupContracts' import { getEip1193Provider, getSafeProviderFromNetwork } from './utils/setupProvider' import { PREDETERMINED_SALT_NONCE, predictSafeAddress } from '@safe-global/protocol-kit/contracts/utils' -import { safeVersionDeployed } from '@safe-global/testing-kit' +import { safeVersionDeployed, setupTests, itif } from '@safe-global/testing-kit' import { SafeDeploymentConfig, SafeAccountConfig, @@ -17,7 +13,6 @@ import { } from '@safe-global/protocol-kit/types' import Safe, { SafeFactory, DeploySafeProps } from '@safe-global/protocol-kit/index' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' -import { itif } from './utils/helpers' // test util funcion to deploy a safe (needed to check the expected Safe Address) async function deploySafe( @@ -37,25 +32,11 @@ async function deploySafe( } describe('Contract utils', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - const provider = getEip1193Provider() - - return { - defaultCallbackHandler: await getDefaultCallbackHandler(), - chainId, - accounts, - contractNetworks, - provider - } - }) + const provider = getEip1193Provider() describe('predictSafeAddress', () => { it('returns the predicted address of a 1/1 Safe', async () => { - const { accounts, contractNetworks, chainId, provider } = await setupTests() + const { accounts, contractNetworks, chainId } = await setupTests() // 1/1 Safe const [owner1] = accounts @@ -100,7 +81,7 @@ describe('Contract utils', () => { }) it('returns the predicted address of a 1/2 Safe', async () => { - const { accounts, contractNetworks, chainId, provider } = await setupTests() + const { accounts, contractNetworks, chainId } = await setupTests() // 1/2 Safe const [owner1, owner2] = accounts @@ -145,7 +126,7 @@ describe('Contract utils', () => { }) it('returns the predicted address of a 2/2 Safe', async () => { - const { accounts, contractNetworks, chainId, provider } = await setupTests() + const { accounts, contractNetworks, chainId } = await setupTests() // 2/2 Safe const [owner1, owner2] = accounts @@ -190,7 +171,7 @@ describe('Contract utils', () => { }) it('should fail if the provided threshold is invalid (greater than owners length)', async () => { - const { accounts, contractNetworks, chainId, provider } = await setupTests() + const { accounts, contractNetworks, chainId } = await setupTests() // invalid threshold 3/2 Safe const [owner1, owner2] = accounts @@ -224,7 +205,7 @@ describe('Contract utils', () => { }) it('should fail if the provided threshold is invalid (zero value)', async () => { - const { accounts, contractNetworks, chainId, provider } = await setupTests() + const { accounts, contractNetworks, chainId } = await setupTests() // invalid threshold 0/2 Safe const [owner1, owner2] = accounts @@ -258,7 +239,7 @@ describe('Contract utils', () => { }) it('should fail if the provided threshold is invalid (negative value)', async () => { - const { accounts, contractNetworks, chainId, provider } = await setupTests() + const { accounts, contractNetworks, chainId } = await setupTests() // invalid threshold -2/2 Safe const [owner1, owner2] = accounts @@ -292,7 +273,7 @@ describe('Contract utils', () => { }) it('should fail if no owners are present (empty array)', async () => { - const { contractNetworks, chainId, provider } = await setupTests() + const { contractNetworks, chainId } = await setupTests() // invalid owners 1/0 Safe const invalidOwners: string[] = [] @@ -325,7 +306,7 @@ describe('Contract utils', () => { }) it('returns different addresses with different saltNonce value but same Safe config (threshold & owners)', async () => { - const { accounts, contractNetworks, chainId, provider } = await setupTests() + const { accounts, contractNetworks, chainId } = await setupTests() // 1/2 Safe const [owner1, owner2] = accounts @@ -418,7 +399,7 @@ describe('Contract utils', () => { }) it('returns the same predicted address for multiple calls to predictedSafeAddress with the same config (owners, threshold & saltNonce)', async () => { - const { accounts, contractNetworks, chainId, provider } = await setupTests() + const { accounts, contractNetworks, chainId } = await setupTests() // 2/2 Safe const [owner1, owner2] = accounts @@ -483,7 +464,7 @@ describe('Contract utils', () => { itif(safeVersionDeployed > '1.0.0')( 'safeDeploymentConfig is an optional parameter', async () => { - const { accounts, contractNetworks, chainId, provider } = await setupTests() + const { accounts, contractNetworks, chainId } = await setupTests() // 1/1 Safe const [owner1] = accounts diff --git a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts index 56c8abb7f..e4f5721fd 100644 --- a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts @@ -1,47 +1,24 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { deployments } from 'hardhat' -import { safeVersionDeployed } from '@safe-global/testing-kit' -import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit/index' -import { getContractNetworks } from './utils/setupContractNetworks' -import { itif } from './utils/helpers' -import { getSafeWithOwners, getMultiSendCallOnly } from './utils/setupContracts' +import { + safeVersionDeployed, + setupTests, + itif, + getSafeWithOwners, + getMultiSendCallOnly +} from '@safe-global/testing-kit' +import Safe from '@safe-global/protocol-kit/index' import { getEip1193Provider } from './utils/setupProvider' -import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) const AMOUNT_TO_TRANSFER = '500000000000000000' // 0.5 ETH describe('wrapSafeTransactionIntoDeploymentBatch', () => { - const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { - await deployments.fixture() - const accounts = await getAccounts() - const chainId = BigInt(await getChainId()) - const contractNetworks = await getContractNetworks(chainId) - - const predictedSafe: PredictedSafeProps = { - safeAccountConfig: { - owners: [accounts[0].address], - threshold: 1 - }, - safeDeploymentConfig: { - safeVersion: safeVersionDeployed - } - } - const provider = getEip1193Provider() - - return { - accounts, - contractNetworks, - predictedSafe, - chainId, - provider - } - }) + const provider = getEip1193Provider() it('should throw an error if the Safe is already deployed', async () => { - const { accounts, contractNetworks, provider } = await setupTests() + const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) @@ -71,7 +48,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { itif(safeVersionDeployed == '1.4.1')( 'should return a batch transaction with the Safe deployment Transaction and the Safe Transaction', async () => { - const { accounts, contractNetworks, predictedSafe, provider } = await setupTests() + const { accounts, contractNetworks, predictedSafe } = await setupTests() const [, account2] = accounts const safeSdk = await Safe.init({ @@ -105,7 +82,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { itif(safeVersionDeployed == '1.3.0')( 'should return a batch transaction with the Safe deployment Transaction and the Safe Transaction', async () => { - const { accounts, contractNetworks, predictedSafe, provider } = await setupTests() + const { accounts, contractNetworks, predictedSafe } = await setupTests() const [, account2] = accounts const safeSdk = await Safe.init({ @@ -139,7 +116,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { itif(safeVersionDeployed >= '1.3.0')( 'should include the custom salt nonce in the Safe deployment data', async () => { - const { accounts, contractNetworks, predictedSafe, provider } = await setupTests() + const { accounts, contractNetworks, predictedSafe } = await setupTests() const [, account2] = accounts const safeSdk = await Safe.init({ diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index 5d144bab6..3d610d620 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -36,6 +36,8 @@ ], "homepage": "https://github.com/safe-global/safe-core-sdk#readme", "devDependencies": { + "@types/semver": "^7.5.8", + "@types/mocha": "^10.0.6", "@gnosis.pm/safe-contracts-v1.3.0": "npm:@gnosis.pm/safe-contracts@1.3.0", "@nomicfoundation/hardhat-viem": "^2.0.2", "@openzeppelin/contracts": "^2.5.1", @@ -46,6 +48,9 @@ "hardhat-deploy": "^0.12.4", "tsconfig-paths": "^4.2.0" }, + "dependencies": { + "semver": "^7.6.2" + }, "bin": { "testing-kit": "./dist/bin/testing-kit.js" }, diff --git a/packages/testing-kit/src/hardhat/deploy/deploy-contracts.ts b/packages/testing-kit/src/hardhat/deploy/deploy-contracts.ts index 46547106f..cce7a44ec 100644 --- a/packages/testing-kit/src/hardhat/deploy/deploy-contracts.ts +++ b/packages/testing-kit/src/hardhat/deploy/deploy-contracts.ts @@ -101,7 +101,6 @@ export const safeWebAuthnSharedSignerDeployed = safeWebAuthnSharedSignerContracts[safeVersionDeployed] const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment): Promise => { - //@ts-expect-error - Property 'deployments' does not exist on type 'HardhatRuntimeEnvironment' const { deployments, getNamedAccounts } = hre const { deployer } = await getNamedAccounts() diff --git a/packages/testing-kit/src/index.ts b/packages/testing-kit/src/index.ts index aee0f3194..acdd1a0ed 100644 --- a/packages/testing-kit/src/index.ts +++ b/packages/testing-kit/src/index.ts @@ -1 +1,7 @@ export * from './hardhat/deploy/deploy-contracts' +export * from './utils/helpers' +export * from './utils/setupContracts' +export * from './utils/setupContractNetworks' +export * from './utils/setupTestNetwork' +export * from './utils/setupTests' +export * from './utils/transactions' diff --git a/packages/protocol-kit/tests/e2e/utils/helpers.ts b/packages/testing-kit/src/utils/helpers.ts similarity index 100% rename from packages/protocol-kit/tests/e2e/utils/helpers.ts rename to packages/testing-kit/src/utils/helpers.ts diff --git a/packages/testing-kit/src/utils/setupContractNetworks.ts b/packages/testing-kit/src/utils/setupContractNetworks.ts new file mode 100644 index 000000000..8521b172a --- /dev/null +++ b/packages/testing-kit/src/utils/setupContractNetworks.ts @@ -0,0 +1,90 @@ +import { Abi } from 'viem' +import { + getCompatibilityFallbackHandler, + getCreateCall, + getFactory, + getMultiSend, + getMultiSendCallOnly, + getSafeSingleton, + getSafeWebAuthnSharedSigner, + getSafeWebAuthnSignerFactory, + getSignMessageLib, + getSimulateTxAccessor +} from './setupContracts' + +export type ContractNetworkConfig = { + /** safeSingletonAddress - Address of the Safe Singleton contract deployed on a specific network */ + safeSingletonAddress: string + /** safeSingletonAbi - Abi of the Safe Singleton contract deployed on a specific network */ + safeSingletonAbi?: Abi + /** safeProxyFactoryAddress - Address of the SafeProxyFactory contract deployed on a specific network */ + safeProxyFactoryAddress: string + /** safeProxyFactoryAbi - Abi of the SafeProxyFactory contract deployed on a specific network */ + safeProxyFactoryAbi?: Abi + /** multiSendAddress - Address of the MultiSend contract deployed on a specific network */ + multiSendAddress: string + /** multiSendAbi - Abi of the MultiSend contract deployed on a specific network */ + multiSendAbi?: Abi + /** multiSendCallOnlyAddress - Address of the MultiSendCallOnly contract deployed on a specific network */ + multiSendCallOnlyAddress: string + /** multiSendCallOnlyAbi - Abi of the MultiSendCallOnly contract deployed on a specific network */ + multiSendCallOnlyAbi?: Abi + /** fallbackHandlerAddress - Address of the Fallback Handler contract deployed on a specific network */ + fallbackHandlerAddress: string + /** fallbackHandlerAbi - Abi of the Fallback Handler contract deployed on a specific network */ + fallbackHandlerAbi?: Abi + /** signMessageLibAddress - Address of the SignMessageLib contract deployed on a specific network */ + signMessageLibAddress: string + /** signMessageLibAbi - Abi of the SignMessageLib contract deployed on a specific network */ + signMessageLibAbi?: Abi + /** createCallAddress - Address of the CreateCall contract deployed on a specific network */ + createCallAddress: string + /** createCallAbi - Abi of the CreateCall contract deployed on a specific network */ + createCallAbi?: Abi + /** simulateTxAccessorAddress - Address of the SimulateTxAccessor contract deployed on a specific network */ + simulateTxAccessorAddress: string + /** simulateTxAccessorAbi - Abi of the SimulateTxAccessor contract deployed on a specific network */ + simulateTxAccessorAbi?: Abi + /** safeWebAuthnSignerFactoryAddress - Address of the SafeWebAuthnSignerFactory contract deployed on a specific network */ + safeWebAuthnSignerFactoryAddress: string + /** safeWebAuthnSignerFactoryAbi - Abi of the SafeWebAuthnSignerFactory contract deployed on a specific network */ + safeWebAuthnSignerFactoryAbi?: Abi + /** safeWebAuthnSharedSignerAddress - Address of the SafeWebAuthnSharedSigner contract deployed on a specific network */ + safeWebAuthnSharedSignerAddress: string + /** safeWebAuthnSharedSignerAbi - Abi of the SafeWebAuthnSharedSigner contract deployed on a specific network */ + safeWebAuthnSharedSignerAbi?: Abi +} + +export type ContractNetworksConfig = { + /** id - Network id */ + [id: string]: ContractNetworkConfig +} + +export async function getContractNetworks(chainId: bigint): Promise { + return { + [chainId.toString()]: { + safeSingletonAddress: await (await getSafeSingleton()).contract.address, + safeSingletonAbi: (await getSafeSingleton()).abi, + safeProxyFactoryAddress: await (await getFactory()).contract.address, + safeProxyFactoryAbi: (await getFactory()).abi, + multiSendAddress: await (await getMultiSend()).contract.address, + multiSendAbi: (await getMultiSend()).abi, + multiSendCallOnlyAddress: await (await getMultiSendCallOnly()).contract.address, + multiSendCallOnlyAbi: (await getMultiSendCallOnly()).abi, + fallbackHandlerAddress: await (await getCompatibilityFallbackHandler()).contract.address, + fallbackHandlerAbi: (await getCompatibilityFallbackHandler()).abi, + signMessageLibAddress: await (await getSignMessageLib()).contract.address, + signMessageLibAbi: (await getSignMessageLib()).abi, + createCallAddress: await (await getCreateCall()).contract.address, + createCallAbi: (await getCreateCall()).abi, + simulateTxAccessorAddress: await (await getSimulateTxAccessor()).contract.address, + simulateTxAccessorAbi: (await getSimulateTxAccessor()).abi, + safeWebAuthnSignerFactoryAddress: await ( + await getSafeWebAuthnSignerFactory() + ).contract.address, + safeWebAuthnSignerFactoryAbi: (await getSafeWebAuthnSignerFactory()).abi, + safeWebAuthnSharedSignerAddress: await (await getSafeWebAuthnSharedSigner()).contract.address, + safeWebAuthnSharedSignerAbi: (await getSafeWebAuthnSharedSigner()).abi + } + } +} diff --git a/packages/protocol-kit/tests/e2e/utils/setupContracts.ts b/packages/testing-kit/src/utils/setupContracts.ts similarity index 89% rename from packages/protocol-kit/tests/e2e/utils/setupContracts.ts rename to packages/testing-kit/src/utils/setupContracts.ts index 990407e80..c7d7af580 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupContracts.ts +++ b/packages/testing-kit/src/utils/setupContracts.ts @@ -1,5 +1,4 @@ -import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' -import { GetContractReturnType, Abi, WalletClient } from 'viem' +import { GetContractReturnType, Abi, WalletClient, Address, zeroAddress } from 'viem' import { compatibilityFallbackHandlerDeployed, createCallDeployed, @@ -12,17 +11,18 @@ import { safeWebAuthnSignerFactoryDeployed, signMessageLibDeployed, simulateTxAccessorDeployed -} from '@safe-global/testing-kit' +} from '../hardhat/deploy/deploy-contracts' import { deployments, viem } from 'hardhat' import semverSatisfies from 'semver/functions/satisfies' import { getDeployer, waitTransactionReceipt } from './transactions' +const ZERO_ADDRESS: Address = zeroAddress export const getSafeSingleton = async (): Promise<{ contract: GetContractReturnType abi: Abi }> => { const safeDeployment = await deployments.get(safeDeployed.name) - const contract = await viem.getContractAt(safeDeployed.name, safeDeployment.address) + const contract = await viem.getContractAt(safeDeployed.name, safeDeployment.address as Address) return { contract, abi: safeDeployment.abi @@ -35,7 +35,7 @@ export const getFactory = async (): Promise<{ }> => { const factoryDeployment = await deployments.get(proxyFactoryDeployed.name) const factoryAddress = factoryDeployment.address - const contract = await viem.getContractAt(proxyFactoryDeployed.name, factoryAddress, { + const contract = await viem.getContractAt(proxyFactoryDeployed.name, factoryAddress as Address, { client: { wallet: await getDeployer() } }) return { @@ -103,7 +103,7 @@ export const getCompatibilityFallbackHandler = async (): Promise<{ const contract = await viem.getContractAt( compatibilityFallbackHandlerDeployed.name, - compatibilityFallbackHandlerDeploymentAddress + compatibilityFallbackHandlerDeploymentAddress as Address ) return { contract, @@ -117,7 +117,7 @@ export const getMultiSend = async (): Promise<{ }> => { const multiSendDeployment = await deployments.get(multiSendDeployed.name) const multiSendAddress = multiSendDeployment.address - const contract = await viem.getContractAt(multiSendDeployed.name, multiSendAddress) + const contract = await viem.getContractAt(multiSendDeployed.name, multiSendAddress as Address) return { contract, abi: multiSendDeployment.abi @@ -130,7 +130,10 @@ export const getMultiSendCallOnly = async (): Promise<{ }> => { const multiSendCallOnlyDeployment = await deployments.get(multiSendCallOnlyDeployed.name) const multiSendAddress = multiSendCallOnlyDeployment.address - const contract = await viem.getContractAt(multiSendCallOnlyDeployed.name, multiSendAddress) + const contract = await viem.getContractAt( + multiSendCallOnlyDeployed.name, + multiSendAddress as Address + ) return { contract, abi: multiSendCallOnlyDeployment.abi @@ -143,7 +146,10 @@ export const getSignMessageLib = async (): Promise<{ }> => { const signMessageLibDeployment = await deployments.get(signMessageLibDeployed.name) const signMessageLibAddress = signMessageLibDeployment.address - const contract = await viem.getContractAt(signMessageLibDeployed.name, signMessageLibAddress) + const contract = await viem.getContractAt( + signMessageLibDeployed.name, + signMessageLibAddress as Address + ) return { contract, abi: signMessageLibDeployment.abi @@ -156,7 +162,7 @@ export const getCreateCall = async (): Promise<{ }> => { const createCallDeployment = await deployments.get(createCallDeployed.name) const createCallAddress = createCallDeployment.address - const contract = await viem.getContractAt(createCallDeployed.name, createCallAddress) + const contract = await viem.getContractAt(createCallDeployed.name, createCallAddress as Address) return { contract, abi: createCallDeployment.abi @@ -171,7 +177,7 @@ export const getSimulateTxAccessor = async (): Promise<{ const simulateTxAccessorAddress = simulateTxAccessorDeployment.address const contract = await viem.getContractAt( simulateTxAccessorDeployed.name, - simulateTxAccessorAddress + simulateTxAccessorAddress as Address ) return { contract, @@ -189,7 +195,7 @@ export const getSafeWebAuthnSignerFactory = async (): Promise<{ const safeWebAuthnSignerFactoryAddress = safeWebAuthnSignerFactoryDeployment.address const contract = await viem.getContractAt( proxyFactoryDeployed.name, - safeWebAuthnSignerFactoryAddress, + safeWebAuthnSignerFactoryAddress as Address, { client: { wallet: await getDeployer() } } @@ -211,7 +217,7 @@ export const getSafeWebAuthnSharedSigner = async (): Promise<{ return { contract: await viem.getContractAt( safeWebAuthnSharedSignerDeployed.name, - safeWebAuthnSharedSignerDeployment.address + safeWebAuthnSharedSignerDeployment.address as Address ), abi: safeWebAuthnSharedSignerDeployment.abi } @@ -220,37 +226,37 @@ export const getSafeWebAuthnSharedSigner = async (): Promise<{ export const getWebAuthnContract = async (): Promise> => { const webAuthnContractDeployment = await deployments.get('WebAuthnContract') const dailyLimitModuleAddress = webAuthnContractDeployment.address - return await viem.getContractAt('WebAuthnContract', dailyLimitModuleAddress) + return await viem.getContractAt('WebAuthnContract', dailyLimitModuleAddress as Address) } export const getDailyLimitModule = async (): Promise> => { const dailyLimitModuleDeployment = await deployments.get('DailyLimitModule') const dailyLimitModuleAddress = dailyLimitModuleDeployment.address - return await viem.getContractAt('DailyLimitModule', dailyLimitModuleAddress) + return await viem.getContractAt('DailyLimitModule', dailyLimitModuleAddress as Address) } export const getSocialRecoveryModule = async (): Promise> => { const socialRecoveryModuleDeployment = await deployments.get('SocialRecoveryModule') const socialRecoveryModuleAddress = socialRecoveryModuleDeployment.address - return await viem.getContractAt('SocialRecoveryModule', socialRecoveryModuleAddress) + return await viem.getContractAt('SocialRecoveryModule', socialRecoveryModuleAddress as Address) } export const getStateChannelModule = async (): Promise> => { const stateChannelModuleDeployment = await deployments.get('StateChannelModule') const stateChannelModuleAddress = stateChannelModuleDeployment.address - return await viem.getContractAt('StateChannelModule', stateChannelModuleAddress) + return await viem.getContractAt('StateChannelModule', stateChannelModuleAddress as Address) } export const getWhiteListModule = async (): Promise> => { const whiteListModuleDeployment = await deployments.get('WhitelistModule') const whiteListModuleAddress = whiteListModuleDeployment.address - return await viem.getContractAt('WhitelistModule', whiteListModuleAddress) + return await viem.getContractAt('WhitelistModule', whiteListModuleAddress as Address) } export const getERC20Mintable = async (): Promise> => { const eRC20MintableDeployment = await deployments.get('ERC20Mintable') const eRC20MintableAddress = eRC20MintableDeployment.address - return await viem.getContractAt('ERC20Mintable', eRC20MintableAddress, { + return await viem.getContractAt('ERC20Mintable', eRC20MintableAddress as Address, { client: { wallet: await getDeployer() } }) } @@ -261,7 +267,7 @@ export const getDebugTransactionGuard = async (): Promise> => { @@ -270,5 +276,5 @@ export const getDefaultCallbackHandler = async (): Promise address: string } diff --git a/packages/testing-kit/src/utils/setupTests.ts b/packages/testing-kit/src/utils/setupTests.ts new file mode 100644 index 000000000..f301cd7d8 --- /dev/null +++ b/packages/testing-kit/src/utils/setupTests.ts @@ -0,0 +1,80 @@ +import { deployments } from 'hardhat' +import { GetContractReturnType, Abi, WalletClient } from 'viem' + +import { Account, getAccounts } from './setupTestNetwork' +import { ContractNetworksConfig, getContractNetworks } from './setupContractNetworks' +import { getSafeWithOwners } from './setupContracts' +import { safeVersionDeployed } from '../hardhat/deploy/deploy-contracts' +import { SafeVersion } from '@safe-global/safe-core-sdk-types' + +type SetupTestsOptions = { + safeConfig?: { + numberOfOwners: number + threshold?: number + } + predictedSafeConfig?: { + numberOfOwners: number + threshold?: number + } +} + +type SetupTestsReturnType = { + safe: GetContractReturnType + accounts: Account[] + contractNetworks: ContractNetworksConfig + chainId: bigint + predictedSafe: PredictedSafeProps +} + +type SafeAccountConfig = { + owners: string[] + threshold: number +} + +type SafeDeploymentConfig = { + safeVersion?: SafeVersion +} + +type PredictedSafeProps = { + safeAccountConfig: SafeAccountConfig + safeDeploymentConfig?: SafeDeploymentConfig +} + +export const setupTests: (options?: SetupTestsOptions) => Promise = + deployments.createFixture(async ({ deployments, getChainId }, options?: SetupTestsOptions) => { + const { safeConfig, predictedSafeConfig } = options || {} + + await deployments.fixture() + const accounts = await getAccounts() + const chainId = BigInt(await getChainId()) + const contractNetworks = await getContractNetworks(chainId) + const safe = await getSafeWithOwners( + safeConfig + ? [...accounts.slice(0, safeConfig?.numberOfOwners).map((account) => account.address)] + : [accounts[0].address], + safeConfig?.threshold || 1 + ) + const predictedSafe = { + safeAccountConfig: { + owners: predictedSafeConfig + ? [ + ...accounts + .slice(0, predictedSafeConfig?.numberOfOwners) + .map((account) => account.address) + ] + : [accounts[0].address], + threshold: predictedSafeConfig?.threshold || 1 + }, + safeDeploymentConfig: { + safeVersion: safeVersionDeployed + } + } + + return { + safe, + accounts, + contractNetworks, + chainId, + predictedSafe + } + }) diff --git a/packages/testing-kit/src/utils/transactions.ts b/packages/testing-kit/src/utils/transactions.ts new file mode 100644 index 000000000..6e28285c0 --- /dev/null +++ b/packages/testing-kit/src/utils/transactions.ts @@ -0,0 +1,11 @@ +import { Hex, WalletClient, Transport, Chain, Account, Address } from 'viem' +import hre, { viem } from 'hardhat' + +export async function waitTransactionReceipt(hash: Hex) { + return (await viem.getPublicClient()).waitForTransactionReceipt({ hash }) +} + +export async function getDeployer(): Promise> { + const { deployer } = await hre.getNamedAccounts() + return viem.getWalletClient(deployer as Address) +} diff --git a/packages/testing-kit/tsconfig.build.json b/packages/testing-kit/tsconfig.build.json index b40c79f0d..5e4563c61 100644 --- a/packages/testing-kit/tsconfig.build.json +++ b/packages/testing-kit/tsconfig.build.json @@ -4,5 +4,6 @@ "composite": true, "outDir": "dist" }, - "include": ["bin/**/*", "hardhat/**/*", "./src/**/*"] + "include": ["bin/**/*", "src/**/*"], + "files": ["./hardhat.config.ts"] } diff --git a/packages/testing-kit/tsconfig.json b/packages/testing-kit/tsconfig.json index 476c559ca..c35515726 100644 --- a/packages/testing-kit/tsconfig.json +++ b/packages/testing-kit/tsconfig.json @@ -4,5 +4,5 @@ "composite": true, "outDir": "dist" }, - "include": ["./hardhat.config.ts", "bin/**/*", "./src/**/*"] + "include": ["bin/**/*", "src/**/*"] } From cb31d7a86331ade5dc37efb334045af928309b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 29 Aug 2024 19:35:36 +0200 Subject: [PATCH 38/55] fix --- packages/protocol-kit/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index fbbe499e8..f79a04058 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -30,7 +30,7 @@ "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", "coverage": "nyc report --reporter=lcov", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", From 20f7e1e08ae2326866399c8f6523b36f4c30c004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 12 Sep 2024 12:50:35 +0200 Subject: [PATCH 39/55] Trigger CI From 5f5bbcebbbc29ab182c2e1c9082449ecb3ad159b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 12 Sep 2024 14:19:41 +0200 Subject: [PATCH 40/55] .env file no longer needed in api-kit --- packages/api-kit/.env.example | 1 - 1 file changed, 1 deletion(-) delete mode 100644 packages/api-kit/.env.example diff --git a/packages/api-kit/.env.example b/packages/api-kit/.env.example deleted file mode 100644 index 01c40bd16..000000000 --- a/packages/api-kit/.env.example +++ /dev/null @@ -1 +0,0 @@ -INFURA_KEY= \ No newline at end of file From 0b03f2fe92053bb3cc52700d9e6aee995550b8b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 12 Sep 2024 14:33:40 +0200 Subject: [PATCH 41/55] yargs no longer necessary --- packages/protocol-kit/package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index f79a04058..a90852ffc 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -56,7 +56,6 @@ "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.6", "@types/semver": "^7.5.8", - "@types/yargs": "^17.0.32", "chai": "^4.3.10", "chai-as-promised": "^7.1.1", "dotenv": "^16.4.5", @@ -65,7 +64,6 @@ "nyc": "^15.1.0", "tsconfig-paths": "^4.2.0", "web3": "^4.7.0", - "yargs": "^17.7.2", "@safe-global/testing-kit": "^1.0.0" }, "dependencies": { From 9f939371f32d745a6cb98c068e6993895a318f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 13 Sep 2024 09:41:25 +0200 Subject: [PATCH 42/55] Update package.json Co-authored-by: Daniel <25051234+dasanra@users.noreply.github.com> --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index a1002b181..af9c677b4 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,7 @@ "ts-jest": "^29.1.5", "ts-node": "^10.9.2", "tsc-alias": "^1.8.8", - "typescript": "^5.3.3", - "@safe-global/testing-kit": "^1.0.0" + "typescript": "^5.3.3" }, "lint-staged": { "./packages/**/*.{js,jsx,ts,tsx}": [ From 7bf8f0dc4bae0bca17c73f7127c9d9eeffe7ff80 Mon Sep 17 00:00:00 2001 From: Daniel <25051234+dasanra@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:52:48 +0200 Subject: [PATCH 43/55] chore: remove unnecessary await --- .../src/hardhat/deploy/deploy-contracts.ts | 1 - .../src/utils/setupContractNetworks.ts | 22 +++++++++---------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/packages/testing-kit/src/hardhat/deploy/deploy-contracts.ts b/packages/testing-kit/src/hardhat/deploy/deploy-contracts.ts index cce7a44ec..93171e1c5 100644 --- a/packages/testing-kit/src/hardhat/deploy/deploy-contracts.ts +++ b/packages/testing-kit/src/hardhat/deploy/deploy-contracts.ts @@ -102,7 +102,6 @@ export const safeWebAuthnSharedSignerDeployed = const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment): Promise => { const { deployments, getNamedAccounts } = hre - const { deployer } = await getNamedAccounts() const { deploy } = deployments diff --git a/packages/testing-kit/src/utils/setupContractNetworks.ts b/packages/testing-kit/src/utils/setupContractNetworks.ts index 8521b172a..454c0b429 100644 --- a/packages/testing-kit/src/utils/setupContractNetworks.ts +++ b/packages/testing-kit/src/utils/setupContractNetworks.ts @@ -63,27 +63,25 @@ export type ContractNetworksConfig = { export async function getContractNetworks(chainId: bigint): Promise { return { [chainId.toString()]: { - safeSingletonAddress: await (await getSafeSingleton()).contract.address, + safeSingletonAddress: (await getSafeSingleton()).contract.address, safeSingletonAbi: (await getSafeSingleton()).abi, - safeProxyFactoryAddress: await (await getFactory()).contract.address, + safeProxyFactoryAddress: (await getFactory()).contract.address, safeProxyFactoryAbi: (await getFactory()).abi, - multiSendAddress: await (await getMultiSend()).contract.address, + multiSendAddress: (await getMultiSend()).contract.address, multiSendAbi: (await getMultiSend()).abi, - multiSendCallOnlyAddress: await (await getMultiSendCallOnly()).contract.address, + multiSendCallOnlyAddress: (await getMultiSendCallOnly()).contract.address, multiSendCallOnlyAbi: (await getMultiSendCallOnly()).abi, - fallbackHandlerAddress: await (await getCompatibilityFallbackHandler()).contract.address, + fallbackHandlerAddress: (await getCompatibilityFallbackHandler()).contract.address, fallbackHandlerAbi: (await getCompatibilityFallbackHandler()).abi, - signMessageLibAddress: await (await getSignMessageLib()).contract.address, + signMessageLibAddress: (await getSignMessageLib()).contract.address, signMessageLibAbi: (await getSignMessageLib()).abi, - createCallAddress: await (await getCreateCall()).contract.address, + createCallAddress: (await getCreateCall()).contract.address, createCallAbi: (await getCreateCall()).abi, - simulateTxAccessorAddress: await (await getSimulateTxAccessor()).contract.address, + simulateTxAccessorAddress: (await getSimulateTxAccessor()).contract.address, simulateTxAccessorAbi: (await getSimulateTxAccessor()).abi, - safeWebAuthnSignerFactoryAddress: await ( - await getSafeWebAuthnSignerFactory() - ).contract.address, + safeWebAuthnSignerFactoryAddress: (await getSafeWebAuthnSignerFactory()).contract.address, safeWebAuthnSignerFactoryAbi: (await getSafeWebAuthnSignerFactory()).abi, - safeWebAuthnSharedSignerAddress: await (await getSafeWebAuthnSharedSigner()).contract.address, + safeWebAuthnSharedSignerAddress: (await getSafeWebAuthnSharedSigner()).contract.address, safeWebAuthnSharedSignerAbi: (await getSafeWebAuthnSharedSigner()).abi } } From 0fd6ee0486fd1d417332ec112fdea48c72d05231 Mon Sep 17 00:00:00 2001 From: Daniel <25051234+dasanra@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:43:37 +0200 Subject: [PATCH 44/55] chore: remove unused function --- packages/protocol-kit/tests/e2e/utils/transactions.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/utils/transactions.ts b/packages/protocol-kit/tests/e2e/utils/transactions.ts index 82e4b8b9a..4a87a1b6d 100644 --- a/packages/protocol-kit/tests/e2e/utils/transactions.ts +++ b/packages/protocol-kit/tests/e2e/utils/transactions.ts @@ -1,6 +1,5 @@ import { GetTransactionReceiptReturnType } from 'viem' import { TransactionResult } from '@safe-global/safe-core-sdk-types' -import SafeProvider from '@safe-global/protocol-kit/SafeProvider' export async function waitSafeTxReceipt( txResult: TransactionResult @@ -10,10 +9,3 @@ export async function waitSafeTxReceipt( return receipt } - -export async function getTransaction( - safeProvider: SafeProvider, - transactionHash: string -): Promise { - return safeProvider.getTransaction(transactionHash) -} From f4526ccace076f6fd687adf5f633163adf5a84e5 Mon Sep 17 00:00:00 2001 From: Daniel <25051234+dasanra@users.noreply.github.com> Date: Fri, 13 Sep 2024 17:06:59 +0200 Subject: [PATCH 45/55] chore: cleanup unnecessary code --- packages/protocol-kit/src/contracts/utils.ts | 1 - .../protocol-kit/tests/e2e/eip1271.test.ts | 19 ++++++++----------- packages/testing-kit/package.json | 1 - yarn.lock | 4 ++-- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/packages/protocol-kit/src/contracts/utils.ts b/packages/protocol-kit/src/contracts/utils.ts index 3c45b40db..f28b912f8 100644 --- a/packages/protocol-kit/src/contracts/utils.ts +++ b/packages/protocol-kit/src/contracts/utils.ts @@ -86,7 +86,6 @@ export function encodeCreateProxyWithNonce( initializer: string, salt?: string ) { - console.log(`safeSingletonAddress`, safeSingletonAddress) return safeProxyFactoryContract.encode('createProxyWithNonce', [ safeSingletonAddress, asHex(initializer), diff --git a/packages/protocol-kit/tests/e2e/eip1271.test.ts b/packages/protocol-kit/tests/e2e/eip1271.test.ts index 8447a6900..0aa4881d2 100644 --- a/packages/protocol-kit/tests/e2e/eip1271.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271.test.ts @@ -24,7 +24,7 @@ import { asHash } from '@safe-global/protocol-kit/utils/types' chai.use(chaiAsPromised) -export const calculateSafeMessageHash = ( +const calculateSafeMessageHash = ( safeAddress: string, message: string, chainId: number @@ -105,9 +105,8 @@ describe('The EIP1271 implementation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should validate on-chain messages (Approved hashes)', async () => { - const { contractNetworks, safeSdk1, safeSdk2 } = await setupTests() + const { chainId, contractNetworks, safeSdk1, safeSdk2 } = await setupTests() - const chainId = await safeSdk1.getChainId() const safeVersion = await safeSdk1.getContractVersion() const customContract = contractNetworks[chainId.toString()] @@ -209,7 +208,7 @@ describe('The EIP1271 implementation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should validate Smart contracts as signers (threshold = 1)', async () => { - const { safeSdk1, safeSdk2, safeSdk3, safeAddress, signerSafeAddress } = + const { chainId, safeSdk1, safeSdk2, safeSdk3, safeAddress, signerSafeAddress } = await setupTests() // Hash the message const messageHash = hashSafeMessage(MESSAGE) @@ -228,7 +227,7 @@ describe('The EIP1271 implementation', () => { safeAddress, messageHash, await safeSdk1.getContractVersion(), - await safeSdk1.getChainId() + chainId ) const safeSignerMessageHash = await safeSdk3.getSafeMessageHash( shouldPreimageMessage ? messageHashData : messageHash @@ -252,7 +251,7 @@ describe('The EIP1271 implementation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should allow to validate transaction hashes using smart contracts as signers', async () => { - const { accounts, safeSdk1, safeSdk3, safeAddress, signerSafeAddress } = + const { accounts, chainId, safeSdk1, safeSdk3, safeAddress, signerSafeAddress } = await setupTests() const [account1] = accounts @@ -276,7 +275,7 @@ describe('The EIP1271 implementation', () => { safeAddress, txHash, await safeSdk1.getContractVersion(), - await safeSdk1.getChainId() + chainId ) const signerSafeMessageHash = await safeSdk3.getSafeMessageHash( @@ -296,9 +295,8 @@ describe('The EIP1271 implementation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should generate the correct safeMessageHash', async () => { - const { safeAddress, safeSdk1 } = await setupTests() + const { chainId, safeAddress, safeSdk1 } = await setupTests() - const chainId = await safeSdk1.getChainId() const messageHash = hashSafeMessage(MESSAGE) const safeMessageHash = await safeSdk1.getSafeMessageHash(messageHash) @@ -406,9 +404,8 @@ describe('The EIP1271 implementation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should generate the correct safeMessageHash', async () => { - const { safeAddress, safeSdk1 } = await setupTests() + const { chainId, safeAddress, safeSdk1 } = await setupTests() - const chainId = await safeSdk1.getChainId() const messageHash = hashSafeMessage(MESSAGE) const safeMessageHash = await safeSdk1.getSafeMessageHash(messageHash) diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index 3d610d620..313d05447 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -37,7 +37,6 @@ "homepage": "https://github.com/safe-global/safe-core-sdk#readme", "devDependencies": { "@types/semver": "^7.5.8", - "@types/mocha": "^10.0.6", "@gnosis.pm/safe-contracts-v1.3.0": "npm:@gnosis.pm/safe-contracts@1.3.0", "@nomicfoundation/hardhat-viem": "^2.0.2", "@openzeppelin/contracts": "^2.5.1", diff --git a/yarn.lock b/yarn.lock index c44b824ad..8706e5ade 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2431,7 +2431,7 @@ resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz" integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== -"@types/yargs@^17.0.32", "@types/yargs@^17.0.8": +"@types/yargs@^17.0.8": version "17.0.32" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.32.tgz#030774723a2f7faafebf645f4e5a48371dca6229" integrity sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog== @@ -10806,7 +10806,7 @@ yargs@16.2.0, yargs@^16.2.0: y18n "^5.0.5" yargs-parser "^20.2.2" -yargs@17.7.2, yargs@^17.3.1, yargs@^17.6.2, yargs@^17.7.2: +yargs@17.7.2, yargs@^17.3.1, yargs@^17.6.2: version "17.7.2" resolved "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== From 3fb35d69afda6d646def5a8f21712171910b603b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 16 Sep 2024 09:53:07 +0200 Subject: [PATCH 46/55] remove unnecessary script --- packages/testing-kit/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index 313d05447..06dfe5bae 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -16,8 +16,7 @@ "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", "unbuild": "rimraf dist artifacts deployments cache .nyc_output *.tsbuildinfo", - "build": "yarn unbuild && hardhat compile && NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && yarn copy-files && chmod +x dist/bin/testing-kit.js", - "copy-files": "cpx 'artifacts/**/*' dist/artifacts", + "build": "yarn unbuild && hardhat compile && NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && chmod +x dist/bin/testing-kit.js", "deploy": "hardhat deploy", "compile": "hardhat compile", "test": "hardhat test" From 2e71f3b74c1968c7c12c73fc3f6aef0317a38a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 16 Sep 2024 10:04:36 +0200 Subject: [PATCH 47/55] improve test typing --- .../protocol-kit/tests/e2e/contractManager.test.ts | 14 ++++++++++---- .../tests/e2e/offChainSignatures.test.ts | 7 +++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/contractManager.test.ts b/packages/protocol-kit/tests/e2e/contractManager.test.ts index 56d853071..2d9e315f4 100644 --- a/packages/protocol-kit/tests/e2e/contractManager.test.ts +++ b/packages/protocol-kit/tests/e2e/contractManager.test.ts @@ -8,7 +8,9 @@ import { getMultiSendCallOnly, getSafeSingleton, getSignMessageLib, - getSimulateTxAccessor + getSimulateTxAccessor, + getSafeWebAuthnSharedSigner, + getSafeWebAuthnSignerFactory } from '@safe-global/testing-kit' import Safe, { ContractNetworksConfig, PredictedSafeProps } from '@safe-global/protocol-kit/index' import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' @@ -70,7 +72,7 @@ describe('Safe contracts manager', () => { it('should fail if MultiSend contract is specified in contractNetworks but not deployed', async () => { const { safe, chainId } = await setupTests() - const customContractNetworks = { + const customContractNetworks: ContractNetworksConfig = { [chainId.toString()]: { safeSingletonAddress: ZERO_ADDRESS, safeSingletonAbi: (await getSafeSingleton()).abi, @@ -87,7 +89,11 @@ describe('Safe contracts manager', () => { createCallAddress: ZERO_ADDRESS, createCallAbi: (await getCreateCall()).abi, simulateTxAccessorAddress: ZERO_ADDRESS, - simulateTxAccessorAbi: (await getSimulateTxAccessor()).abi + simulateTxAccessorAbi: (await getSimulateTxAccessor()).abi, + safeWebAuthnSignerFactoryAddress: ZERO_ADDRESS, + safeWebAuthnSignerFactoryAbi: (await getSafeWebAuthnSignerFactory()).abi, + safeWebAuthnSharedSignerAddress: ZERO_ADDRESS, + safeWebAuthnSharedSignerAbi: (await getSafeWebAuthnSharedSigner()).abi } } @@ -97,7 +103,7 @@ describe('Safe contracts manager', () => { Safe.init({ provider, safeAddress, - contractNetworks: customContractNetworks as ContractNetworksConfig + contractNetworks: customContractNetworks }) ) .to.be.rejectedWith('MultiSend contract is not deployed on the current network') diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 539784ea1..1972afee7 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -276,7 +276,7 @@ describe('Off-chain signatures', () => { safeAddress, contractNetworks }) - const safeServiceTransaction = { + const safeServiceTransaction: SafeMultisigTransactionResponse = { safe: '', to: account2.address, value: '500000000000000000', // 0.5 ETH @@ -303,6 +303,7 @@ describe('Off-chain signatures', () => { origin: '', dataDecoded: '', confirmationsRequired: 2, + proposer: '0x', confirmations: [ { owner: '0x1111111111111111111111111111111111111111', @@ -324,9 +325,7 @@ describe('Off-chain signatures', () => { trusted: true, signatures: '0x111111222222' } - const signedTx = await safeSdk.signTransaction( - safeServiceTransaction as SafeMultisigTransactionResponse - ) + const signedTx = await safeSdk.signTransaction(safeServiceTransaction) chai.expect(safeServiceTransaction.confirmations?.length).to.be.eq(2) chai.expect(signedTx.signatures.size).to.be.eq(3) const signerAddress = account1.address From 1b5cb6200e94a9f41502449f30cfd2c68dc20129 Mon Sep 17 00:00:00 2001 From: Daniel <25051234+dasanra@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:00:54 +0200 Subject: [PATCH 48/55] chore: remove unused dependency --- packages/testing-kit/package.json | 1 - yarn.lock | 978 +----------------------------- 2 files changed, 22 insertions(+), 957 deletions(-) diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index 06dfe5bae..3f6184352 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -41,7 +41,6 @@ "@openzeppelin/contracts": "^2.5.1", "@safe-global/safe-contracts-v1.4.1": "npm:@safe-global/safe-contracts@1.4.1", "@safe-global/safe-core-sdk-types": "^5.0.3", - "cpx": "^1.5.0", "hardhat": "^2.19.3", "hardhat-deploy": "^0.12.4", "tsconfig-paths": "^4.2.0" diff --git a/yarn.lock b/yarn.lock index 8706e5ade..955c6bf18 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2757,14 +2757,6 @@ ansi-styles@^6.0.0, ansi-styles@^6.1.0, ansi-styles@^6.2.1: resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== -anymatch@^1.3.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" - integrity sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA== - dependencies: - micromatch "^2.1.5" - normalize-path "^2.0.0" - anymatch@^3.0.3, anymatch@~3.1.2: version "3.1.3" resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz" @@ -2815,28 +2807,6 @@ argparse@^2.0.1: resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -arr-diff@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" - integrity sha512-dtXTVMkh6VkEEA7OhXnN1Ecb8aAGFdZ1LFxtOCoqj4qkyOJMt7+qs6Ahdy6p/NQCPYsRSXXivhSB/J5E9jmYKA== - dependencies: - arr-flatten "^1.0.1" - -arr-diff@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" - integrity sha512-YVIQ82gZPGBebQV/a8dar4AitzCQs0jjXwMPZllpXMaGjXPYVUawSxQrRsjhjupyVxEvbHgUmIhKVlND+j02kA== - -arr-flatten@^1.0.1, arr-flatten@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" - integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== - -arr-union@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" - integrity sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q== - array-differ@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz" @@ -2852,16 +2822,6 @@ array-union@^2.1.0: resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== -array-unique@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" - integrity sha512-G2n5bG5fSUCpnsXz4+8FUkYsGPkNfLn9YvS66U5qbTIXI2Ynnlo4Bi42bWv+omKUCqz+ejzfClwne0alJWJPhg== - -array-unique@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" - integrity sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ== - arrify@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" @@ -2877,16 +2837,6 @@ assertion-error@^1.1.0: resolved "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== -assign-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" - integrity sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw== - -async-each@^1.0.0: - version "1.0.6" - resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.6.tgz#52f1d9403818c179b7561e11a5d1b77eb2160e77" - integrity sha512-c646jH1avxr+aVpndVMeAfYw7wAa6idufrlN3LPA4PmKS0QEGp6PIC9nwz0WQkkvBGAMEki3pFdtxaF39J9vvg== - async-mutex@^0.4.0: version "0.4.0" resolved "https://registry.npmjs.org/async-mutex/-/async-mutex-0.4.0.tgz" @@ -2904,11 +2854,6 @@ asynckit@^0.4.0: resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== -atob@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" - integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== - available-typed-arrays@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz" @@ -2998,14 +2943,6 @@ babel-preset-jest@^29.6.3: babel-plugin-jest-hoist "^29.6.3" babel-preset-current-node-syntax "^1.0.0" -babel-runtime@^6.9.2: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" - integrity sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g== - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.11.0" - balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" @@ -3028,19 +2965,6 @@ base64url@^3.0.1: resolved "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz" integrity sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A== -base@^0.11.1: - version "0.11.2" - resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" - integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== - dependencies: - cache-base "^1.0.1" - class-utils "^0.3.5" - component-emitter "^1.2.1" - define-property "^1.0.0" - isobject "^3.0.1" - mixin-deep "^1.2.0" - pascalcase "^0.1.1" - bech32@1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz" @@ -3056,23 +2980,11 @@ bignumber.js@^9.1.2: resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== -binary-extensions@^1.0.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" - integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== - binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== -bindings@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" - integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== - dependencies: - file-uri-to-path "1.0.0" - bl@^4.0.3, bl@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz" @@ -3131,31 +3043,6 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" -braces@^1.8.2: - version "1.8.5" - resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" - integrity sha512-xU7bpz2ytJl1bH9cgIurjpg/n8Gohy9GTw81heDYLJQ4RU60dlyJsa+atVF2pI0yMMvKxI9HkKwjePCj5XI1hw== - dependencies: - expand-range "^1.8.1" - preserve "^0.2.0" - repeat-element "^1.1.2" - -braces@^2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" - integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== - dependencies: - arr-flatten "^1.1.0" - array-unique "^0.3.2" - extend-shallow "^2.0.1" - fill-range "^4.0.0" - isobject "^3.0.1" - repeat-element "^1.1.2" - snapdragon "^0.8.1" - snapdragon-node "^2.0.1" - split-string "^3.0.2" - to-regex "^3.0.1" - braces@^3.0.3, braces@~3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" @@ -3310,21 +3197,6 @@ cacache@^18.0.0: tar "^6.1.11" unique-filename "^3.0.0" -cache-base@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" - integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== - dependencies: - collection-visit "^1.0.0" - component-emitter "^1.2.1" - get-value "^2.0.6" - has-value "^1.0.0" - isobject "^3.0.1" - set-value "^2.0.0" - to-object-path "^0.3.0" - union-value "^1.0.0" - unset-value "^1.0.0" - caching-transform@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz" @@ -3462,22 +3334,6 @@ chokidar@3.5.3, chokidar@^3.4.0, chokidar@^3.5.2, chokidar@^3.5.3: optionalDependencies: fsevents "~2.3.2" -chokidar@^1.6.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" - integrity sha512-mk8fAWcRUOxY7btlLtitj3A45jOwSAxH4tOFOoEGbVsl6cL6pPMWUy7dwZ/canfj3QEdP6FHSnf/l1c6/WkzVg== - dependencies: - anymatch "^1.3.0" - async-each "^1.0.0" - glob-parent "^2.0.0" - inherits "^2.0.1" - is-binary-path "^1.0.0" - is-glob "^2.0.0" - path-is-absolute "^1.0.0" - readdirp "^2.0.0" - optionalDependencies: - fsevents "^1.0.0" - chownr@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz" @@ -3506,16 +3362,6 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz" integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== -class-utils@^0.3.5: - version "0.3.6" - resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" - integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== - dependencies: - arr-union "^3.1.0" - define-property "^0.2.5" - isobject "^3.0.0" - static-extend "^0.1.1" - clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz" @@ -3619,14 +3465,6 @@ collect-v8-coverage@^1.0.0: resolved "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz" integrity sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg== -collection-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" - integrity sha512-lNkKvzEeMBBjUGHZ+q6z9pSJla0KWAQPvtzhEV9+iGyQYG+pBpl7xKDhxoNSOZH2hhv0v5k0y2yAM4o4SjoSkw== - dependencies: - map-visit "^1.0.0" - object-visit "^1.0.0" - color-convert@^1.9.0: version "1.9.3" resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" @@ -3709,11 +3547,6 @@ compare-func@^2.0.0: array-ify "^1.0.0" dot-prop "^5.1.0" -component-emitter@^1.2.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.1.tgz#ef1d5796f7d93f135ee6fb684340b26403c97d17" - integrity sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ== - concat-map@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" @@ -3822,16 +3655,6 @@ cookie@^0.4.1: resolved "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz" integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== -copy-descriptor@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" - integrity sha512-XgZ0pFcakEUlbwQEVNg3+QAis1FyTL3Qel9FYy8pSkQqoG3PNoT0bOCQtOXcOkur21r2Eq2kI+IE+gsmAEVlYw== - -core-js@^2.4.0: - version "2.6.12" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" - integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== - core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz" @@ -3847,23 +3670,6 @@ cosmiconfig@^8.2.0: parse-json "^5.2.0" path-type "^4.0.0" -cpx@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/cpx/-/cpx-1.5.0.tgz#185be018511d87270dedccc293171e37655ab88f" - integrity sha512-jHTjZhsbg9xWgsP2vuNW2jnnzBX+p4T+vNI9Lbjzs1n4KhOfa22bQppiFYLsWQKd8TzmL5aSP/Me3yfsCwXbDA== - dependencies: - babel-runtime "^6.9.2" - chokidar "^1.6.0" - duplexer "^0.1.1" - glob "^7.0.5" - glob2base "^0.0.12" - minimatch "^3.0.2" - mkdirp "^0.5.1" - resolve "^1.1.7" - safe-buffer "^5.0.1" - shell-quote "^1.6.1" - subarg "^1.0.0" - crc-32@^1.2.0, crc-32@^1.2.2: version "1.2.2" resolved "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz" @@ -3986,13 +3792,6 @@ debug@4.3.4: dependencies: ms "2.1.2" -debug@^2.2.0, debug@^2.3.3: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - decamelize-keys@^1.1.0: version "1.1.1" resolved "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz" @@ -4016,11 +3815,6 @@ decimal.js@^10.4.2: resolved "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz" integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== -decode-uri-component@^0.2.0: - version "0.2.2" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" - integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== - dedent@0.7.0: version "0.7.0" resolved "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz" @@ -4076,28 +3870,6 @@ define-lazy-prop@^2.0.0: resolved "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz" integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og== -define-property@^0.2.5: - version "0.2.5" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" - integrity sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA== - dependencies: - is-descriptor "^0.1.0" - -define-property@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" - integrity sha512-cZTYKFWspt9jZsMscWo8sc/5lbPC9Q0N5nBLgb+Yd915iL3udB1uFgS3B8YCx66UVHq018DAVFoee7x+gxggeA== - dependencies: - is-descriptor "^1.0.0" - -define-property@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" - integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== - dependencies: - is-descriptor "^1.0.2" - isobject "^3.0.1" - delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" @@ -4670,33 +4442,6 @@ exit@^0.1.2: resolved "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== -expand-brackets@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" - integrity sha512-hxx03P2dJxss6ceIeri9cmYOT4SRs3Zk3afZwWpOsRqLqprhTR8u++SlC+sFGsQr7WGFPdMF7Gjc1njDLDK6UA== - dependencies: - is-posix-bracket "^0.1.0" - -expand-brackets@^2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" - integrity sha512-w/ozOKR9Obk3qoWeY/WDi6MFta9AoMR+zud60mdnbniMcBxRuFJyDt2LdX/14A1UABeqk+Uk+LDfUpvoGKppZA== - dependencies: - debug "^2.3.3" - define-property "^0.2.5" - extend-shallow "^2.0.1" - posix-character-classes "^0.1.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -expand-range@^1.8.1: - version "1.8.2" - resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" - integrity sha512-AFASGfIlnIbkKPQwX1yHaDjFvh/1gyKJODme52V6IORh69uEYgZp0o9C+qsIGNVEiuuhQU0CSSl++Rlegg1qvA== - dependencies: - fill-range "^2.1.0" - expect@^29.0.0, expect@^29.7.0: version "29.7.0" resolved "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz" @@ -4713,21 +4458,6 @@ exponential-backoff@^3.1.1: resolved "https://registry.yarnpkg.com/exponential-backoff/-/exponential-backoff-3.1.1.tgz#64ac7526fe341ab18a39016cd22c787d01e00bf6" integrity sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw== -extend-shallow@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" - integrity sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug== - dependencies: - is-extendable "^0.1.0" - -extend-shallow@^3.0.0, extend-shallow@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" - integrity sha512-BwY5b5Ql4+qZoefgMj2NUmx+tehVTH/Kf4k1ZEtOHNFcm2wSxMRo992l6X3TIgni2eZVTZ85xMOjF31fwZAj6Q== - dependencies: - assign-symbols "^1.0.0" - is-extendable "^1.0.1" - external-editor@^3.0.3: version "3.1.0" resolved "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz" @@ -4737,27 +4467,6 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" -extglob@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" - integrity sha512-1FOj1LOwn42TMrruOHGt18HemVnbwAmAak7krWk+wa93KXxGbK+2jpezm+ytJYDaBX0/SPLZFHKM7m+tKobWGg== - dependencies: - is-extglob "^1.0.0" - -extglob@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" - integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== - dependencies: - array-unique "^0.3.2" - define-property "^1.0.0" - expand-brackets "^2.1.4" - extend-shallow "^2.0.1" - fragment-cache "^0.2.1" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" @@ -4827,11 +4536,6 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" -file-uri-to-path@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" - integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== - filelist@^1.0.1: version "1.0.4" resolved "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz" @@ -4839,32 +4543,6 @@ filelist@^1.0.1: dependencies: minimatch "^5.0.1" -filename-regex@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" - integrity sha512-BTCqyBaWBTsauvnHiE8i562+EdJj+oUpkqWp2R1iCoR8f6oo8STRu3of7WJJ0TqWtxN50a5YFpzYK4Jj9esYfQ== - -fill-range@^2.1.0: - version "2.2.4" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" - integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q== - dependencies: - is-number "^2.1.0" - isobject "^2.0.0" - randomatic "^3.0.0" - repeat-element "^1.1.2" - repeat-string "^1.5.2" - -fill-range@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" - integrity sha512-VcpLTWqWDiTerugjj8e3+esbg+skS3M9e54UuR3iCeIDMXCLTsAH8hTSzDQU/X6/6t3eYkOKoZSef2PlU6U1XQ== - dependencies: - extend-shallow "^2.0.1" - is-number "^3.0.0" - repeat-string "^1.6.1" - to-regex-range "^2.1.0" - fill-range@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" @@ -4881,11 +4559,6 @@ find-cache-dir@^3.2.0: make-dir "^3.0.2" pkg-dir "^4.1.0" -find-index@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4" - integrity sha512-uJ5vWrfBKMcE6y2Z8834dwEZj9mNGxYa3t3I53OwFeuZ8D9oc2E5zcsrkuhX6h4iYrjhiv0T3szQmxlAV9uxDg== - find-up@5.0.0, find-up@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" @@ -4946,18 +4619,6 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" -for-in@^1.0.1, for-in@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" - integrity sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ== - -for-own@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" - integrity sha512-SKmowqGTJoPzLO1T0BBJpkfp3EMacCMOuH40hOUbrbzElVktk4DioXVM99QkLCyKoiuOmyjgcWMpVz2xjE7LZw== - dependencies: - for-in "^1.0.1" - foreground-child@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz" @@ -4993,13 +4654,6 @@ fp-ts@^1.0.0: resolved "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.5.tgz" integrity sha512-wDNqTimnzs8QqpldiId9OavWK2NptormjXnRJTQecNjzwfyp6P/8s/zG8e4h3ja3oqkKaY72UlTjQYt/1yXf9A== -fragment-cache@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" - integrity sha512-GMBAbW9antB8iZRHLoGw0b3HANt57diZYFO/HL1JGIC1MjKrdmhxvrJbupnVvpys0zsz7yBApXdQyfepKly2kA== - dependencies: - map-cache "^0.2.2" - fromentries@^1.2.0: version "1.3.2" resolved "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz" @@ -5063,14 +4717,6 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^1.0.0: - version "1.2.13" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.13.tgz#f325cb0455592428bcf11b383370ef70e3bfcc38" - integrity sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw== - dependencies: - bindings "^1.5.0" - nan "^2.12.1" - fsevents@^2.3.2, fsevents@~2.3.2: version "2.3.2" resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" @@ -5160,11 +4806,6 @@ get-stream@^8.0.1: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-8.0.1.tgz#def9dfd71742cd7754a7761ed43749a27d02eca2" integrity sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA== -get-value@^2.0.3, get-value@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" - integrity sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA== - git-raw-commits@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-3.0.0.tgz#5432f053a9744f67e8db03dbc48add81252cfdeb" @@ -5212,14 +4853,6 @@ gitconfiglocal@^1.0.0: dependencies: ini "^1.3.2" -glob-base@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" - integrity sha512-ab1S1g1EbO7YzauaJLkgLp7DZVAqj9M/dvKlTt8DkXA2tiOIcSMrlVI2J1RZyB5iJVccEscjGn+kpOG9788MHA== - dependencies: - glob-parent "^2.0.0" - is-glob "^2.0.0" - glob-parent@5.1.2, glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" @@ -5227,13 +4860,6 @@ glob-parent@5.1.2, glob-parent@^5.1.2, glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" -glob-parent@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" - integrity sha512-JDYOvfxio/t42HKdxkAYaCiBN7oYiuxykOxKxdaUW5Qn0zaYN3gRQWolrwdnf0shM9/EP0ebuuTmyoXNr1cC5w== - dependencies: - is-glob "^2.0.0" - glob-parent@^6.0.2: version "6.0.2" resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" @@ -5241,13 +4867,6 @@ glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" -glob2base@^0.0.12: - version "0.0.12" - resolved "https://registry.yarnpkg.com/glob2base/-/glob2base-0.0.12.tgz#9d419b3e28f12e83a362164a277055922c9c0d56" - integrity sha512-ZyqlgowMbfj2NPjxaZZ/EtsXlOch28FRXgMd64vqZWk1bT9+wvSRLYD1om9M7QfQru51zJPAT17qXm4/zd+9QA== - dependencies: - find-index "^0.1.1" - glob@7.2.0: version "7.2.0" resolved "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz" @@ -5272,7 +4891,7 @@ glob@^10.2.2, glob@^10.3.10: package-json-from-dist "^1.0.0" path-scurry "^1.11.1" -glob@^7.0.5, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: +glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.2.3" resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -5481,37 +5100,6 @@ has-unicode@2.0.1, has-unicode@^2.0.1: resolved "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz" integrity sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ== -has-value@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" - integrity sha512-gpG936j8/MzaeID5Yif+577c17TxaDmhuyVgSwtnL/q8UUTySg8Mecb+8Cf1otgLoD7DDH75axp86ER7LFsf3Q== - dependencies: - get-value "^2.0.3" - has-values "^0.1.4" - isobject "^2.0.0" - -has-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" - integrity sha512-IBXk4GTsLYdQ7Rvt+GRBrFSVEkmuOUy4re0Xjd9kJSUQpnTrWR4/y9RpfexN9vkAPMFuQoeWKwqzPozRTlasGw== - dependencies: - get-value "^2.0.6" - has-values "^1.0.0" - isobject "^3.0.0" - -has-values@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" - integrity sha512-J8S0cEdWuQbqD9//tlZxiMuMNmxB8PlEwvYwuxsTmR1G5RXUePEX/SJn7aD0GMLieuZYSwNH0cQuJGwnYunXRQ== - -has-values@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" - integrity sha512-ODYZC64uqzmtfGMEAX/FvZiRyWLpAC3vYnNunURUnkGVTS+mI0smVsWaPydRBsE3g+ok7h960jChO8mFcWlHaQ== - dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" - has@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/has/-/has-1.0.3.tgz" @@ -5551,13 +5139,6 @@ hasown@^2.0.0: dependencies: function-bind "^1.1.2" -hasown@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== - dependencies: - function-bind "^1.1.2" - he@1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz" @@ -5829,13 +5410,6 @@ ip-address@^9.0.5: jsbn "1.1.0" sprintf-js "^1.1.3" -is-accessor-descriptor@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.1.tgz#3223b10628354644b86260db29b3e693f5ceedd4" - integrity sha512-YBUanLI8Yoihw923YeFUS5fs0fF2f5TSFTNiYAAzhhDscDa3lEqYuz1pDOEP5KvX94I9ey3vsqjJcLVFVU+3QA== - dependencies: - hasown "^2.0.0" - is-arguments@^1.0.4: version "1.1.1" resolved "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz" @@ -5849,13 +5423,6 @@ is-arrayish@^0.2.1: resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== -is-binary-path@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" - integrity sha512-9fRVlXc0uCxEDj1nQzaWONSpbTfx0FmJfzHF7pwlI8DkWGoHBBea4Pg5Ky0ojwwxQmnSifgbKkI06Qv0Ljgj+Q== - dependencies: - binary-extensions "^1.0.0" - is-binary-path@~2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz" @@ -5863,11 +5430,6 @@ is-binary-path@~2.1.0: dependencies: binary-extensions "^2.0.0" -is-buffer@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== - is-callable@^1.1.3: version "1.2.7" resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz" @@ -5887,70 +5449,11 @@ is-core-module@^2.11.0, is-core-module@^2.5.0, is-core-module@^2.8.1: dependencies: has "^1.0.3" -is-core-module@^2.13.0: - version "2.15.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.1.tgz#a7363a25bee942fefab0de13bf6aa372c82dcc37" - integrity sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ== - dependencies: - hasown "^2.0.2" - -is-data-descriptor@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.1.tgz#2109164426166d32ea38c405c1e0945d9e6a4eeb" - integrity sha512-bc4NlCDiCr28U4aEsQ3Qs2491gVq4V8G7MQyws968ImqjKuYtTJXrl7Vq7jsN7Ly/C3xj5KWFrY7sHNeDkAzXw== - dependencies: - hasown "^2.0.0" - -is-descriptor@^0.1.0: - version "0.1.7" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.7.tgz#2727eb61fd789dcd5bdf0ed4569f551d2fe3be33" - integrity sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg== - dependencies: - is-accessor-descriptor "^1.0.1" - is-data-descriptor "^1.0.1" - -is-descriptor@^1.0.0, is-descriptor@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.3.tgz#92d27cb3cd311c4977a4db47df457234a13cb306" - integrity sha512-JCNNGbwWZEVaSPtS45mdtrneRWJFp07LLmykxeFV5F6oBvNF8vHSfJuJgoT472pSfk+Mf8VnlrspaFBHWM8JAw== - dependencies: - is-accessor-descriptor "^1.0.1" - is-data-descriptor "^1.0.1" - is-docker@^2.0.0, is-docker@^2.1.1: version "2.2.1" resolved "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz" integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== -is-dotfile@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" - integrity sha512-9YclgOGtN/f8zx0Pr4FQYMdibBiTaH3sn52vjYip4ZSf6C4/6RfTEZ+MR4GvKhCxdPh21Bg42/WL55f6KSnKpg== - -is-equal-shallow@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" - integrity sha512-0EygVC5qPvIyb+gSz7zdD5/AAoS6Qrx1e//6N4yv4oNm30kqvdmG66oZFWVlQHUWe5OjP08FuTw2IdT0EOTcYA== - dependencies: - is-primitive "^2.0.0" - -is-extendable@^0.1.0, is-extendable@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" - integrity sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw== - -is-extendable@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" - integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== - dependencies: - is-plain-object "^2.0.4" - -is-extglob@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" - integrity sha512-7Q+VbVafe6x2T+Tu6NcOf6sRklazEPmBoB3IWk3WdGZM2iGUwU/Oe3Wtq5lSEkDTTlpp8yx+5t4pzO/i9Ty1ww== - is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" @@ -5985,13 +5488,6 @@ is-generator-function@^1.0.7: dependencies: has-tostringtag "^1.0.0" -is-glob@^2.0.0, is-glob@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" - integrity sha512-a1dBeB19NXsf/E0+FHqkagizel/LQw2DjSQpvQrj3zT+jYPpaUCryPnrQajXKFLCMuf4I6FhRpaGtw4lPrG6Eg== - dependencies: - is-extglob "^1.0.0" - is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" @@ -6014,25 +5510,6 @@ is-lambda@^1.0.1: resolved "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz" integrity sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ== -is-number@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" - integrity sha512-QUzH43Gfb9+5yckcrSA0VBDwEtDUchrk4F6tfJZQuNzDJbEDB9cZNzSfXGQ1jqmdDY/kl41lUOWM9syA8z8jlg== - dependencies: - kind-of "^3.0.2" - -is-number@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" - integrity sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg== - dependencies: - kind-of "^3.0.2" - -is-number@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" - integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== - is-number@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" @@ -6058,7 +5535,7 @@ is-plain-obj@^2.1.0: resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz" integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== -is-plain-object@^2.0.3, is-plain-object@^2.0.4: +is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz" integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== @@ -6070,21 +5547,11 @@ is-plain-object@^5.0.0: resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz" integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== -is-posix-bracket@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" - integrity sha512-Yu68oeXJ7LeWNmZ3Zov/xg/oDBnBK2RNxwYY1ilNJX+tKKZqgPK+qOn/Gs9jEu66KDY9Netf5XLKNGzas/vPfQ== - is-potential-custom-element-name@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz" integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== -is-primitive@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" - integrity sha512-N3w1tFaRfk3UrPfqeRyD+GYDASU3W5VinKhlORy8EWVf/sIdDL9GAcew85XmktCfH+ngG7SRXEVDoO18WMdB/Q== - is-ssh@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/is-ssh/-/is-ssh-1.4.0.tgz" @@ -6152,16 +5619,16 @@ isarray@0.0.1: resolved "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== -isarray@1.0.0, isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" - integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== - isarray@^2.0.5: version "2.0.5" resolved "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz" integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== + isexe@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" @@ -6172,14 +5639,7 @@ isexe@^3.1.1: resolved "https://registry.yarnpkg.com/isexe/-/isexe-3.1.1.tgz#4a407e2bd78ddfb14bea0c27c6f7072dde775f0d" integrity sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ== -isobject@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" - integrity sha512-+OUdGJlgjOBZDfxnDjYYG6zp487z0JGNQq3cYQYg5f5hKR+syHMsaztzGeml/4kGG55CSpKSpWTY+jYGgsHLgA== - dependencies: - isarray "1.0.0" - -isobject@^3.0.0, isobject@^3.0.1: +isobject@^3.0.1: version "3.0.1" resolved "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== @@ -6829,21 +6289,7 @@ keccak@^3.0.0, keccak@^3.0.2: node-gyp-build "^4.2.0" readable-stream "^3.6.0" -kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" - integrity sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ== - dependencies: - is-buffer "^1.1.5" - -kind-of@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" - integrity sha512-24XsCxmEbRwEDbz/qz3stgin8TTzZ1ESR56OMCN0ujYg+vRutNSiOj9bHH9u85DKgXguraugV5sFuvbD4FW/hw== - dependencies: - is-buffer "^1.1.5" - -kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: +kind-of@^6.0.2, kind-of@^6.0.3: version "6.0.3" resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== @@ -7231,11 +6677,6 @@ makeerror@1.0.12: dependencies: tmpl "1.0.5" -map-cache@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" - integrity sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg== - map-obj@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz" @@ -7246,23 +6687,11 @@ map-obj@^4.0.0: resolved "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz" integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== -map-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" - integrity sha512-4y7uGv8bd2WdM9vpQsiQNo41Ln1NvhvDRuVt0k2JZQ+ezN2uaQes7lZeZ+QQUHOLQAtDaBJ+7wCbi+ab/KFs+w== - dependencies: - object-visit "^1.0.0" - match-all@^1.2.6: version "1.2.6" resolved "https://registry.npmjs.org/match-all/-/match-all-1.2.6.tgz" integrity sha512-0EESkXiTkWzrQQntBu2uzKvLu6vVkUGz40nGPbSZuegcfE5UuSzNjLaIu76zJWuaT/2I3Z/8M06OlUOZLGwLlQ== -math-random@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" - integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A== - md5.js@^1.3.4: version "1.3.5" resolved "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz" @@ -7309,44 +6738,6 @@ micro-ftch@^0.3.1: resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" integrity sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg== -micromatch@^2.1.5: - version "2.3.11" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" - integrity sha512-LnU2XFEk9xxSJ6rfgAry/ty5qwUTyHYOBU0g4R6tIw5ljwgGIBmiKhRWLw5NpMOnrgUNcDJ4WMp8rl3sYVHLNA== - dependencies: - arr-diff "^2.0.0" - array-unique "^0.2.1" - braces "^1.8.2" - expand-brackets "^0.1.4" - extglob "^0.3.1" - filename-regex "^2.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.1" - kind-of "^3.0.2" - normalize-path "^2.0.1" - object.omit "^2.0.0" - parse-glob "^3.0.4" - regex-cache "^0.4.2" - -micromatch@^3.1.10: - version "3.1.10" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" - integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.2" - micromatch@^4.0.4, micromatch@~4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5" @@ -7413,7 +6804,7 @@ minimatch@9.0.3: dependencies: brace-expansion "^2.0.1" -minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -7450,7 +6841,7 @@ minimist-options@4.1.0: is-plain-obj "^1.1.0" kind-of "^6.0.3" -minimist@^1.1.0, minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: +minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: version "1.2.8" resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== @@ -7539,21 +6930,6 @@ minizlib@^2.1.1, minizlib@^2.1.2: minipass "^3.0.0" yallist "^4.0.0" -mixin-deep@^1.2.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" - integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== - dependencies: - for-in "^1.0.2" - is-extendable "^1.0.1" - -mkdirp@^0.5.1: - version "0.5.6" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" - integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== - dependencies: - minimist "^1.2.6" - mkdirp@^1.0.3: version "1.0.4" resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" @@ -7598,11 +6974,6 @@ modify-values@^1.0.1: resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== - ms@2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" @@ -7648,33 +7019,11 @@ mylas@^2.1.9: resolved "https://registry.npmjs.org/mylas/-/mylas-2.1.13.tgz" integrity sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg== -nan@^2.12.1: - version "2.20.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.20.0.tgz#08c5ea813dd54ed16e5bd6505bf42af4f7838ca3" - integrity sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw== - nanoid@3.3.3: version "3.3.3" resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz" integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== -nanomatch@^1.2.9: - version "1.2.13" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" - integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - define-property "^2.0.2" - extend-shallow "^3.0.2" - fragment-cache "^0.2.1" - is-windows "^1.0.2" - kind-of "^6.0.2" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" @@ -7815,13 +7164,6 @@ normalize-package-data@^6.0.0: semver "^7.3.5" validate-npm-package-license "^3.0.4" -normalize-path@^2.0.0, normalize-path@^2.0.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" - integrity sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w== - dependencies: - remove-trailing-separator "^1.0.1" - normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" @@ -8054,15 +7396,6 @@ nyc@^15.1.0: test-exclude "^6.0.0" yargs "^15.0.2" -object-copy@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" - integrity sha512-79LYn6VAb63zgtmAteVOWo9Vdj71ZVBy3Pbse+VqxDpEP83XuujMrGqHIwAXJ5I/aM0zU7dIyIAhifVTPrNItQ== - dependencies: - copy-descriptor "^0.1.0" - define-property "^0.2.5" - kind-of "^3.0.3" - object-inspect@^1.9.0: version "1.12.3" resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz" @@ -8073,28 +7406,6 @@ object-keys@^1.1.1: resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== -object-visit@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" - integrity sha512-GBaMwwAVK9qbQN3Scdo0OyvgPW7l3lnaVMj84uTOZlswkX0KpF6fyDBJhtTthf7pymztoN36/KEr1DyhF96zEA== - dependencies: - isobject "^3.0.0" - -object.omit@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" - integrity sha512-UiAM5mhmIuKLsOvrL+B0U2d1hXHF3bFYWIuH1LMpuV2EJEHG1Ntz06PgLEHjm6VFd87NpH8rastvPoyv6UW2fA== - dependencies: - for-own "^0.1.4" - is-extendable "^0.1.1" - -object.pick@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" - integrity sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ== - dependencies: - isobject "^3.0.1" - obliterator@^2.0.0: version "2.0.4" resolved "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz" @@ -8347,16 +7658,6 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" -parse-glob@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" - integrity sha512-FC5TeK0AwXzq3tUBFtH74naWkPQCEWs4K+xMxWZBlKDWu0bVHXGZa+KKqxKidd7xwhdZ19ZNuF2uO1M/r196HA== - dependencies: - glob-base "^0.3.0" - is-dotfile "^1.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.0" - parse-json@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz" @@ -8396,11 +7697,6 @@ parse5@^7.0.0, parse5@^7.1.1: dependencies: entities "^4.4.0" -pascalcase@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" - integrity sha512-XHXfu/yOQRy9vYOtUDVMN60OEJjW013GoObG1o+xwQTpB9eYJX/BjXMsdW13ZDPruFhYYn0AG22w0xgQMwl3Nw== - path-exists@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz" @@ -8533,11 +7829,6 @@ pony-cause@^2.1.10: resolved "https://registry.yarnpkg.com/pony-cause/-/pony-cause-2.1.10.tgz#828457ad6f13be401a075dbf14107a9057945174" integrity sha512-3IKLNXclQgkU++2fSi93sQ6BznFuxSLB11HdvZQ6JW/spahf/P1pAHBQEahr20rs0htZW0UDkM1HmA+nZkXKsw== -posix-character-classes@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" - integrity sha512-xTgYBc3fuo7Yt7JbiuFxSYGToMoz8fLoE6TC9Wx1P/u+LfeThMOAqmuyECnlBaaJb+u1m9hHiXUEtwW4OzfUJg== - prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" @@ -8548,11 +7839,6 @@ prelude-ls@~1.1.2: resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz" integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== -preserve@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" - integrity sha512-s/46sYeylUfHNjI+sA/78FAHlmIuKqI9wNnzEOGehAlUUYeObv5C2mOinXBjyUyWmJ2SfcS2/ydApH4hTF4WXQ== - prettier-linter-helpers@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz" @@ -8689,15 +7975,6 @@ quick-lru@^4.0.1: resolved "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== -randomatic@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" - integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw== - dependencies: - is-number "^4.0.0" - kind-of "^6.0.0" - math-random "^1.0.1" - randombytes@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz" @@ -8811,19 +8088,6 @@ read@^2.0.0: dependencies: mute-stream "~1.0.0" -readable-stream@^2.0.2, readable-stream@~2.3.6: - version "2.3.8" - resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz" - integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - readable-stream@^3.0.0, readable-stream@^3.0.2, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: version "3.6.2" resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz" @@ -8844,14 +8108,18 @@ readable-stream@^4.4.2: process "^0.11.10" string_decoder "^1.3.0" -readdirp@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" - integrity sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ== +readable-stream@~2.3.6: + version "2.3.8" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz" + integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== dependencies: - graceful-fs "^4.1.11" - micromatch "^3.1.10" - readable-stream "^2.0.2" + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" readdirp@~3.6.0: version "3.6.0" @@ -8868,31 +8136,11 @@ redent@^3.0.0: indent-string "^4.0.0" strip-indent "^3.0.0" -regenerator-runtime@^0.11.0: - version "0.11.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" - integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== - regenerator-runtime@^0.14.0: version "0.14.0" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== -regex-cache@^0.4.2: - version "0.4.4" - resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" - integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== - dependencies: - is-equal-shallow "^0.1.3" - -regex-not@^1.0.0, regex-not@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" - integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== - dependencies: - extend-shallow "^3.0.2" - safe-regex "^1.1.0" - release-zalgo@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz" @@ -8900,21 +8148,6 @@ release-zalgo@^1.0.0: dependencies: es6-error "^4.0.1" -remove-trailing-separator@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" - integrity sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw== - -repeat-element@^1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.4.tgz#be681520847ab58c7568ac75fbfad28ed42d39e9" - integrity sha512-LFiNfRcSu7KK3evMyYOuCzv3L10TW7yC1G2/+StMjK8Y6Vqd2MG7r/Qjw4ghtuCOjFvlnms/iMmLqpvW/ES/WQ== - -repeat-string@^1.5.2, repeat-string@^1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - integrity sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w== - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" @@ -8947,11 +8180,6 @@ resolve-from@^4.0.0: resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== -resolve-url@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" - integrity sha512-ZuF55hVUQaaczgOIwqWzkEcEidmlD/xl44x1UZnhOXcYuFN2S6+rcxpG+C1N3So0wvNI3DmJICUFfu2SxhBmvg== - resolve.exports@^2.0.0: version "2.0.2" resolved "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz" @@ -8964,15 +8192,6 @@ resolve@1.17.0: dependencies: path-parse "^1.0.6" -resolve@^1.1.7: - version "1.22.8" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" - integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== - dependencies: - is-core-module "^2.13.0" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - resolve@^1.10.0, resolve@^1.20.0: version "1.22.2" resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz" @@ -8998,11 +8217,6 @@ restore-cursor@^4.0.0: onetime "^5.1.0" signal-exit "^3.0.2" -ret@~0.1.10: - version "0.1.15" - resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" - integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== - retry@^0.12.0: version "0.12.0" resolved "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz" @@ -9076,13 +8290,6 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-regex@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" - integrity sha512-aJXcif4xnaNUzvUuC5gcb46oTS7zvg4jpMTnuqtrEPlR3vFr4pxtdTwaF1Qs3Enjn9HK+ZlwQui+a7z0SywIzg== - dependencies: - ret "~0.1.10" - "safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" @@ -9153,16 +8360,6 @@ set-function-length@^1.1.1: gopd "^1.0.1" has-property-descriptors "^1.0.0" -set-value@^2.0.0, set-value@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" - integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.3" - split-string "^3.0.1" - setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz" @@ -9200,11 +8397,6 @@ shebang-regex@^3.0.0: resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -shell-quote@^1.6.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.1.tgz#6dbf4db75515ad5bac63b4f1894c3a154c766680" - integrity sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA== - side-channel@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz" @@ -9295,36 +8487,6 @@ smart-buffer@^4.2.0: resolved "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz" integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== -snapdragon-node@^2.0.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" - integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== - dependencies: - define-property "^1.0.0" - isobject "^3.0.0" - snapdragon-util "^3.0.1" - -snapdragon-util@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" - integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== - dependencies: - kind-of "^3.2.0" - -snapdragon@^0.8.1: - version "0.8.2" - resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" - integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== - dependencies: - base "^0.11.1" - debug "^2.2.0" - define-property "^0.2.5" - extend-shallow "^2.0.1" - map-cache "^0.2.2" - source-map "^0.5.6" - source-map-resolve "^0.5.0" - use "^3.1.0" - socket.io-client@^4.7.2: version "4.7.2" resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-4.7.2.tgz#f2f13f68058bd4e40f94f2a1541f275157ff2c08" @@ -9389,17 +8551,6 @@ sort-keys@^2.0.0: dependencies: is-plain-obj "^1.0.0" -source-map-resolve@^0.5.0: - version "0.5.3" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" - integrity sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw== - dependencies: - atob "^2.1.2" - decode-uri-component "^0.2.0" - resolve-url "^0.2.1" - source-map-url "^0.4.0" - urix "^0.1.0" - source-map-support@0.5.13: version "0.5.13" resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz" @@ -9416,16 +8567,6 @@ source-map-support@^0.5.13: buffer-from "^1.0.0" source-map "^0.6.0" -source-map-url@^0.4.0: - version "0.4.1" - resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56" - integrity sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw== - -source-map@^0.5.6: - version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== - source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" @@ -9469,13 +8610,6 @@ spdx-license-ids@^3.0.0: resolved "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz" integrity sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w== -split-string@^3.0.1, split-string@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" - integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== - dependencies: - extend-shallow "^3.0.0" - split2@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" @@ -9528,14 +8662,6 @@ stacktrace-parser@^0.1.10: dependencies: type-fest "^0.7.1" -static-extend@^0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" - integrity sha512-72E9+uLc27Mt718pMHt9VMNiAL4LMsmDbBva8mxWUCkT07fSzEGMYUCk0XWY6lp0j6RBAG4cJ3mWuZv2OE3s0g== - dependencies: - define-property "^0.2.5" - object-copy "^0.1.0" - statuses@2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz" @@ -9673,13 +8799,6 @@ strong-log-transformer@2.1.0, strong-log-transformer@^2.1.0: minimist "^1.2.0" through "^2.3.4" -subarg@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" - integrity sha512-RIrIdRY0X1xojthNcVtgT9sjpOGagEUKpZdgBUi054OEPFo282yg+zE+t1Rj3+RqKq2xStL7uUHhY+AjbC4BXg== - dependencies: - minimist "^1.1.0" - superstruct@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.3.tgz#de626a5b49c6641ff4d37da3c7598e7a87697046" @@ -9808,21 +8927,6 @@ to-fast-properties@^2.0.0: resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz" integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== -to-object-path@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" - integrity sha512-9mWHdnGRuh3onocaHzukyvCZhzvr6tiflAy/JRFXcJX0TjgfWA9pk9t8CMbzmBE4Jfw58pXbkngtBtqYxzNEyg== - dependencies: - kind-of "^3.0.2" - -to-regex-range@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" - integrity sha512-ZZWNfCjUokXXDGXFpZehJIkZqq91BcULFq/Pi7M5i4JnxXdhMKAK682z8bCW3o8Hj1wuuzoKcW3DfVzaP6VuNg== - dependencies: - is-number "^3.0.0" - repeat-string "^1.6.1" - to-regex-range@^5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" @@ -9830,16 +8934,6 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -to-regex@^3.0.1, to-regex@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" - integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== - dependencies: - define-property "^2.0.2" - extend-shallow "^3.0.2" - regex-not "^1.0.2" - safe-regex "^1.1.0" - toidentifier@1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz" @@ -10067,16 +9161,6 @@ undici@^5.14.0: dependencies: "@fastify/busboy" "^2.0.0" -union-value@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" - integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== - dependencies: - arr-union "^3.1.0" - get-value "^2.0.6" - is-extendable "^0.1.1" - set-value "^2.0.1" - unique-filename@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/unique-filename/-/unique-filename-3.0.0.tgz" @@ -10121,14 +9205,6 @@ unpipe@1.0.0: resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== -unset-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" - integrity sha512-PcA2tsuGSF9cnySLHTLSh2qrQiJ70mn+r+Glzxv2TWZblxsxCC52BDlZoPCsz7STd9pN7EZetkWZBAvk4cgZdQ== - dependencies: - has-value "^0.3.1" - isobject "^3.0.0" - upath@2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/upath/-/upath-2.0.1.tgz" @@ -10149,11 +9225,6 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" -urix@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" - integrity sha512-Am1ousAhSLBeB9cG/7k7r2R0zj50uDRlZHPGbazid5s9rlF1F/QKYObEKSIunSjIOkJZqwRRLpvewjEkM7pSqg== - url-parse@^1.5.3: version "1.5.10" resolved "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz" @@ -10162,11 +9233,6 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" -use@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" - integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== - util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" From f8ef7285c2266b6fda799d5ebbf254f222ae2f67 Mon Sep 17 00:00:00 2001 From: Daniel <25051234+dasanra@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:35:39 +0200 Subject: [PATCH 49/55] chore: set alpha release --- packages/api-kit/package.json | 4 ++-- packages/protocol-kit/package.json | 4 ++-- packages/testing-kit/package.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/api-kit/package.json b/packages/api-kit/package.json index d4dccc4a2..e1b750fc4 100644 --- a/packages/api-kit/package.json +++ b/packages/api-kit/package.json @@ -41,6 +41,7 @@ "devDependencies": { "@nomicfoundation/hardhat-viem": "^2.0.2", "@safe-global/relay-kit": "^3.1.0", + "@safe-global/testing-kit": "^0.0.1-alpha.0", "@types/chai": "^4.3.16", "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.6", @@ -55,8 +56,7 @@ "sinon": "^14.0.2", "sinon-chai": "^3.7.0", "tsconfig-paths": "^4.2.0", - "web3": "^4.7.0", - "@safe-global/testing-kit": "^1.0.0" + "web3": "^4.7.0" }, "dependencies": { "@safe-global/protocol-kit": "^4.1.0", diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index a90852ffc..b15697eb8 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -52,6 +52,7 @@ "homepage": "https://github.com/safe-global/safe-core-sdk#readme", "devDependencies": { "@safe-global/safe-passkey": "0.2.0-alpha.1", + "@safe-global/testing-kit": "^0.0.1-alpha.0", "@types/chai": "^4.3.16", "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.6", @@ -63,8 +64,7 @@ "mocha": "^10.2.0", "nyc": "^15.1.0", "tsconfig-paths": "^4.2.0", - "web3": "^4.7.0", - "@safe-global/testing-kit": "^1.0.0" + "web3": "^4.7.0" }, "dependencies": { "@noble/hashes": "^1.3.3", diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index 3f6184352..e5ab3902f 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -1,6 +1,6 @@ { "name": "@safe-global/testing-kit", - "version": "1.0.0", + "version": "0.0.1-alpha.0", "description": "Helper package providing testing utilities", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -16,7 +16,7 @@ "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", "unbuild": "rimraf dist artifacts deployments cache .nyc_output *.tsbuildinfo", - "build": "yarn unbuild && hardhat compile && NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && chmod +x dist/bin/testing-kit.js", + "build": "yarn unbuild && hardhat compile && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && chmod +x dist/bin/testing-kit.js", "deploy": "hardhat deploy", "compile": "hardhat compile", "test": "hardhat test" From 0afa35876813c36f6ba7b41ba9d9c868212971cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 16 Sep 2024 12:44:11 +0200 Subject: [PATCH 50/55] Use .bin testing-kit --- .github/workflows/api-kit-e2e-test.yml | 6 ----- .github/workflows/protocol-kit-e2e-test.yml | 4 --- .github/workflows/sdk-test.yml | 6 ----- packages/api-kit/package.json | 12 ++++----- packages/protocol-kit/package.json | 30 ++++++++++----------- 5 files changed, 21 insertions(+), 37 deletions(-) diff --git a/.github/workflows/api-kit-e2e-test.yml b/.github/workflows/api-kit-e2e-test.yml index 4c005b276..b1e12d337 100644 --- a/.github/workflows/api-kit-e2e-test.yml +++ b/.github/workflows/api-kit-e2e-test.yml @@ -24,12 +24,6 @@ jobs: - name: Build run: yarn build - - name: Make testing-kit.js executable - run: chmod +x packages/testing-kit/dist/bin/testing-kit.js - - - name: Add script directory to PATH - run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH - - name: Test run: | cd packages/api-kit diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 8bd3b7490..0378f8127 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -24,10 +24,6 @@ jobs: - run: | yarn install --frozen-lockfile yarn build - - name: Make testing-kit.js executable - run: chmod +x packages/testing-kit/dist/bin/testing-kit.js - - name: Add script directory to PATH - run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit diff --git a/.github/workflows/sdk-test.yml b/.github/workflows/sdk-test.yml index 236c7d65a..6ad7e67c1 100644 --- a/.github/workflows/sdk-test.yml +++ b/.github/workflows/sdk-test.yml @@ -25,12 +25,6 @@ jobs: - name: Build run: yarn build - - name: Make testing-kit.js executable - run: chmod +x packages/testing-kit/dist/bin/testing-kit.js - - - name: Add script directory to PATH - run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH - - name: Test env: PRIVATE_KEY: ${{ secrets.TESTING_PRIVATE_KEY }} diff --git a/packages/api-kit/package.json b/packages/api-kit/package.json index e1b750fc4..48633a418 100644 --- a/packages/api-kit/package.json +++ b/packages/api-kit/package.json @@ -12,13 +12,13 @@ "API" ], "scripts": { - "test:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", - "test:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", - "test:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", + "test:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit test 'tests/endpoint/*.test.*'", + "test:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit test 'tests/endpoint/*.test.*'", + "test:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit test 'tests/endpoint/*.test.*'", "test": "yarn test:viem", - "test:ci:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", - "test:ci:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", - "test:ci:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", + "test:ci:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit test 'tests/e2e/*.test.*'", + "test:ci:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit test 'tests/e2e/*.test.*'", + "test:ci:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit test 'tests/e2e/*.test.*'", "test:ci": "yarn test:ci:viem", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index b15697eb8..c4257cd34 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -16,21 +16,21 @@ "update-safe-deployments": "ts-node scripts/safe-deployments/updateLocalNetworks.ts", "check-short-name-integrity": "ts-node scripts/safe-deployments/checkShortNameIntegrity.ts", "test": "mocha -r ts-node/register -r tsconfig-paths/register tests/unit/**/*.ts", - "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", "coverage": "nyc report --reporter=lcov", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", From c25c985da529073e3fb56af3eb705c2415dd001d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 16 Sep 2024 12:58:16 +0200 Subject: [PATCH 51/55] Test --- .github/workflows/protocol-kit-e2e-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 0378f8127..37561072f 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -22,8 +22,9 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: | - yarn install --frozen-lockfile + yarn install --force --verbose --frozen-lockfile yarn build + ls ./packages/protocol-kit/node_modules/.bin - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit From 1352603f81cf7b10d78ca5f390efc7e289a0033b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 16 Sep 2024 13:05:15 +0200 Subject: [PATCH 52/55] Test --- .github/workflows/protocol-kit-e2e-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 37561072f..2ca4d418c 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -22,9 +22,10 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: | - yarn install --force --verbose --frozen-lockfile + yarn install --frozen-lockfile yarn build ls ./packages/protocol-kit/node_modules/.bin + ls ./node_modules/.bin - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit From b0a1b7cda252500a38afdc539454544c22f70a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 16 Sep 2024 14:18:09 +0200 Subject: [PATCH 53/55] Revert testing-kit bin tests --- .github/workflows/api-kit-e2e-test.yml | 6 +++++ .github/workflows/protocol-kit-e2e-test.yml | 6 +++-- .github/workflows/sdk-test.yml | 6 +++++ packages/api-kit/package.json | 12 ++++----- packages/protocol-kit/package.json | 30 ++++++++++----------- 5 files changed, 37 insertions(+), 23 deletions(-) diff --git a/.github/workflows/api-kit-e2e-test.yml b/.github/workflows/api-kit-e2e-test.yml index b1e12d337..4c005b276 100644 --- a/.github/workflows/api-kit-e2e-test.yml +++ b/.github/workflows/api-kit-e2e-test.yml @@ -24,6 +24,12 @@ jobs: - name: Build run: yarn build + - name: Make testing-kit.js executable + run: chmod +x packages/testing-kit/dist/bin/testing-kit.js + + - name: Add script directory to PATH + run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH + - name: Test run: | cd packages/api-kit diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 2ca4d418c..8bd3b7490 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -24,8 +24,10 @@ jobs: - run: | yarn install --frozen-lockfile yarn build - ls ./packages/protocol-kit/node_modules/.bin - ls ./node_modules/.bin + - name: Make testing-kit.js executable + run: chmod +x packages/testing-kit/dist/bin/testing-kit.js + - name: Add script directory to PATH + run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit diff --git a/.github/workflows/sdk-test.yml b/.github/workflows/sdk-test.yml index 6ad7e67c1..236c7d65a 100644 --- a/.github/workflows/sdk-test.yml +++ b/.github/workflows/sdk-test.yml @@ -25,6 +25,12 @@ jobs: - name: Build run: yarn build + - name: Make testing-kit.js executable + run: chmod +x packages/testing-kit/dist/bin/testing-kit.js + + - name: Add script directory to PATH + run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH + - name: Test env: PRIVATE_KEY: ${{ secrets.TESTING_PRIVATE_KEY }} diff --git a/packages/api-kit/package.json b/packages/api-kit/package.json index 48633a418..e1b750fc4 100644 --- a/packages/api-kit/package.json +++ b/packages/api-kit/package.json @@ -12,13 +12,13 @@ "API" ], "scripts": { - "test:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit test 'tests/endpoint/*.test.*'", - "test:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit test 'tests/endpoint/*.test.*'", - "test:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit test 'tests/endpoint/*.test.*'", + "test:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", + "test:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", + "test:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", "test": "yarn test:viem", - "test:ci:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit test 'tests/e2e/*.test.*'", - "test:ci:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit test 'tests/e2e/*.test.*'", - "test:ci:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit test 'tests/e2e/*.test.*'", + "test:ci:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", + "test:ci:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", + "test:ci:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", "test:ci": "yarn test:ci:viem", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index c4257cd34..b15697eb8 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -16,21 +16,21 @@ "update-safe-deployments": "ts-node scripts/safe-deployments/updateLocalNetworks.ts", "check-short-name-integrity": "ts-node scripts/safe-deployments/checkShortNameIntegrity.ts", "test": "mocha -r ts-node/register -r tsconfig-paths/register tests/unit/**/*.ts", - "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", "coverage": "nyc report --reporter=lcov", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", From d6fb7f1d69b40115c0861b037cb502d0686a72c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 16 Sep 2024 14:23:27 +0200 Subject: [PATCH 54/55] yarn lock --- yarn.lock | 293 ++++-------------------------------------------------- 1 file changed, 17 insertions(+), 276 deletions(-) diff --git a/yarn.lock b/yarn.lock index aeca0a2df..730a80387 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1230,34 +1230,6 @@ "@nomicfoundation/edr-linux-x64-musl" "0.5.0" "@nomicfoundation/edr-win32-x64-msvc" "0.5.0" -"@nomicfoundation/ethereumjs-block@5.0.4": - version "5.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-block/-/ethereumjs-block-5.0.4.tgz#ff2acb98a86b9290e35e315a6abfb9aebb9cf39e" - integrity sha512-AcyacJ9eX/uPEvqsPiB+WO1ymE+kyH48qGGiGV+YTojdtas8itUTW5dehDSOXEEItWGbbzEJ4PRqnQZlWaPvDw== - dependencies: - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-trie" "6.0.4" - "@nomicfoundation/ethereumjs-tx" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - ethereum-cryptography "0.1.3" - -"@nomicfoundation/ethereumjs-blockchain@7.0.4": - version "7.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-blockchain/-/ethereumjs-blockchain-7.0.4.tgz#b77511b389290b186c8d999e70f4b15c27ef44ea" - integrity sha512-jYsd/kwzbmpnxx86tXsYV8wZ5xGvFL+7/P0c6OlzpClHsbFzeF41KrYA9scON8Rg6bZu3ZTv6JOAgj3t7USUfg== - dependencies: - "@nomicfoundation/ethereumjs-block" "5.0.4" - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-ethash" "3.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-trie" "6.0.4" - "@nomicfoundation/ethereumjs-tx" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - debug "^4.3.3" - ethereum-cryptography "0.1.3" - lru-cache "^10.0.0" - "@nomicfoundation/ethereumjs-common@4.0.4": version "4.0.4" resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.4.tgz#9901f513af2d4802da87c66d6f255b510bef5acb" @@ -1265,62 +1237,11 @@ dependencies: "@nomicfoundation/ethereumjs-util" "9.0.4" -"@nomicfoundation/ethereumjs-ethash@3.0.4": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-ethash/-/ethereumjs-ethash-3.0.4.tgz#06cb2502b3012fb6c11cffd44af08aecf71310da" - integrity sha512-xvIrwIMl9sSaiYKRem68+O7vYdj7Q2XWv5P7JXiIkn83918QzWHvqbswTRsH7+r6X1UEvdsURRnZbvZszEjAaQ== - dependencies: - "@nomicfoundation/ethereumjs-block" "5.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - bigint-crypto-utils "^3.2.2" - ethereum-cryptography "0.1.3" - -"@nomicfoundation/ethereumjs-evm@2.0.4": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-evm/-/ethereumjs-evm-2.0.4.tgz#c9c761767283ac53946185474362230b169f8f63" - integrity sha512-lTyZZi1KpeMHzaO6cSVisR2tjiTTedjo7PcmhI/+GNFo9BmyY6QYzGeSti0sFttmjbEMioHgXxl5yrLNRg6+1w== - dependencies: - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-statemanager" "2.0.4" - "@nomicfoundation/ethereumjs-tx" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - "@types/debug" "^4.1.9" - debug "^4.3.3" - ethereum-cryptography "0.1.3" - rustbn-wasm "^0.2.0" - "@nomicfoundation/ethereumjs-rlp@5.0.4": version "5.0.4" resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.4.tgz#66c95256fc3c909f6fb18f6a586475fc9762fa30" integrity sha512-8H1S3s8F6QueOc/X92SdrA4RDenpiAEqMg5vJH99kcQaCy/a3Q6fgseo75mgWlbanGJXSlAPtnCeG9jvfTYXlw== -"@nomicfoundation/ethereumjs-statemanager@2.0.4": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-statemanager/-/ethereumjs-statemanager-2.0.4.tgz#bf14415e1f31b5ea8b98a0c027c547d0555059b6" - integrity sha512-HPDjeFrxw6llEi+BzqXkZ+KkvFnTOPczuHBtk21hRlDiuKuZz32dPzlhpRsDBGV1b5JTmRDUVqCS1lp3Gghw4Q== - dependencies: - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-trie" "6.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - debug "^4.3.3" - ethereum-cryptography "0.1.3" - js-sdsl "^4.1.4" - lru-cache "^10.0.0" - -"@nomicfoundation/ethereumjs-trie@6.0.4": - version "6.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-trie/-/ethereumjs-trie-6.0.4.tgz#688a3f76646c209365ee6d959c3d7330ede5e609" - integrity sha512-3nSwQiFMvr2VFe/aZUyinuohYvtytUqZCUCvIWcPJ/BwJH6oQdZRB42aNFBJ/8nAh2s3OcroWpBLskzW01mFKA== - dependencies: - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - "@types/readable-stream" "^2.3.13" - ethereum-cryptography "0.1.3" - lru-cache "^10.0.0" - readable-stream "^3.6.0" - "@nomicfoundation/ethereumjs-tx@5.0.4": version "5.0.4" resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.4.tgz#b0ceb58c98cc34367d40a30d255d6315b2f456da" @@ -1339,33 +1260,6 @@ "@nomicfoundation/ethereumjs-rlp" "5.0.4" ethereum-cryptography "0.1.3" -"@nomicfoundation/ethereumjs-verkle@0.0.2": - version "0.0.2" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-verkle/-/ethereumjs-verkle-0.0.2.tgz#7686689edec775b2efea5a71548f417c18f7dea4" - integrity sha512-bjnfZElpYGK/XuuVRmLS3yDvr+cDs85D9oonZ0YUa5A3lgFgokWMp76zXrxX2jVQ0BfHaw12y860n1+iOi6yFQ== - dependencies: - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - lru-cache "^10.0.0" - rust-verkle-wasm "^0.0.1" - -"@nomicfoundation/ethereumjs-vm@7.0.4": - version "7.0.4" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-vm/-/ethereumjs-vm-7.0.4.tgz#e5a6eec4877dc62dda93003c6d7afd1fe4b9625b" - integrity sha512-gsA4IhmtWHI4BofKy3kio9W+dqZQs5Ji5mLjLYxHCkat+JQBUt5szjRKra2F9nGDJ2XcI/wWb0YWUFNgln4zRQ== - dependencies: - "@nomicfoundation/ethereumjs-block" "5.0.4" - "@nomicfoundation/ethereumjs-blockchain" "7.0.4" - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-evm" "2.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-statemanager" "2.0.4" - "@nomicfoundation/ethereumjs-trie" "6.0.4" - "@nomicfoundation/ethereumjs-tx" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - debug "^4.3.3" - ethereum-cryptography "0.1.3" - "@nomicfoundation/hardhat-viem@^2.0.2": version "2.0.2" resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-viem/-/hardhat-viem-2.0.2.tgz#91d7a6d3e66c93bc39b2322420a1bad82360df7d" @@ -1775,7 +1669,7 @@ "@safe-global/safe-contracts" "^1.4.1-build.0" cbor "^9.0.2" -"@scure/base@^1.1.1", "@scure/base@~1.1.0": +"@scure/base@~1.1.0": version "1.1.6" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.6.tgz#8ce5d304b436e4c84f896e0550c83e4d88cb917d" integrity sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g== @@ -2136,13 +2030,6 @@ resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.16.tgz#b1572967f0b8b60bf3f87fe1d854a5604ea70c82" integrity sha512-PatH4iOdyh3MyWtmHVFXLWCCIhUbopaltqddG9BzB+gMIzee2MJrvd+jouii9Z3wzQJruGWAm7WOMjgfG8hQlQ== -"@types/debug@^4.1.9": - version "4.1.12" - resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" - integrity sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ== - dependencies: - "@types/ms" "*" - "@types/graceful-fs@^4.1.3": version "4.1.6" resolved "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz" @@ -2197,11 +2084,6 @@ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.6.tgz#818551d39113081048bdddbef96701b4e8bb9d1b" integrity sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg== -"@types/ms@*": - version "0.7.34" - resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.34.tgz#10964ba0dee6ac4cd462e2795b6bebd407303433" - integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g== - "@types/node-fetch@^2.6.11": version "2.6.11" resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.11.tgz#9b39b78665dae0e82a08f02f4967d62c66f95d24" @@ -2239,14 +2121,6 @@ resolved "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz" integrity sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw== -"@types/readable-stream@^2.3.13": - version "2.3.15" - resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-2.3.15.tgz#3d79c9ceb1b6a57d5f6e6976f489b9b5384321ae" - integrity sha512-oM5JSKQCcICF1wvGgmecmHldZ48OZamtMxcGGVICOJA8o8cahXC1zEVAif8iwoc5j8etxFaRFnf095+CDsuoFQ== - dependencies: - "@types/node" "*" - safe-buffer "~5.1.1" - "@types/secp256k1@^4.0.1": version "4.0.3" resolved "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz" @@ -2296,7 +2170,7 @@ resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz" integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== -"@types/yargs@^17.0.32", "@types/yargs@^17.0.8": +"@types/yargs@^17.0.8": version "17.0.32" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.32.tgz#030774723a2f7faafebf645f4e5a48371dca6229" integrity sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog== @@ -2787,11 +2661,6 @@ before-after-hook@^2.2.0: resolved "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz" integrity sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ== -bigint-crypto-utils@^3.2.2: - version "3.3.0" - resolved "https://registry.yarnpkg.com/bigint-crypto-utils/-/bigint-crypto-utils-3.3.0.tgz#72ad00ae91062cf07f2b1def9594006c279c1d77" - integrity sha512-jOTSb+drvEDxEq6OuUybOAv/xxoh3cuYRUIPyu8sSHQNKM303UQ2R1DAo45o1AkcIXw6fzbaFI1+xGGdaXs2lg== - binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz" @@ -3318,11 +3187,6 @@ command-exists@^1.2.8: resolved "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz" integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== -commander@3.0.2: - version "3.0.2" - resolved "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz" - integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== - commander@^8.1.0: version "8.3.0" resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" @@ -4030,7 +3894,7 @@ ethers@6.7.0: tslib "2.4.0" ws "8.5.0" -ethers@^5.7.0: +ethers@^5.7.0, ethers@~5.7.0: version "5.7.2" resolved "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -4374,17 +4238,6 @@ fs-constants@^1.0.0: resolved "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@^0.30.0: - version "0.30.0" - resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz" - integrity sha512-UvSPKyhMn6LEd/WpUaV9C9t3zATuqoqfWc3QdPhPLb58prN9tqYPlPWi8Krxi44loBoUzlobqZ3+8tGpxxSzwA== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^2.1.0" - klaw "^1.0.0" - path-is-absolute "^1.0.0" - rimraf "^2.2.8" - fs-extra@^10.0.0: version "10.1.0" resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz" @@ -4669,7 +4522,7 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" -graceful-fs@4.2.11, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9: +graceful-fs@4.2.11, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== @@ -4696,10 +4549,10 @@ hard-rejection@^2.1.0: resolved "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz" integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== -hardhat-deploy@^0.11.45: - version "0.11.45" - resolved "https://registry.yarnpkg.com/hardhat-deploy/-/hardhat-deploy-0.11.45.tgz#bed86118175a38a03bb58aba2ce1ed5e80a20bc8" - integrity sha512-aC8UNaq3JcORnEUIwV945iJuvBwi65tjHVDU3v6mOcqik7WAzHVCJ7cwmkkipsHrWysrB5YvGF1q9S1vIph83w== +hardhat-deploy@^0.12.4: + version "0.12.4" + resolved "https://registry.yarnpkg.com/hardhat-deploy/-/hardhat-deploy-0.12.4.tgz#5ebef37f1004f52a74987213b0465ad7c9433fb2" + integrity sha512-bYO8DIyeGxZWlhnMoCBon9HNZb6ji0jQn7ngP1t5UmGhC8rQYhji7B73qETMOFhzt5ECZPr+U52duj3nubsqdQ== dependencies: "@ethersproject/abi" "^5.7.0" "@ethersproject/abstract-signer" "^5.7.0" @@ -4724,63 +4577,7 @@ hardhat-deploy@^0.11.45: match-all "^1.2.6" murmur-128 "^0.2.1" qs "^6.9.4" - zksync-web3 "^0.14.3" - -hardhat@2.20.1: - version "2.20.1" - resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.20.1.tgz#3ad8f2b003a96c9ce80a55fec3575580ff2ddcd4" - integrity sha512-q75xDQiQtCZcTMBwjTovrXEU5ECr49baxr4/OBkIu/ULTPzlB20yk1dRWNmD2IFbAeAeXggaWvQAdpiScaHtPw== - dependencies: - "@ethersproject/abi" "^5.1.2" - "@metamask/eth-sig-util" "^4.0.0" - "@nomicfoundation/ethereumjs-block" "5.0.4" - "@nomicfoundation/ethereumjs-blockchain" "7.0.4" - "@nomicfoundation/ethereumjs-common" "4.0.4" - "@nomicfoundation/ethereumjs-evm" "2.0.4" - "@nomicfoundation/ethereumjs-rlp" "5.0.4" - "@nomicfoundation/ethereumjs-statemanager" "2.0.4" - "@nomicfoundation/ethereumjs-trie" "6.0.4" - "@nomicfoundation/ethereumjs-tx" "5.0.4" - "@nomicfoundation/ethereumjs-util" "9.0.4" - "@nomicfoundation/ethereumjs-verkle" "0.0.2" - "@nomicfoundation/ethereumjs-vm" "7.0.4" - "@nomicfoundation/solidity-analyzer" "^0.1.0" - "@sentry/node" "^5.18.1" - "@types/bn.js" "^5.1.0" - "@types/lru-cache" "^5.1.0" - adm-zip "^0.4.16" - aggregate-error "^3.0.0" - ansi-escapes "^4.3.0" - boxen "^5.1.2" - chalk "^2.4.2" - chokidar "^3.4.0" - ci-info "^2.0.0" - debug "^4.1.1" - enquirer "^2.3.0" - env-paths "^2.2.0" - ethereum-cryptography "^1.0.3" - ethereumjs-abi "^0.6.8" - find-up "^2.1.0" - fp-ts "1.19.3" - fs-extra "^7.0.1" - glob "7.2.0" - immutable "^4.0.0-rc.12" - io-ts "1.10.4" - keccak "^3.0.2" - lodash "^4.17.11" - mnemonist "^0.38.0" - mocha "^10.0.0" - p-map "^4.0.0" - raw-body "^2.4.1" - resolve "1.17.0" - semver "^6.3.0" - solc "0.7.3" - source-map-support "^0.5.13" - stacktrace-parser "^0.1.10" - tsort "0.0.1" - undici "^5.14.0" - uuid "^8.3.2" - ws "^7.4.6" + zksync-ethers "^5.0.0" hardhat@^2.19.3: version "2.22.7" @@ -5866,11 +5663,6 @@ jest@^29.7.0: import-local "^3.0.2" jest-cli "^29.7.0" -js-sdsl@^4.1.4: - version "4.4.2" - resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.4.2.tgz#2e3c031b1f47d3aca8b775532e3ebb0818e7f847" - integrity sha512-dwXFwByc/ajSV6m5bcKAPwe4yDDF6D614pxmIi5odytzxRlwqF6nwoiCek80Ixc7Cvma5awClxrzFtxCQvcM8w== - js-sha3@0.8.0: version "0.8.0" resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz" @@ -5946,13 +5738,6 @@ jsonc-parser@3.2.0: resolved "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz" integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== -jsonfile@^2.1.0: - version "2.4.0" - resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz" - integrity sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw== - optionalDependencies: - graceful-fs "^4.1.6" - jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz" @@ -5993,13 +5778,6 @@ kind-of@^6.0.2, kind-of@^6.0.3: resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== -klaw@^1.0.0: - version "1.3.1" - resolved "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz" - integrity sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw== - optionalDependencies: - graceful-fs "^4.1.9" - kleur@^3.0.3: version "3.0.3" resolved "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz" @@ -6261,7 +6039,7 @@ loupe@^2.3.6: dependencies: get-func-name "^2.0.0" -lru-cache@^10.0.0, lru-cache@^10.0.1, lru-cache@^10.2.0: +lru-cache@^10.0.1, lru-cache@^10.2.0: version "10.4.3" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== @@ -7736,11 +7514,6 @@ require-directory@^2.1.1: resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -require-from-string@^2.0.0: - version "2.0.2" - resolved "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz" - integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== - require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz" @@ -7815,13 +7588,6 @@ rfdc@^1.3.1: resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.4.1.tgz#778f76c4fb731d93414e8f925fbecf64cce7f6ca" integrity sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA== -rimraf@^2.2.8: - version "2.7.1" - resolved "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" @@ -7863,18 +7629,6 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -rust-verkle-wasm@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/rust-verkle-wasm/-/rust-verkle-wasm-0.0.1.tgz#fd8396a7060d8ee8ea10da50ab6e862948095a74" - integrity sha512-BN6fiTsxcd2dCECz/cHtGTt9cdLJR925nh7iAuRcj8ymKw7OOaPmCneQZ7JePOJ/ia27TjEL91VdOi88Yf+mcA== - -rustbn-wasm@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/rustbn-wasm/-/rustbn-wasm-0.2.0.tgz#0407521fb55ae69eeb4968d01885d63efd1c4ff9" - integrity sha512-FThvYFNTqrEKGqXuseeg0zR7yROh/6U1617mCHF68OVqrN1tNKRN7Tdwy4WayPVsCmmK+eMxtIZX1qL6JxTkMg== - dependencies: - "@scure/base" "^1.1.1" - rxjs@^7.5.5: version "7.8.0" resolved "https://registry.npmjs.org/rxjs/-/rxjs-7.8.0.tgz" @@ -8101,21 +7855,6 @@ socks@^2.6.2, socks@^2.7.1: ip-address "^9.0.5" smart-buffer "^4.2.0" -solc@0.7.3: - version "0.7.3" - resolved "https://registry.npmjs.org/solc/-/solc-0.7.3.tgz" - integrity sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA== - dependencies: - command-exists "^1.2.8" - commander "3.0.2" - follow-redirects "^1.12.1" - fs-extra "^0.30.0" - js-sha3 "0.8.0" - memorystream "^0.3.1" - require-from-string "^2.0.0" - semver "^5.5.0" - tmp "0.0.33" - solc@0.8.26: version "0.8.26" resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.26.tgz#afc78078953f6ab3e727c338a2fefcd80dd5b01a" @@ -9348,7 +9087,7 @@ yargs@16.2.0, yargs@^16.2.0: y18n "^5.0.5" yargs-parser "^20.2.2" -yargs@17.7.2, yargs@^17.3.1, yargs@^17.6.2, yargs@^17.7.2: +yargs@17.7.2, yargs@^17.3.1, yargs@^17.6.2: version "17.7.2" resolved "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== @@ -9388,10 +9127,12 @@ yocto-queue@^0.1.0: resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== -zksync-web3@^0.14.3: - version "0.14.4" - resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.14.4.tgz#0b70a7e1a9d45cc57c0971736079185746d46b1f" - integrity sha512-kYehMD/S6Uhe1g434UnaMN+sBr9nQm23Ywn0EUP5BfQCsbjcr3ORuS68PosZw8xUTu3pac7G6YMSnNHk+fwzvg== +zksync-ethers@^5.0.0: + version "5.9.2" + resolved "https://registry.yarnpkg.com/zksync-ethers/-/zksync-ethers-5.9.2.tgz#1c5f34cb25ac0b040fd1a6118f2ba1c2c3bda090" + integrity sha512-Y2Mx6ovvxO6UdC2dePLguVzvNToOY8iLWeq5ne+jgGSJxAi/f4He/NF6FNsf6x1aWX0o8dy4Df8RcOQXAkj5qw== + dependencies: + ethers "~5.7.0" zod@^3.21.4: version "3.22.4" From 902149f4faeaf11872f51a6640f657e0c5ffa27d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 16 Sep 2024 14:24:21 +0200 Subject: [PATCH 55/55] trigger ci