Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Multicall1
- Optimization enabled
- true
- Compiler version
- v0.8.17+commit.8df45f5f
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2024-06-02T13:10:57.593964Z
contracts/mocks/Multicall1.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.8.17; pragma experimental ABIEncoderV2; /// @title Multicall - Aggregate results from multiple read-only function calls /// @author Michael Elliot <mike@makerdao.com> /// @author Joshua Levine <joshua@makerdao.com> /// @author Nick Johnson <arachnid@notdot.net> contract Multicall1 { 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; } } // Helper functions function getEthBalance(address addr) public view returns (uint256 balance) { balance = addr.balance; } function getBlockHash(uint256 blockNumber) public view returns (bytes32 blockHash) { blockHash = blockhash(blockNumber); } function getLastBlockHash() public view returns (bytes32 blockHash) { blockHash = blockhash(block.number - 1); } function getCurrentBlockTimestamp() public view returns (uint256 timestamp) { timestamp = block.timestamp; } function getCurrentBlockDifficulty() public view returns (uint256 difficulty) { difficulty = block.difficulty; } function getCurrentBlockGasLimit() public view returns (uint256 gaslimit) { gaslimit = block.gaslimit; } function getCurrentBlockCoinbase() public view returns (address coinbase) { coinbase = block.coinbase; } }
Compiler Settings
{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"useLiteralContent":true},"libraries":{}}
Contract ABI
[{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"blockNumber","internalType":"uint256"},{"type":"bytes[]","name":"returnData","internalType":"bytes[]"}],"name":"aggregate","inputs":[{"type":"tuple[]","name":"calls","internalType":"struct Multicall1.Call[]","components":[{"type":"address","name":"target","internalType":"address"},{"type":"bytes","name":"callData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"blockHash","internalType":"bytes32"}],"name":"getBlockHash","inputs":[{"type":"uint256","name":"blockNumber","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"coinbase","internalType":"address"}],"name":"getCurrentBlockCoinbase","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"difficulty","internalType":"uint256"}],"name":"getCurrentBlockDifficulty","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"gaslimit","internalType":"uint256"}],"name":"getCurrentBlockGasLimit","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"timestamp","internalType":"uint256"}],"name":"getCurrentBlockTimestamp","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"balance","internalType":"uint256"}],"name":"getEthBalance","inputs":[{"type":"address","name":"addr","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"blockHash","internalType":"bytes32"}],"name":"getLastBlockHash","inputs":[]}]
Contract Creation Code
0x608060405234801561001057600080fd5b506105e0806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806372425d9d1161005b57806372425d9d146100e657806386d516e8146100ec578063a8b0574e146100f2578063ee82ac5e1461010057600080fd5b80630f28c97d1461008d578063252dba42146100a257806327e86d6e146100c35780634d2301cc146100cb575b600080fd5b425b6040519081526020015b60405180910390f35b6100b56100b03660046102f1565b610112565b604051610099929190610473565b61008f610252565b61008f6100d93660046104f5565b6001600160a01b03163190565b4461008f565b4561008f565b604051418152602001610099565b61008f61010e366004610517565b4090565b8051439060609067ffffffffffffffff81111561013157610131610265565b60405190808252806020026020018201604052801561016457816020015b606081526020019060019003908161014f5790505b50905060005b835181101561024c5760008085838151811061018857610188610530565b6020026020010151600001516001600160a01b03168684815181106101af576101af610530565b6020026020010151602001516040516101c89190610546565b6000604051808303816000865af19150503d8060008114610205576040519150601f19603f3d011682016040523d82523d6000602084013e61020a565b606091505b50915091508161021957600080fd5b8084848151811061022c5761022c610530565b60200260200101819052505050808061024490610578565b91505061016a565b50915091565b600061025f600143610591565b40905090565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561029e5761029e610265565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156102cd576102cd610265565b604052919050565b80356001600160a01b03811681146102ec57600080fd5b919050565b6000602080838503121561030457600080fd5b823567ffffffffffffffff8082111561031c57600080fd5b818501915085601f83011261033057600080fd5b81358181111561034257610342610265565b8060051b6103518582016102a4565b918252838101850191858101908984111561036b57600080fd5b86860192505b83831015610442578235858111156103895760008081fd5b86016040601f19828d0381018213156103a25760008081fd5b6103aa61027b565b6103b58b85016102d5565b815282840135898111156103c95760008081fd5b8085019450508d603f8501126103df5760008081fd5b8a840135898111156103f3576103f3610265565b6104038c84601f840116016102a4565b92508083528e8482870101111561041a5760008081fd5b808486018d85013760009083018c0152808b0191909152845250509186019190860190610371565b9998505050505050505050565b60005b8381101561046a578181015183820152602001610452565b50506000910152565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b828110156104e757878603605f19018452815180518088526104c881888a0189850161044f565b601f01601f1916969096018501955092840192908401906001016104a1565b509398975050505050505050565b60006020828403121561050757600080fd5b610510826102d5565b9392505050565b60006020828403121561052957600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b6000825161055881846020870161044f565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b60006001820161058a5761058a610562565b5060010190565b818103818111156105a4576105a4610562565b9291505056fea2646970667358221220efa05138503fdcc95a38da4bfc3918b7823fa917ccee16dfe9f1f54c821667ec64736f6c63430008110033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c806372425d9d1161005b57806372425d9d146100e657806386d516e8146100ec578063a8b0574e146100f2578063ee82ac5e1461010057600080fd5b80630f28c97d1461008d578063252dba42146100a257806327e86d6e146100c35780634d2301cc146100cb575b600080fd5b425b6040519081526020015b60405180910390f35b6100b56100b03660046102f1565b610112565b604051610099929190610473565b61008f610252565b61008f6100d93660046104f5565b6001600160a01b03163190565b4461008f565b4561008f565b604051418152602001610099565b61008f61010e366004610517565b4090565b8051439060609067ffffffffffffffff81111561013157610131610265565b60405190808252806020026020018201604052801561016457816020015b606081526020019060019003908161014f5790505b50905060005b835181101561024c5760008085838151811061018857610188610530565b6020026020010151600001516001600160a01b03168684815181106101af576101af610530565b6020026020010151602001516040516101c89190610546565b6000604051808303816000865af19150503d8060008114610205576040519150601f19603f3d011682016040523d82523d6000602084013e61020a565b606091505b50915091508161021957600080fd5b8084848151811061022c5761022c610530565b60200260200101819052505050808061024490610578565b91505061016a565b50915091565b600061025f600143610591565b40905090565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561029e5761029e610265565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156102cd576102cd610265565b604052919050565b80356001600160a01b03811681146102ec57600080fd5b919050565b6000602080838503121561030457600080fd5b823567ffffffffffffffff8082111561031c57600080fd5b818501915085601f83011261033057600080fd5b81358181111561034257610342610265565b8060051b6103518582016102a4565b918252838101850191858101908984111561036b57600080fd5b86860192505b83831015610442578235858111156103895760008081fd5b86016040601f19828d0381018213156103a25760008081fd5b6103aa61027b565b6103b58b85016102d5565b815282840135898111156103c95760008081fd5b8085019450508d603f8501126103df5760008081fd5b8a840135898111156103f3576103f3610265565b6104038c84601f840116016102a4565b92508083528e8482870101111561041a5760008081fd5b808486018d85013760009083018c0152808b0191909152845250509186019190860190610371565b9998505050505050505050565b60005b8381101561046a578181015183820152602001610452565b50506000910152565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b828110156104e757878603605f19018452815180518088526104c881888a0189850161044f565b601f01601f1916969096018501955092840192908401906001016104a1565b509398975050505050505050565b60006020828403121561050757600080fd5b610510826102d5565b9392505050565b60006020828403121561052957600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b6000825161055881846020870161044f565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b60006001820161058a5761058a610562565b5060010190565b818103818111156105a4576105a4610562565b9291505056fea2646970667358221220efa05138503fdcc95a38da4bfc3918b7823fa917ccee16dfe9f1f54c821667ec64736f6c63430008110033