From 2e3248226b006fecc49924cfb78838a2908c02dc Mon Sep 17 00:00:00 2001 From: Ian Harvey <16181275+ith-harvey@users.noreply.github.com> Date: Sat, 15 Nov 2025 11:03:05 -0800 Subject: [PATCH 1/2] included multisig batch script into utilities --- .gitmodules | 3 +++ foundry.toml | 4 ++++ lib/safe-utils | 1 + script/MultiSigBatchBase.sol | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 160000 lib/safe-utils create mode 100644 script/MultiSigBatchBase.sol diff --git a/.gitmodules b/.gitmodules index 2019e40..7bd3b9e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,3 +6,6 @@ path = lib/openzeppelin-contracts-upgradeable url = https://github.com/openzeppelin/openzeppelin-contracts-upgradeable branch = release-v5.3 +[submodule "lib/safe-utils"] + path = lib/safe-utils + url = https://github.com/Recon-Fuzz/safe-utils diff --git a/foundry.toml b/foundry.toml index 05ba800..d766ab9 100644 --- a/foundry.toml +++ b/foundry.toml @@ -17,6 +17,10 @@ block_number = 17_740_856 block_timestamp = 1_689_934_508 # Ignore base test files to avoid running tests twice no_match_path = "./test/base/*.t.sol" +ignored_warnings_from = ["lib", "test", "script"] + +[lint] +lint_on_build = false [profile.default.fuzz] runs = 256 diff --git a/lib/safe-utils b/lib/safe-utils new file mode 160000 index 0000000..eccb79f --- /dev/null +++ b/lib/safe-utils @@ -0,0 +1 @@ +Subproject commit eccb79f80cad0f3ad98137cf3e859aac5d66e425 diff --git a/script/MultiSigBatchBase.sol b/script/MultiSigBatchBase.sol new file mode 100644 index 0000000..d3ec99b --- /dev/null +++ b/script/MultiSigBatchBase.sol @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: UNLICENSED + +pragma solidity >=0.8.20 <0.9.0; + +import { Safe } from "../lib/safe-utils/src/Safe.sol"; +import { Script } from "../lib/forge-std/src/Script.sol"; + +abstract contract MultiSigBatchBase is Script { + using Safe for *; + + Safe.Client internal _safeMultiSig; + address[] internal _targets; + bytes[] internal _data; + + function _addToBatch(address target_, bytes memory data_) internal { + _targets.push(target_); + _data.push(data_); + } + + function _proposeBatch(address safe_, address sender) internal { + _safeMultiSig.initialize(safe_); + _safeMultiSig.proposeTransactions(_targets, _data, sender, ""); + } + + function _simulateBatch(address safe_) internal { + vm.startPrank(safe_); + + for (uint256 i = 0; i < _targets.length; i++) { + (bool success, ) = _targets[i].call(_data[i]); + require(success, "Simulation failed"); + } + + vm.stopPrank(); + } +} From a3e30e8ee42fc240eea4f0391f3a00579c1150a8 Mon Sep 17 00:00:00 2001 From: Ian Harvey <16181275+ith-harvey@users.noreply.github.com> Date: Sat, 15 Nov 2025 11:06:58 -0800 Subject: [PATCH 2/2] removed unecessary ignore --- foundry.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/foundry.toml b/foundry.toml index d766ab9..51c7c12 100644 --- a/foundry.toml +++ b/foundry.toml @@ -17,7 +17,6 @@ block_number = 17_740_856 block_timestamp = 1_689_934_508 # Ignore base test files to avoid running tests twice no_match_path = "./test/base/*.t.sol" -ignored_warnings_from = ["lib", "test", "script"] [lint] lint_on_build = false