Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ block_timestamp = 1_689_934_508
# Ignore base test files to avoid running tests twice
no_match_path = "./test/base/*.t.sol"

[lint]
lint_on_build = false

[profile.default.fuzz]
runs = 256

Expand Down
1 change: 1 addition & 0 deletions lib/safe-utils
Submodule safe-utils added at eccb79
35 changes: 35 additions & 0 deletions script/MultiSigBatchBase.sol
Original file line number Diff line number Diff line change
@@ -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();
}
}