Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Update Multicall.sol #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/Multicall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ contract Multicall {
address target;
bytes callData;
}
function aggregate(Call[] memory calls) public returns (uint256 blockNumber, bytes[] memory returnData) {
function aggregate(Call[] memory calls, bool _checkCall) public returns (uint256 blockNumber, bytes[] memory returnData) {
blockNumber = block.number;
returnData = new bytes[](calls.length);
for(uint256 i = 0; i < calls.length; i++) {
uint256 cLen = calls.length;
returnData = new bytes[](cLen);
uint256 i;
for(i; i < cLen; i++) {
(bool success, bytes memory ret) = calls[i].target.call(calls[i].callData);
require(success);
if (_checkCall) {
require(success, "Multicall: call failed");
}
returnData[i] = ret;
}
}
Expand Down