forked from liquity/V2-gov
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiDelegateCall.sol
More file actions
27 lines (22 loc) · 927 Bytes
/
MultiDelegateCall.sol
File metadata and controls
27 lines (22 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {IMultiDelegateCall} from "../interfaces/IMultiDelegateCall.sol";
contract MultiDelegateCall is IMultiDelegateCall {
/// @inheritdoc IMultiDelegateCall
function multiDelegateCall(bytes[] calldata inputs) external returns (bytes[] memory returnValues) {
returnValues = new bytes[](inputs.length);
for (uint256 i; i < inputs.length; ++i) {
(bool success, bytes memory returnData) = address(this).delegatecall(inputs[i]);
if (!success) {
// Bubble up the revert
assembly {
revert(
add(32, returnData), // offset (skip first 32 bytes, where the size of the array is stored)
mload(returnData) // size
)
}
}
returnValues[i] = returnData;
}
}
}