Contract Address Details

0x02C5503dd793cC457a1CE50d2d31a749cb5e9cB5

Contract Name
Multicall2
Creator
0x214fdc–1a027a at 0x800d7d–3ac53a
Balance
0 TT
Tokens
Fetching tokens...
Transactions
Transfers
Gas Used
Last Balance Update
82770054
Contract name:
Multicall2




Optimization enabled
true
Compiler version
v0.8.9+commit.e5eed63a




Optimization runs
200
EVM Version
byzantium




Verified at
2022-03-02 04:00:29.403991Z

Contract source code

// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
/**
* Fork from https://github.com/makerdao/multicall/blob/master/src/Multicall2.sol
*
* @title Multicall2 - 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 Multicall2 {
struct Call {
address target;
bytes callData;
}
struct Result {
bool success;
bytes returnData;
}
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, "Multicall aggregate: call failed");
returnData[i] = ret;
}
}
function blockAndAggregate(Call[] memory calls) public returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData) {
(blockNumber, blockHash, returnData) = tryBlockAndAggregate(true, calls);
}
function getBlockHash(uint256 blockNumber) public view returns (bytes32 blockHash) {
blockHash = blockhash(blockNumber);
}
function getBlockNumber() public view returns (uint256 blockNumber) {
blockNumber = block.number;
}
function getCurrentBlockCoinbase() public view returns (address coinbase) {
coinbase = block.coinbase;
}
function getCurrentBlockDifficulty() public view returns (uint256 difficulty) {
difficulty = block.difficulty;
}
function getCurrentBlockGasLimit() public view returns (uint256 gaslimit) {
gaslimit = block.gaslimit;
}
function getCurrentBlockTimestamp() public view returns (uint256 timestamp) {
timestamp = block.timestamp;
}
function getEthBalance(address addr) public view returns (uint256 balance) {
balance = addr.balance;
}
function getLastBlockHash() public view returns (bytes32 blockHash) {
blockHash = blockhash(block.number - 1);
}
function tryAggregate(bool requireSuccess, Call[] memory calls) public returns (Result[] memory returnData) {
returnData = new Result[](calls.length);
for(uint256 i = 0; i < calls.length; i++) {
(bool success, bytes memory ret) = calls[i].target.call(calls[i].callData);
if (requireSuccess) {
require(success, "Multicall2 aggregate: call failed");
}
returnData[i] = Result(success, ret);
}
}
function tryBlockAndAggregate(bool requireSuccess, Call[] memory calls) public returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData) {
blockNumber = block.number;
blockHash = blockhash(block.number);
returnData = tryAggregate(requireSuccess, calls);
}
}

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 Multicall2.Call[]","components":[{"type":"address","name":"target","internalType":"address"},{"type":"bytes","name":"callData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"blockNumber","internalType":"uint256"},{"type":"bytes32","name":"blockHash","internalType":"bytes32"},{"type":"tuple[]","name":"returnData","internalType":"struct Multicall2.Result[]","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"bytes","name":"returnData","internalType":"bytes"}]}],"name":"blockAndAggregate","inputs":[{"type":"tuple[]","name":"calls","internalType":"struct Multicall2.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":"uint256","name":"blockNumber","internalType":"uint256"}],"name":"getBlockNumber","inputs":[]},{"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":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"tuple[]","name":"returnData","internalType":"struct Multicall2.Result[]","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"bytes","name":"returnData","internalType":"bytes"}]}],"name":"tryAggregate","inputs":[{"type":"bool","name":"requireSuccess","internalType":"bool"},{"type":"tuple[]","name":"calls","internalType":"struct Multicall2.Call[]","components":[{"type":"address","name":"target","internalType":"address"},{"type":"bytes","name":"callData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"blockNumber","internalType":"uint256"},{"type":"bytes32","name":"blockHash","internalType":"bytes32"},{"type":"tuple[]","name":"returnData","internalType":"struct Multicall2.Result[]","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"bytes","name":"returnData","internalType":"bytes"}]}],"name":"tryBlockAndAggregate","inputs":[{"type":"bool","name":"requireSuccess","internalType":"bool"},{"type":"tuple[]","name":"calls","internalType":"struct Multicall2.Call[]","components":[{"type":"address","name":"target","internalType":"address"},{"type":"bytes","name":"callData","internalType":"bytes"}]}]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100d1576000357c01000000000000000000000000000000000000000000000000000000009004806372425d9d1161008e57806372425d9d1461016457806386d516e81461016a578063a8b0574e14610170578063bce38bd71461017e578063c3077fa91461019e578063ee82ac5e146101b157600080fd5b80630f28c97d146100d6578063252dba42146100eb57806327e86d6e1461010c578063399542e91461011457806342cbb15c146101365780634d2301cc1461013c575b600080fd5b425b6040519081526020015b60405180910390f35b6100fe6100f93660046107a3565b6101c3565b6040516100e292919061083c565b6100d8610372565b6101276101223660046108a5565b610385565b6040516100e293929190610961565b436100d8565b6100d861014a366004610989565b73ffffffffffffffffffffffffffffffffffffffff163190565b446100d8565b456100d8565b6040514181526020016100e2565b61019161018c3660046108a5565b61039d565b6040516100e291906109ab565b6101276101ac3660046107a3565b61059a565b6100d86101bf3660046109be565b4090565b8051439060609067ffffffffffffffff8111156101e2576101e26105b7565b60405190808252806020026020018201604052801561021557816020015b60608152602001906001900390816102005790505b50905060005b835181101561036c57600080858381518110610239576102396109d7565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1686848151811061026d5761026d6109d7565b6020026020010151602001516040516102869190610a06565b6000604051808303816000865af19150503d80600081146102c3576040519150601f19603f3d011682016040523d82523d6000602084013e6102c8565b606091505b509150915081610339576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4d756c746963616c6c206167677265676174653a2063616c6c206661696c656460448201526064015b60405180910390fd5b8084848151811061034c5761034c6109d7565b60200260200101819052505050808061036490610a51565b91505061021b565b50915091565b600061037f600143610a6c565b40905090565b4380406060610394858561039d565b90509250925092565b6060815167ffffffffffffffff8111156103b9576103b96105b7565b6040519080825280602002602001820160405280156103ff57816020015b6040805180820190915260008152606060208201528152602001906001900390816103d75790505b50905060005b825181101561059357600080848381518110610423576104236109d7565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff16858481518110610457576104576109d7565b6020026020010151602001516040516104709190610a06565b6000604051808303816000865af19150503d80600081146104ad576040519150601f19603f3d011682016040523d82523d6000602084013e6104b2565b606091505b5091509150851561054a578161054a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4d756c746963616c6c32206167677265676174653a2063616c6c206661696c6560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610330565b6040518060400160405280831515815260200182815250848481518110610573576105736109d7565b60200260200101819052505050808061058b90610a51565b915050610405565b5092915050565b60008060606105aa600185610385565b9196909550909350915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610609576106096105b7565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610638576106386105b7565b604052919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461066457600080fd5b919050565b6000601f838184011261067b57600080fd5b8235602067ffffffffffffffff80831115610698576106986105b7565b8183026106a683820161060f565b93845286810183019383810190898611156106c057600080fd5b84890192505b85831015610796578235848111156106de5760008081fd5b89016040601f19828d0381018213156106f75760008081fd5b6106ff6105e6565b61070a898501610640565b8152828401358881111561071e5760008081fd5b8085019450508d603f8501126107345760008081fd5b8884013588811115610748576107486105b7565b6107578a848e8401160161060f565b92508083528e8482870101111561076e5760008081fd5b808486018b85013760009083018a0152808901919091528452505091840191908401906106c6565b9998505050505050505050565b6000602082840312156107b557600080fd5b813567ffffffffffffffff8111156107cc57600080fd5b6107d884828501610669565b949350505050565b60005b838110156107fb5781810151838201526020016107e3565b8381111561080a576000848401525b50505050565b600081518084526108288160208601602086016107e0565b601f01601f19169290920160200192915050565b60006040820184835260206040818501528185518084526060860191506060838202870101935082870160005b8281101561089757605f19888703018452610885868351610810565b95509284019290840190600101610869565b509398975050505050505050565b600080604083850312156108b857600080fd5b823580151581146108c857600080fd5b9150602083013567ffffffffffffffff8111156108e457600080fd5b6108f085828601610669565b9150509250929050565b600081518084526020808501945084818302860182860160005b858110156109545783830389528151805115158452850151604086850181905261094081860183610810565b9a87019a9450505090840190600101610914565b5090979650505050505050565b83815282602082015260606040820152600061098060608301846108fa565b95945050505050565b60006020828403121561099b57600080fd5b6109a482610640565b9392505050565b6020815260006109a460208301846108fa565b6000602082840312156109d057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008251610a188184602087016107e0565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000600019821415610a6557610a65610a22565b5060010190565b600082821015610a7e57610a7e610a22565b50039056fea26469706673582212207d7e2aa44f18af2935b0722dc2cf6d1679615dfbbe451813eb515c74e4abd84264736f6c63430008090033