Our v2 has been released in public beta. Check it out here and our announcement blog here!

Multicall

0x3017086DeEf56679e267F67F66c4415109b7A97f
copy address
qr
label
download csv
Balance0 TT - $0
Transactions1
Contract NameMulticall
Compiler Versionv0.8.9+commit.e5eed63a
Optimizedtrue
Optimizer Runs200
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

/**
 * Fork from https://github.com/makerdao/multicall/blob/master/src/Multicall.sol
 *
 * @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 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;
    }
}
ABI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
[
  {
    "inputs": [
      {
        "components": [
          {
            "internalType": "address",
            "name": "target",
            "type": "address"
          },
          {
            "internalType": "bytes",
            "name": "callData",
            "type": "bytes"
          }
        ],
        "internalType": "struct Multicall.Call[]",
        "name": "calls",
        "type": "tuple[]"
      }
    ],
    "name": "aggregate",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "blockNumber",
        "type": "uint256"
      },
      {
        "internalType": "bytes[]",
        "name": "returnData",
        "type": "bytes[]"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "blockNumber",
        "type": "uint256"
      }
    ],
    "name": "getBlockHash",
    "outputs": [
      {
        "internalType": "bytes32",
        "name": "blockHash",
        "type": "bytes32"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getCurrentBlockCoinbase",
    "outputs": [
      {
        "internalType": "address",
        "name": "coinbase",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getCurrentBlockDifficulty",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "difficulty",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getCurrentBlockGasLimit",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "gaslimit",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getCurrentBlockTimestamp",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "timestamp",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "addr",
        "type": "address"
      }
    ],
    "name": "getEthBalance",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "balance",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getLastBlockHash",
    "outputs": [
      {
        "internalType": "bytes32",
        "name": "blockHash",
        "type": "bytes32"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  }
]
Creation Bytecode
1
0x608060405234801561001057600080fd5b50600436106100a5576000357c01000000000000000000000000000000000000000000000000000000009004806372425d9d1161007857806372425d9d1461011057806386d516e814610116578063a8b0574e1461011c578063ee82ac5e1461012a57600080fd5b80630f28c97d146100aa578063252dba42146100bf57806327e86d6e146100e05780634d2301cc146100e8575b600080fd5b425b6040519081526020015b60405180910390f35b6100d26100cd36600461034e565b61013c565b6040516100b69291906104db565b6100ac610289565b6100ac6100f636600461055c565b73ffffffffffffffffffffffffffffffffffffffff163190565b446100ac565b456100ac565b6040514181526020016100b6565b6100ac61013836600461057e565b4090565b8051439060609067ffffffffffffffff81111561015b5761015b61029c565b60405190808252806020026020018201604052801561018e57816020015b60608152602001906001900390816101795790505b50905060005b8351811015610283576000808583815181106101b2576101b2610597565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff168684815181106101e6576101e6610597565b6020026020010151602001516040516101ff91906105c6565b6000604051808303816000865af19150503d806000811461023c576040519150601f19603f3d011682016040523d82523d6000602084013e610241565b606091505b50915091508161025057600080fd5b8084848151811061026357610263610597565b60200260200101819052505050808061027b90610611565b915050610194565b50915091565b600061029660014361062c565b40905090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156102ee576102ee61029c565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561031d5761031d61029c565b604052919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461034957600080fd5b919050565b6000602080838503121561036157600080fd5b823567ffffffffffffffff8082111561037957600080fd5b818501915085601f83011261038d57600080fd5b81358181111561039f5761039f61029c565b8381026103ad8582016102f4565b91825283810185019185810190898411156103c757600080fd5b86860192505b8383101561049e578235858111156103e55760008081fd5b86016040601f19828d0381018213156103fe5760008081fd5b6104066102cb565b6104118b8501610325565b815282840135898111156104255760008081fd5b8085019450508d603f85011261043b5760008081fd5b8a8401358981111561044f5761044f61029c565b61045f8c84601f840116016102f4565b92508083528e848287010111156104765760008081fd5b808486018d85013760009083018c0152808b01919091528452505091860191908601906103cd565b9998505050505050505050565b60005b838110156104c65781810151838201526020016104ae565b838111156104d5576000848401525b50505050565b60006040820184835260206040818501528185518084526060860191506060838202870101935082870160005b8281101561054e57878603605f190184528151805180885261052f81888a018985016104ab565b601f01601f191696909601850195509284019290840190600101610508565b509398975050505050505050565b60006020828403121561056e57600080fd5b61057782610325565b9392505050565b60006020828403121561059057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082516105d88184602087016104ab565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000600019821415610625576106256105e2565b5060010190565b60008282101561063e5761063e6105e2565b50039056fea2646970667358221220a4909094187a95c4e36f230022f82f367643ea1fa676bab1e34b9cbb4415295364736f6c63430008090033

ViewBlock

Copyright © 2022 Ashlar