Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Multicall
- Optimization enabled
- true
- Compiler version
- v0.6.6+commit.6c089d02
- Optimization runs
- 200
- Verified at
- 2022-07-19T09:35:30.405148Z
contracts/Multicall.sol
pragma solidity >=0.5.0; 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 Multicall { 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 getFXBalance(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; } }
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 Multicall.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":"getFXBalance","inputs":[{"type":"address","name":"addr","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"blockHash","internalType":"bytes32"}],"name":"getLastBlockHash","inputs":[]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50610552806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806372425d9d1161005b57806372425d9d146100e757806386d516e8146100ef578063a8b0574e146100f7578063ee82ac5e1461010c57610088565b80630f28c97d1461008d578063252dba42146100ab57806327e86d6e146100cc5780636c896bdb146100d4575b600080fd5b61009561011f565b6040516100a2919061043c565b60405180910390f35b6100be6100b9366004610314565b610123565b6040516100a2929190610445565b610095610246565b6100956100e23660046102f2565b61024f565b61009561025c565b610095610260565b6100ff610264565b6040516100a29190610428565b61009561011a3660046103f4565b610268565b4290565b8051439060609067ffffffffffffffff8111801561014057600080fd5b5060405190808252806020026020018201604052801561017457816020015b606081526020019060019003908161015f5790505b50905060005b8351811015610240576000606085838151811061019357fe5b6020026020010151600001516001600160a01b03168684815181106101b457fe5b6020026020010151602001516040516101cd919061040c565b6000604051808303816000865af19150503d806000811461020a576040519150601f19603f3d011682016040523d82523d6000602084013e61020f565b606091505b50915091508161021e57600080fd5b8084848151811061022b57fe5b6020908102919091010152505060010161017a565b50915091565b60001943014090565b6001600160a01b03163190565b4490565b4590565b4190565b4090565b80356001600160a01b038116811461028357600080fd5b92915050565b600082601f830112610299578081fd5b813567ffffffffffffffff8111156102af578182fd5b6102c2601f8201601f19166020016104c5565b91508082528360208285010111156102d957600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215610303578081fd5b61030d838361026c565b9392505050565b60006020808385031215610326578182fd5b823567ffffffffffffffff8082111561033d578384fd5b81850186601f82011261034e578485fd5b803592508183111561035e578485fd5b61036b84858502016104c5565b83815284810190828601875b868110156103e55781358501604080601f19838f03011215610397578a8bfd5b6103a0816104c5565b6103ac8e8c850161026c565b815281830135898111156103be578c8dfd5b6103cc8f8d83870101610289565b828d015250865250509287019290870190600101610377565b50909998505050505050505050565b600060208284031215610405578081fd5b5035919050565b6000825161041e8184602087016104ec565b9190910192915050565b6001600160a01b0391909116815260200190565b90815260200190565b600060408201848352602060408185015281855180845260608601915060608382028701019350828701855b828110156104b757878603605f190184528151805180885261049881888a018985016104ec565b601f01601f191696909601850195509284019290840190600101610471565b509398975050505050505050565b60405181810167ffffffffffffffff811182821017156104e457600080fd5b604052919050565b60005b838110156105075781810151838201526020016104ef565b83811115610516576000848401525b5050505056fea2646970667358221220d3eda3528eecac2dfdc0b7db70815d0fadf6dff87eafb4994939a7c003ffa08564736f6c63430006060033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c806372425d9d1161005b57806372425d9d146100e757806386d516e8146100ef578063a8b0574e146100f7578063ee82ac5e1461010c57610088565b80630f28c97d1461008d578063252dba42146100ab57806327e86d6e146100cc5780636c896bdb146100d4575b600080fd5b61009561011f565b6040516100a2919061043c565b60405180910390f35b6100be6100b9366004610314565b610123565b6040516100a2929190610445565b610095610246565b6100956100e23660046102f2565b61024f565b61009561025c565b610095610260565b6100ff610264565b6040516100a29190610428565b61009561011a3660046103f4565b610268565b4290565b8051439060609067ffffffffffffffff8111801561014057600080fd5b5060405190808252806020026020018201604052801561017457816020015b606081526020019060019003908161015f5790505b50905060005b8351811015610240576000606085838151811061019357fe5b6020026020010151600001516001600160a01b03168684815181106101b457fe5b6020026020010151602001516040516101cd919061040c565b6000604051808303816000865af19150503d806000811461020a576040519150601f19603f3d011682016040523d82523d6000602084013e61020f565b606091505b50915091508161021e57600080fd5b8084848151811061022b57fe5b6020908102919091010152505060010161017a565b50915091565b60001943014090565b6001600160a01b03163190565b4490565b4590565b4190565b4090565b80356001600160a01b038116811461028357600080fd5b92915050565b600082601f830112610299578081fd5b813567ffffffffffffffff8111156102af578182fd5b6102c2601f8201601f19166020016104c5565b91508082528360208285010111156102d957600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215610303578081fd5b61030d838361026c565b9392505050565b60006020808385031215610326578182fd5b823567ffffffffffffffff8082111561033d578384fd5b81850186601f82011261034e578485fd5b803592508183111561035e578485fd5b61036b84858502016104c5565b83815284810190828601875b868110156103e55781358501604080601f19838f03011215610397578a8bfd5b6103a0816104c5565b6103ac8e8c850161026c565b815281830135898111156103be578c8dfd5b6103cc8f8d83870101610289565b828d015250865250509287019290870190600101610377565b50909998505050505050505050565b600060208284031215610405578081fd5b5035919050565b6000825161041e8184602087016104ec565b9190910192915050565b6001600160a01b0391909116815260200190565b90815260200190565b600060408201848352602060408185015281855180845260608601915060608382028701019350828701855b828110156104b757878603605f190184528151805180885261049881888a018985016104ec565b601f01601f191696909601850195509284019290840190600101610471565b509398975050505050505050565b60405181810167ffffffffffffffff811182821017156104e457600080fd5b604052919050565b60005b838110156105075781810151838201526020016104ef565b83811115610516576000848401525b5050505056fea2646970667358221220d3eda3528eecac2dfdc0b7db70815d0fadf6dff87eafb4994939a7c003ffa08564736f6c63430006060033