Overview
APE Balance
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Multichain Info
No addresses found
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
1779333 | 151 days ago | Contract Creation | 0 APE |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
ExternalMulticallSimulator
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "../utils/SelfMulticall.sol"; import "./interfaces/IExternalMulticallSimulator.sol"; import "../vendor/@openzeppelin/[email protected]/utils/Address.sol"; /// @title Contract that simulates external calls in single or batched form /// @notice This contract requires address-zero to be impersonated and zero gas /// price to be used while making external calls to ensure that it is only used /// for simulating outcomes rather than sending transactions contract ExternalMulticallSimulator is SelfMulticall, IExternalMulticallSimulator { /// @notice eth_call'ed while impersonating address-zero with zero gas /// price to simulate an external call /// @param target Target address of the external call /// @param data Calldata of the external call /// @return Returndata of the external call function functionCall( address target, bytes memory data ) external override returns (bytes memory) { require(msg.sender == address(0), "Sender address not zero"); require(tx.gasprice == 0, "Tx gas price not zero"); return Address.functionCall(target, data); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ISelfMulticall.sol"; interface IExternalMulticallSimulator is ISelfMulticall { function functionCall( address target, bytes memory data ) external returns (bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ISelfMulticall { function multicall( bytes[] calldata data ) external returns (bytes[] memory returndata); function tryMulticall( bytes[] calldata data ) external returns (bool[] memory successes, bytes[] memory returndata); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/ISelfMulticall.sol"; /// @title Contract that enables calls to the inheriting contract to be batched /// @notice Implements two ways of batching, one requires none of the calls to /// revert and the other tolerates individual calls reverting /// @dev This implementation uses delegatecall for individual function calls. /// Since delegatecall is a message call, it can only be made to functions that /// are externally visible. This means that a contract cannot multicall its own /// functions that use internal/private visibility modifiers. /// Refer to OpenZeppelin's Multicall.sol for a similar implementation. contract SelfMulticall is ISelfMulticall { /// @notice Batches calls to the inheriting contract and reverts as soon as /// one of the batched calls reverts /// @param data Array of calldata of batched calls /// @return returndata Array of returndata of batched calls function multicall( bytes[] calldata data ) external override returns (bytes[] memory returndata) { uint256 callCount = data.length; returndata = new bytes[](callCount); for (uint256 ind = 0; ind < callCount; ) { bool success; // solhint-disable-next-line avoid-low-level-calls (success, returndata[ind]) = address(this).delegatecall(data[ind]); if (!success) { bytes memory returndataWithRevertData = returndata[ind]; if (returndataWithRevertData.length > 0) { // Adapted from OpenZeppelin's Address.sol // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndataWithRevertData) revert( add(32, returndataWithRevertData), returndata_size ) } } else { revert("Multicall: No revert string"); } } unchecked { ind++; } } } /// @notice Batches calls to the inheriting contract but does not revert if /// any of the batched calls reverts /// @param data Array of calldata of batched calls /// @return successes Array of success conditions of batched calls /// @return returndata Array of returndata of batched calls function tryMulticall( bytes[] calldata data ) external override returns (bool[] memory successes, bytes[] memory returndata) { uint256 callCount = data.length; successes = new bool[](callCount); returndata = new bytes[](callCount); for (uint256 ind = 0; ind < callCount; ) { // solhint-disable-next-line avoid-low-level-calls (successes[ind], returndata[ind]) = address(this).delegatecall( data[ind] ); unchecked { ind++; } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"functionCall","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"returndata","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"tryMulticall","outputs":[{"internalType":"bool[]","name":"successes","type":"bool[]"},{"internalType":"bytes[]","name":"returndata","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50610985806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063437b911614610046578063a0b5ffb014610070578063ac9650d814610090575b600080fd5b610059610054366004610636565b6100b0565b60405161006792919061074d565b60405180910390f35b61008361007e3660046107bc565b610216565b6040516100679190610899565b6100a361009e366004610636565b6102ca565b60405161006791906108ac565b606080828067ffffffffffffffff8111156100cd576100cd6107a6565b6040519080825280602002602001820160405280156100f6578160200160208202803683370190505b5092508067ffffffffffffffff811115610112576101126107a6565b60405190808252806020026020018201604052801561014557816020015b60608152602001906001900390816101305790505b50915060005b8181101561020d5730868683818110610166576101666108bf565b905060200281019061017891906108d5565b604051610186929190610923565b600060405180830381855af49150503d80600081146101c1576040519150601f19603f3d011682016040523d82523d6000602084013e6101c6565b606091505b508583815181106101d9576101d96108bf565b602002602001018584815181106101f2576101f26108bf565b6020908102919091010191909152901515905260010161014b565b50509250929050565b6060331561026b5760405162461bcd60e51b815260206004820152601760248201527f53656e6465722061646472657373206e6f74207a65726f00000000000000000060448201526064015b60405180910390fd5b3a156102b95760405162461bcd60e51b815260206004820152601560248201527f547820676173207072696365206e6f74207a65726f00000000000000000000006044820152606401610262565b6102c3838361044b565b9392505050565b6060818067ffffffffffffffff8111156102e6576102e66107a6565b60405190808252806020026020018201604052801561031957816020015b60608152602001906001900390816103045790505b50915060005b818110156104435760003086868481811061033c5761033c6108bf565b905060200281019061034e91906108d5565b60405161035c929190610923565b600060405180830381855af49150503d8060008114610397576040519150601f19603f3d011682016040523d82523d6000602084013e61039c565b606091505b508584815181106103af576103af6108bf565b602090810291909101015290508061043a5760008483815181106103d5576103d56108bf565b602002602001015190506000815111156103f25780518082602001fd5b60405162461bcd60e51b815260206004820152601b60248201527f4d756c746963616c6c3a204e6f2072657665727420737472696e6700000000006044820152606401610262565b5060010161031f565b505092915050565b60606102c3838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c656400008152506060824710156105025760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610262565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161052b9190610933565b60006040518083038185875af1925050503d8060008114610568576040519150601f19603f3d011682016040523d82523d6000602084013e61056d565b606091505b509150915061057e8783838761058b565b925050505b949350505050565b606083156106075782516000036106005773ffffffffffffffffffffffffffffffffffffffff85163b6106005760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610262565b5081610583565b610583838381511561061c5781518083602001fd5b8060405162461bcd60e51b81526004016102629190610899565b6000806020838503121561064957600080fd5b823567ffffffffffffffff8082111561066157600080fd5b818501915085601f83011261067557600080fd5b81358181111561068457600080fd5b8660208260051b850101111561069957600080fd5b60209290920196919550909350505050565b60005b838110156106c65781810151838201526020016106ae565b50506000910152565b600081518084526106e78160208601602086016106ab565b601f01601f19169290920160200192915050565b6000815180845260208085019450848260051b860182860160005b8581101561074057838303895261072e8383516106cf565b98850198925090840190600101610716565b5090979650505050505050565b604080825283519082018190526000906020906060840190828701845b8281101561078857815115158452928401929084019060010161076a565b5050508381038285015261079c81866106fb565b9695505050505050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156107cf57600080fd5b823573ffffffffffffffffffffffffffffffffffffffff811681146107f357600080fd5b9150602083013567ffffffffffffffff8082111561081057600080fd5b818501915085601f83011261082457600080fd5b813581811115610836576108366107a6565b604051601f8201601f19908116603f0116810190838211818310171561085e5761085e6107a6565b8160405282815288602084870101111561087757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6020815260006102c360208301846106cf565b6020815260006102c360208301846106fb565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126108ec57600080fd5b83018035915067ffffffffffffffff82111561090757600080fd5b60200191503681900382131561091c57600080fd5b9250929050565b8183823760009101908152919050565b600082516109458184602087016106ab565b919091019291505056fea2646970667358221220fb75d29fed8c3df8cc65fe0d3dc29549df89db33cd475cb87f46b57462c17d8864736f6c63430008110033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063437b911614610046578063a0b5ffb014610070578063ac9650d814610090575b600080fd5b610059610054366004610636565b6100b0565b60405161006792919061074d565b60405180910390f35b61008361007e3660046107bc565b610216565b6040516100679190610899565b6100a361009e366004610636565b6102ca565b60405161006791906108ac565b606080828067ffffffffffffffff8111156100cd576100cd6107a6565b6040519080825280602002602001820160405280156100f6578160200160208202803683370190505b5092508067ffffffffffffffff811115610112576101126107a6565b60405190808252806020026020018201604052801561014557816020015b60608152602001906001900390816101305790505b50915060005b8181101561020d5730868683818110610166576101666108bf565b905060200281019061017891906108d5565b604051610186929190610923565b600060405180830381855af49150503d80600081146101c1576040519150601f19603f3d011682016040523d82523d6000602084013e6101c6565b606091505b508583815181106101d9576101d96108bf565b602002602001018584815181106101f2576101f26108bf565b6020908102919091010191909152901515905260010161014b565b50509250929050565b6060331561026b5760405162461bcd60e51b815260206004820152601760248201527f53656e6465722061646472657373206e6f74207a65726f00000000000000000060448201526064015b60405180910390fd5b3a156102b95760405162461bcd60e51b815260206004820152601560248201527f547820676173207072696365206e6f74207a65726f00000000000000000000006044820152606401610262565b6102c3838361044b565b9392505050565b6060818067ffffffffffffffff8111156102e6576102e66107a6565b60405190808252806020026020018201604052801561031957816020015b60608152602001906001900390816103045790505b50915060005b818110156104435760003086868481811061033c5761033c6108bf565b905060200281019061034e91906108d5565b60405161035c929190610923565b600060405180830381855af49150503d8060008114610397576040519150601f19603f3d011682016040523d82523d6000602084013e61039c565b606091505b508584815181106103af576103af6108bf565b602090810291909101015290508061043a5760008483815181106103d5576103d56108bf565b602002602001015190506000815111156103f25780518082602001fd5b60405162461bcd60e51b815260206004820152601b60248201527f4d756c746963616c6c3a204e6f2072657665727420737472696e6700000000006044820152606401610262565b5060010161031f565b505092915050565b60606102c3838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c656400008152506060824710156105025760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610262565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161052b9190610933565b60006040518083038185875af1925050503d8060008114610568576040519150601f19603f3d011682016040523d82523d6000602084013e61056d565b606091505b509150915061057e8783838761058b565b925050505b949350505050565b606083156106075782516000036106005773ffffffffffffffffffffffffffffffffffffffff85163b6106005760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610262565b5081610583565b610583838381511561061c5781518083602001fd5b8060405162461bcd60e51b81526004016102629190610899565b6000806020838503121561064957600080fd5b823567ffffffffffffffff8082111561066157600080fd5b818501915085601f83011261067557600080fd5b81358181111561068457600080fd5b8660208260051b850101111561069957600080fd5b60209290920196919550909350505050565b60005b838110156106c65781810151838201526020016106ae565b50506000910152565b600081518084526106e78160208601602086016106ab565b601f01601f19169290920160200192915050565b6000815180845260208085019450848260051b860182860160005b8581101561074057838303895261072e8383516106cf565b98850198925090840190600101610716565b5090979650505050505050565b604080825283519082018190526000906020906060840190828701845b8281101561078857815115158452928401929084019060010161076a565b5050508381038285015261079c81866106fb565b9695505050505050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156107cf57600080fd5b823573ffffffffffffffffffffffffffffffffffffffff811681146107f357600080fd5b9150602083013567ffffffffffffffff8082111561081057600080fd5b818501915085601f83011261082457600080fd5b813581811115610836576108366107a6565b604051601f8201601f19908116603f0116810190838211818310171561085e5761085e6107a6565b8160405282815288602084870101111561087757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6020815260006102c360208301846106cf565b6020815260006102c360208301846106fb565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126108ec57600080fd5b83018035915067ffffffffffffffff82111561090757600080fd5b60200191503681900382131561091c57600080fd5b9250929050565b8183823760009101908152919050565b600082516109458184602087016106ab565b919091019291505056fea2646970667358221220fb75d29fed8c3df8cc65fe0d3dc29549df89db33cd475cb87f46b57462c17d8864736f6c63430008110033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.