Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Multicall module #2608

Merged
merged 18 commits into from
Apr 7, 2021
19 changes: 19 additions & 0 deletions contracts/utils/BatchCall.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./Address.sol";

/*
frangio marked this conversation as resolved.
Show resolved Hide resolved
* @dev Provides a way to batch together multiple function calls in a single external call.
*/
abstract contract BatchCall {
function batchcall(bytes[] calldata data) external returns(bytes[] memory results) {
results = new bytes[](data.length);
for (uint i = 0; i < data.length; i++) {
bytes memory result = Address.functionDelegateCall(address(this), data[i]);
results[i] = result;
}
return results;
}
}