mirror of
https://github.com/luxfi/uma.git
synced 2026-10-30 15:14:44 +00:00
24 lines
763 B
Solidity
24 lines
763 B
Solidity
pragma solidity >=0.5.0;
|
|
|
|
/// @title Multicall - Aggregate results from multiple read-only function calls
|
|
/// @author Michael Elliot <[email protected]>
|
|
/// @author Joshua Levine <[email protected]>
|
|
/// @author Nick Johnson <[email protected]>
|
|
|
|
contract MulticallMock {
|
|
struct Call {
|
|
address target;
|
|
bytes callData;
|
|
}
|
|
|
|
function aggregate(Call[] memory calls) public returns (uint256 blockNumber, bytes[] memory returnData) {
|
|
blockNumber = block.number;
|
|
returnData = new bytes[](calls.length);
|
|
for (uint256 i = 0; i < calls.length; i++) {
|
|
(bool success, bytes memory ret) = calls[i].target.call(calls[i].callData);
|
|
require(success);
|
|
returnData[i] = ret;
|
|
}
|
|
}
|
|
}
|