Skip to content

Commit bc277ed

Browse files
committed
update getCalldata
1 parent c4c8837 commit bc277ed

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/proposals/MultisigProposal.sol

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,24 @@ abstract contract MultisigProposal is Proposal {
2020
}
2121

2222
/// @notice return calldata, log if debug is set to true
23-
function getCalldata() public view virtual override returns (bytes memory data) {
24-
/// get proposal actions
23+
function getCalldata() public view override returns (bytes memory) {
2524
(address[] memory targets, uint256[] memory values, bytes[] memory arguments) = getProposalActions();
2625

27-
/// create calls array with targets and arguments
28-
Call3Value[] memory calls = new Call3Value[](targets.length);
26+
require(targets.length == values.length && values.length == arguments.length, "Array lengths mismatch");
2927

30-
for (uint256 i; i < calls.length; i++) {
31-
require(targets[i] != address(0), "Invalid target for multisig");
32-
calls[i] = Call3Value({target: targets[i], allowFailure: false, value: values[i], callData: arguments[i]});
28+
bytes memory encodedTxs;
29+
30+
for (uint256 i = 0; i < targets.length; i++) {
31+
uint8 operation = 0;
32+
address to = targets[i];
33+
uint256 value = values[i];
34+
bytes memory data = arguments[i];
35+
36+
encodedTxs = bytes.concat(encodedTxs, abi.encodePacked(operation, to, value, uint256(data.length), data));
3337
}
3438

35-
/// generate calldata
36-
data = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
39+
// The final calldata to send to the MultiSend contract
40+
return abi.encodeWithSignature("multiSend(bytes)", encodedTxs);
3741
}
3842

3943
/// @notice Check if there are any on-chain proposal that matches the

0 commit comments

Comments
 (0)