Skip to content

Commit

Permalink
fix array handling
Browse files Browse the repository at this point in the history
  • Loading branch information
auryn-macmillan committed Jul 22, 2024
1 parent a25581e commit a103a36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 7 additions & 2 deletions contracts/OSXAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ contract OSXAdapter is Modifier {
uint256 value,
bytes memory data,
Enum.Operation operation
) internal override moduleOnly returns (bool success) {
) internal override returns (bool success) {
Action[] memory actions = convertTransaction(to, value, data, operation);
IOSx(target).execute(bytes32(0), actions, 0);
success = true;
Expand Down Expand Up @@ -99,7 +99,7 @@ contract OSXAdapter is Modifier {
uint256 value,
bytes memory data,
Enum.Operation operation
) private view returns (Action[] memory actions) {
) private view returns (Action[] memory) {
if (operation == Enum.Operation.DelegateCall) {
ITransactionUnwrapper transactionUnwrapper = transactionUnwrappers[to];
require(transactionUnwrapper != ITransactionUnwrapper(address(0)), MultisendAddressNotAllowed());
Expand All @@ -111,6 +111,8 @@ contract OSXAdapter is Modifier {
operation
);

Action[] memory actions = new Action[](unwrappedTransactions.length);

for (uint i = 0; i < unwrappedTransactions.length; i++) {
actions[i] = convert(
unwrappedTransactions[i].to,
Expand All @@ -119,8 +121,11 @@ contract OSXAdapter is Modifier {
unwrappedTransactions[i].operation
);
}
return actions;
} else {
Action[] memory actions = new Action[](1);
actions[0] = convert(to, value, data, operation);
return actions;
}
}

Expand Down
8 changes: 3 additions & 5 deletions contracts/test/MockOSXDAO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ contract MockOSXDAO {
permissions[recipient][EXECUTE_PERMISSION_ID] = true;
}

function execute(
bytes32,
Action[] memory actions,
uint256
) external returns (bytes[] memory responses, uint256 failureMap) {
function execute(bytes32, Action[] memory actions, uint256) external returns (bytes[] memory, uint256 failureMap) {
require(permissions[msg.sender][EXECUTE_PERMISSION_ID], NotAuthorized(msg.sender));
bytes[] memory responses = new bytes[](actions.length);

bool success;
for (uint i = 0; i < actions.length; i++) {
Expand All @@ -38,5 +35,6 @@ contract MockOSXDAO {
}

failureMap = 0;
return (responses, failureMap);
}
}

0 comments on commit a103a36

Please sign in to comment.