Overview
S Balance
0 S
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
MulticallRouter
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 2000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@uniswap/lib/contracts/libraries/TransferHelper.sol"; import "../utils/RevertMessageParser.sol"; /** * @title A contract that implements the chain of the calls on different contracts * @dev All function calls are currently implemented without side effects */ contract MulticallRouter is Context { /** * @notice Implements a chain of external calls * @param _amountIn input amount * @param _calldata array of encoded methods * @param _receiveSides array of contracts on which methods executions will take place * @param _path path of tokens * @param _offset array of shifts to patch the amount to calldata * @param _to address to send the dest token */ function multicall( uint256 _amountIn, bytes[] memory _calldata, address[] memory _receiveSides, address[] memory _path, uint256[] memory _offset, address _to ) external { TransferHelper.safeTransferFrom(_path[0], _msgSender(), address(this), _amountIn); for (uint256 i = 0; i < _calldata.length; i++) { uint256 currentAmountIn = IERC20(_path[i]).balanceOf(address(this)); bytes memory currentCalldata = _calldata[i]; uint256 offset = _offset[i]; assembly { mstore(add(currentCalldata, offset), currentAmountIn) } _lazyApprove(_path[i], _receiveSides[i], currentAmountIn); (bool success, bytes memory data) = _receiveSides[i].call(currentCalldata); if (!success) { revert(RevertMessageParser.getRevertMessage(data, "MulticallRouter: call failed")); } } uint256 finalAmountOut = IERC20(_path[_path.length - 1]).balanceOf(address(this)); if (finalAmountOut != 0) { TransferHelper.safeTransfer(_path[_path.length - 1], _to, finalAmountOut); } } /** * @notice Implements approve * @dev Internal function used to approve the token spending * @param _token token address * @param _to address to approve * @param _amount amount for which approve will be given */ function _lazyApprove(address _token, address _to, uint256 _amount) internal { if (IERC20(_token).allowance(address(this), _to) < _amount) { TransferHelper.safeApprove(_token, _to, type(uint256).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.0; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; library RevertMessageParser { function getRevertMessage(bytes memory _data, string memory _defaultMessage) internal pure returns (string memory) { // If the _data length is less than 68, then the transaction failed silently (without a revert message) if (_data.length < 68) return _defaultMessage; assembly { // Slice the sighash _data := add(_data, 0x04) } return abi.decode(_data, (string)); } }
{ "viaIR": true, "optimizer": { "enabled": true, "runs": 2000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"bytes[]","name":"_calldata","type":"bytes[]"},{"internalType":"address[]","name":"_receiveSides","type":"address[]"},{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"uint256[]","name":"_offset","type":"uint256[]"},{"internalType":"address","name":"_to","type":"address"}],"name":"multicall","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080806040523461001657610b48908161001c8239f35b600080fdfe608060405260048036101561001357600080fd5b600090813560e01c631e859a051461002a57600080fd5b346100e25760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100e25767ffffffffffffffff906024358281116100de5761007a9036908301610174565b6044358381116100da576100919036908401610249565b6064358481116100d6576100a89036908501610249565b906084359485116100d6576100c36100d395369086016102b7565b926100cc610233565b943561046e565b80f35b8580fd5b8480fd5b8380fd5b5080fd5b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff82111761011857604052565b6100e6565b90601f601f19910116810190811067ffffffffffffffff82111761011857604052565b67ffffffffffffffff81116101185760051b60200190565b67ffffffffffffffff811161011857601f01601f191660200190565b9080601f8301121561022e5781359161018c83610140565b9260409061019c8251958661011d565b808552602093848087019260051b8501019381851161022e57858101925b8584106101cb575050505050505090565b833567ffffffffffffffff811161022e57820183603f8201121561022e5787810135916101f783610158565b6102038851918261011d565b8381528588858501011161022e5760008a8581968b83970183860137830101528152019301926101ba565b600080fd5b60a435906001600160a01b038216820361022e57565b81601f8201121561022e5780359161026083610140565b9261026e604051948561011d565b808452602092838086019260051b82010192831161022e578301905b828210610298575050505090565b81356001600160a01b038116810361022e57815290830190830161028a565b81601f8201121561022e578035916102ce83610140565b926102dc604051948561011d565b808452602092838086019260051b82010192831161022e578301905b828210610306575050505090565b813581529083019083016102f8565b634e487b7160e01b600052603260045260246000fd5b8051156103385760200190565b610315565b80518210156103385760209160051b010190565b634e487b7160e01b600052601160045260246000fd5b60001981146103765760010190565b610351565b9081602091031261022e575190565b6040513d6000823e3d90fd5b3d156103c1573d906103a782610158565b916103b5604051938461011d565b82523d6000602084013e565b606090565b604051906040820182811067ffffffffffffffff82111761011857604052601c82527f4d756c746963616c6c526f757465723a2063616c6c206661696c6564000000006020830152565b60005b8381106104235750506000910152565b8181015183820152602001610413565b601f19601f604093602084526104588151809281602088015260208888019101610410565b0116010190565b90600019820191821161037657565b61049b90969196949392946104926104858561032b565b516001600160a01b031690565b309033906107ee565b60005b8651811015610609576104c66104ba6104ba610485848761033d565b6001600160a01b031690565b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048083019190915291926020908190839060249082905afa918215610604576000926105d5575b50610521858c61033d565b51918061052e878b61033d565b5184015261053c868961033d565b516001600160a01b031690610551878c61033d565b516001600160a01b0316610564926108fe565b61056e858a61033d565b516001600160a01b03169082519201915a9260008094938194f1610590610396565b90156105a7575050506105a290610367565b61049e565b6105bc6105d1916105b66103c6565b90610a8d565b925192839262461bcd60e51b84528301610433565b0390fd5b816105f69293503d84116105fd575b6105ee818361011d565b81019061037b565b9038610516565b503d6105e4565b61038a565b5094509291505061062c6104ba6104ba610485610626865161045f565b8661033d565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529190602090839060249082905afa918215610604576000926106a1575b508161068057505050565b61069a6104858461069461069f965161045f565b9061033d565b6106d9565b565b6106ba91925060203d81116105fd576105ee818361011d565b9038610675565b9081602091031261022e5751801515810361022e5790565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082019081526001600160a01b0390931660248201526044810193909352600092839290839061073b81606481015b03601f19810183528261011d565b51925af1610747610396565b816107bf575b501561075557565b608460405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c6564000000000000000000000000000000000000006064820152fd5b80518015925082156107d4575b50503861074d565b6107e792506020809183010191016106c1565b38806107cc565b9091600080949381946040519160208301947f23b872dd0000000000000000000000000000000000000000000000000000000086526001600160a01b03809216602485015216604483015260648201526064815261084b816100fc565b51925af1610857610396565b816108cf575b501561086557565b608460405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c65640000000000000000000000000000006064820152fd5b80518015925082156108e4575b50503861085d565b6108f792506020809183010191016106c1565b38806108dc565b90604051927fdd62ed3e000000000000000000000000000000000000000000000000000000008452306004850152836001600160a01b038084166024830152816044602097889388165afa90811561060457600091610a70575b501061096357505050565b6000918291826040516109bb8161072d898201957f095ea7b3000000000000000000000000000000000000000000000000000000008752602483016020600019919392936001600160a01b0360408201951681520152565b51925af16109c7610396565b81610a40575b50156109d65750565b6084906040519062461bcd60e51b82526004820152602b60248201527f5472616e7366657248656c7065723a3a73616665417070726f76653a2061707060448201527f726f7665206661696c65640000000000000000000000000000000000000000006064820152fd5b80518015925083908315610a58575b505050386109cd565b610a6893508201810191016106c1565b388281610a4f565b610a879150853d87116105fd576105ee818361011d565b38610958565b906044825110610b0d575060048101518101906020816024840193031261022e5760248101519067ffffffffffffffff821161022e57018160438201121561022e576024810151610add81610158565b92610aeb604051948561011d565b8184526044828401011161022e57610b0a916044602085019101610410565b90565b90509056fea2646970667358221220699985bae1a42976334fa1a864a14754f2dfe9a6584943fc0e3fa721f1651b3664736f6c63430008130033
Deployed Bytecode
0x608060405260048036101561001357600080fd5b600090813560e01c631e859a051461002a57600080fd5b346100e25760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100e25767ffffffffffffffff906024358281116100de5761007a9036908301610174565b6044358381116100da576100919036908401610249565b6064358481116100d6576100a89036908501610249565b906084359485116100d6576100c36100d395369086016102b7565b926100cc610233565b943561046e565b80f35b8580fd5b8480fd5b8380fd5b5080fd5b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff82111761011857604052565b6100e6565b90601f601f19910116810190811067ffffffffffffffff82111761011857604052565b67ffffffffffffffff81116101185760051b60200190565b67ffffffffffffffff811161011857601f01601f191660200190565b9080601f8301121561022e5781359161018c83610140565b9260409061019c8251958661011d565b808552602093848087019260051b8501019381851161022e57858101925b8584106101cb575050505050505090565b833567ffffffffffffffff811161022e57820183603f8201121561022e5787810135916101f783610158565b6102038851918261011d565b8381528588858501011161022e5760008a8581968b83970183860137830101528152019301926101ba565b600080fd5b60a435906001600160a01b038216820361022e57565b81601f8201121561022e5780359161026083610140565b9261026e604051948561011d565b808452602092838086019260051b82010192831161022e578301905b828210610298575050505090565b81356001600160a01b038116810361022e57815290830190830161028a565b81601f8201121561022e578035916102ce83610140565b926102dc604051948561011d565b808452602092838086019260051b82010192831161022e578301905b828210610306575050505090565b813581529083019083016102f8565b634e487b7160e01b600052603260045260246000fd5b8051156103385760200190565b610315565b80518210156103385760209160051b010190565b634e487b7160e01b600052601160045260246000fd5b60001981146103765760010190565b610351565b9081602091031261022e575190565b6040513d6000823e3d90fd5b3d156103c1573d906103a782610158565b916103b5604051938461011d565b82523d6000602084013e565b606090565b604051906040820182811067ffffffffffffffff82111761011857604052601c82527f4d756c746963616c6c526f757465723a2063616c6c206661696c6564000000006020830152565b60005b8381106104235750506000910152565b8181015183820152602001610413565b601f19601f604093602084526104588151809281602088015260208888019101610410565b0116010190565b90600019820191821161037657565b61049b90969196949392946104926104858561032b565b516001600160a01b031690565b309033906107ee565b60005b8651811015610609576104c66104ba6104ba610485848761033d565b6001600160a01b031690565b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048083019190915291926020908190839060249082905afa918215610604576000926105d5575b50610521858c61033d565b51918061052e878b61033d565b5184015261053c868961033d565b516001600160a01b031690610551878c61033d565b516001600160a01b0316610564926108fe565b61056e858a61033d565b516001600160a01b03169082519201915a9260008094938194f1610590610396565b90156105a7575050506105a290610367565b61049e565b6105bc6105d1916105b66103c6565b90610a8d565b925192839262461bcd60e51b84528301610433565b0390fd5b816105f69293503d84116105fd575b6105ee818361011d565b81019061037b565b9038610516565b503d6105e4565b61038a565b5094509291505061062c6104ba6104ba610485610626865161045f565b8661033d565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529190602090839060249082905afa918215610604576000926106a1575b508161068057505050565b61069a6104858461069461069f965161045f565b9061033d565b6106d9565b565b6106ba91925060203d81116105fd576105ee818361011d565b9038610675565b9081602091031261022e5751801515810361022e5790565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082019081526001600160a01b0390931660248201526044810193909352600092839290839061073b81606481015b03601f19810183528261011d565b51925af1610747610396565b816107bf575b501561075557565b608460405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c6564000000000000000000000000000000000000006064820152fd5b80518015925082156107d4575b50503861074d565b6107e792506020809183010191016106c1565b38806107cc565b9091600080949381946040519160208301947f23b872dd0000000000000000000000000000000000000000000000000000000086526001600160a01b03809216602485015216604483015260648201526064815261084b816100fc565b51925af1610857610396565b816108cf575b501561086557565b608460405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c65640000000000000000000000000000006064820152fd5b80518015925082156108e4575b50503861085d565b6108f792506020809183010191016106c1565b38806108dc565b90604051927fdd62ed3e000000000000000000000000000000000000000000000000000000008452306004850152836001600160a01b038084166024830152816044602097889388165afa90811561060457600091610a70575b501061096357505050565b6000918291826040516109bb8161072d898201957f095ea7b3000000000000000000000000000000000000000000000000000000008752602483016020600019919392936001600160a01b0360408201951681520152565b51925af16109c7610396565b81610a40575b50156109d65750565b6084906040519062461bcd60e51b82526004820152602b60248201527f5472616e7366657248656c7065723a3a73616665417070726f76653a2061707060448201527f726f7665206661696c65640000000000000000000000000000000000000000006064820152fd5b80518015925083908315610a58575b505050386109cd565b610a6893508201810191016106c1565b388281610a4f565b610a879150853d87116105fd576105ee818361011d565b38610958565b906044825110610b0d575060048101518101906020816024840193031261022e5760248101519067ffffffffffffffff821161022e57018160438201121561022e576024810151610add81610158565b92610aeb604051948561011d565b8184526044828401011161022e57610b0a916044602085019101610410565b90565b90509056fea2646970667358221220699985bae1a42976334fa1a864a14754f2dfe9a6584943fc0e3fa721f1651b3664736f6c63430008130033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
LINEA | 18.54% | $3,320.21 | 35.3384 | $117,330.9 | |
LINEA | 7.25% | $0.999998 | 45,876.0978 | $45,876.01 | |
LINEA | 1.30% | $0.098884 | 83,020.3519 | $8,209.38 | |
MANTLE | 17.49% | $0.999104 | 110,773.4534 | $110,674.2 | |
MANTLE | 4.55% | $3,297.66 | 8.7393 | $28,819.25 | |
ZKEVM | 12.45% | $1 | 78,783.4633 | $78,785.44 | |
ZKEVM | 6.76% | $3,304.83 | 12.947 | $42,787.66 | |
OP | 9.35% | $3,304.83 | 17.9022 | $59,163.82 | |
OP | 7.46% | $1 | 47,237.8365 | $47,237.84 | |
FRAXTAL | 8.74% | $0.996403 | 55,484.3148 | $55,284.75 | |
ARBNOVA | 4.31% | $1 | 27,247.315 | $27,247.32 | |
ARBNOVA | 1.73% | $3,304.81 | 3.3165 | $10,960.51 | |
AVAX | 0.07% | $0.999958 | 448.26 | $448.24 |
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.