Skip to content

Commit

Permalink
Kickstart batchcall
Browse files Browse the repository at this point in the history
  • Loading branch information
martriay committed Mar 23, 2021
1 parent a3712a3 commit 15a5e91
Showing 1 changed file with 19 additions and 0 deletions.
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";

/*
* @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;
}
}

0 comments on commit 15a5e91

Please sign in to comment.