| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | |
| 4 | pragma experimental ABIEncoderV2; |
| 5 | |
| 6 | interface IMulticall3 { |
| 7 | struct Call { |
| 8 | address target; |
| 9 | bytes callData; |
| 10 | } |
| 11 | |
| 12 | struct Call3 { |
| 13 | address target; |
| 14 | bool allowFailure; |
| 15 | bytes callData; |
| 16 | } |
| 17 | |
| 18 | struct Call3Value { |
| 19 | address target; |
| 20 | bool allowFailure; |
| 21 | uint256 value; |
| 22 | bytes callData; |
| 23 | } |
| 24 | |
| 25 | struct Result { |
| 26 | bool success; |
| 27 | bytes returnData; |
| 28 | } |
| 29 | |
| 30 | function aggregate(Call[] calldata calls) |
| 31 | external |
| 32 | payable |
| 33 | returns (uint256 blockNumber, bytes[] memory returnData); |
| 34 | |
| 35 | function aggregate3(Call3[] calldata calls) external payable returns (Result[] memory returnData); |
| 36 | |
| 37 | function aggregate3Value(Call3Value[] calldata calls) external payable returns (Result[] memory returnData); |
| 38 | |
| 39 | function blockAndAggregate(Call[] calldata calls) |
| 40 | external |
| 41 | payable |
| 42 | returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData); |
| 43 | |
| 44 | function getBasefee() external view returns (uint256 basefee); |
| 45 | |
| 46 | function getBlockHash(uint256 blockNumber) external view returns (bytes32 blockHash); |
| 47 | |
| 48 | function getBlockNumber() external view returns (uint256 blockNumber); |
| 49 | |
| 50 | function getChainId() external view returns (uint256 chainid); |
| 51 | |
| 52 | function getCurrentBlockCoinbase() external view returns (address coinbase); |
| 53 | |
| 54 | function getCurrentBlockDifficulty() external view returns (uint256 difficulty); |
| 55 | |
| 56 | function getCurrentBlockGasLimit() external view returns (uint256 gaslimit); |
| 57 | |
| 58 | function getCurrentBlockTimestamp() external view returns (uint256 timestamp); |
| 59 | |
| 60 | function getEthBalance(address addr) external view returns (uint256 balance); |
| 61 | |
| 62 | function getLastBlockHash() external view returns (bytes32 blockHash); |
| 63 | |
| 64 | function tryAggregate(bool requireSuccess, Call[] calldata calls) |
| 65 | external |
| 66 | payable |
| 67 | returns (Result[] memory returnData); |
| 68 | |
| 69 | function tryBlockAndAggregate(bool requireSuccess, Call[] calldata calls) |
| 70 | external |
| 71 | payable |
| 72 | returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData); |
| 73 | } |