More Info
Private Name Tags
ContractCreator
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
8566561 | 11 mins ago | 4.80224111 GLMR | ||||
8566561 | 11 mins ago | 4.80224111 GLMR | ||||
8565906 | 1 hr ago | 2.00577592 GLMR | ||||
8565906 | 1 hr ago | 2.00577592 GLMR | ||||
8565652 | 1 hr ago | 14,460.38398724 GLMR | ||||
8565652 | 1 hr ago | 14,460.38398724 GLMR | ||||
8565485 | 2 hrs ago | 3,092.32216014 GLMR | ||||
8565485 | 2 hrs ago | 3,092.32216014 GLMR | ||||
8565434 | 2 hrs ago | 201.9300135 GLMR | ||||
8565434 | 2 hrs ago | 201.9300135 GLMR | ||||
8565300 | 2 hrs ago | 1,185 GLMR | ||||
8565300 | 2 hrs ago | 1,185 GLMR | ||||
8565018 | 2 hrs ago | 3,117.42010628 GLMR | ||||
8565018 | 2 hrs ago | 3,117.42010628 GLMR | ||||
8564074 | 4 hrs ago | 18.60535286 GLMR | ||||
8564074 | 4 hrs ago | 18.60535286 GLMR | ||||
8563878 | 4 hrs ago | 0.42595549 GLMR | ||||
8563878 | 4 hrs ago | 0.42595549 GLMR | ||||
8563226 | 5 hrs ago | 101 GLMR | ||||
8563226 | 5 hrs ago | 101 GLMR | ||||
8562779 | 6 hrs ago | 35 GLMR | ||||
8562779 | 6 hrs ago | 35 GLMR | ||||
8561929 | 8 hrs ago | 6,280 GLMR | ||||
8561929 | 8 hrs ago | 6,280 GLMR | ||||
8561906 | 8 hrs ago | 5,000 GLMR |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
SquidMulticall
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 99999 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {ISquidMulticall} from "../interfaces/ISquidMulticall.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; contract SquidMulticall is ISquidMulticall, IERC721Receiver, IERC1155Receiver { using SafeERC20 for IERC20; bytes4 private constant ERC165_INTERFACE_ID = 0x01ffc9a7; bytes4 private constant ERC721_TOKENRECEIVER_INTERFACE_ID = 0x150b7a02; bytes4 private constant ERC1155_TOKENRECEIVER_INTERFACE_ID = 0x4e2312e0; /// @inheritdoc ISquidMulticall function run(Call[] calldata calls) external payable { for (uint256 i = 0; i < calls.length; i++) { Call memory call = calls[i]; if (call.callType == CallType.FullTokenBalance) { (address token, uint256 amountParameterPosition) = abi.decode( call.payload, (address, uint256) ); uint256 amount = IERC20(token).balanceOf(address(this)); // Deduct 1 from amount to keep hot balances and reduce gas cost if (amount > 0) { // Cannot underflow because amount > 0 unchecked { amount -= 1; } } _setCallDataParameter(call.callData, amountParameterPosition, amount); } else if (call.callType == CallType.FullNativeBalance) { call.value = address(this).balance; } else if (call.callType == CallType.CollectTokenBalance) { address token = abi.decode(call.payload, (address)); uint256 senderBalance = IERC20(token).balanceOf(msg.sender); IERC20(token).safeTransferFrom(msg.sender, address(this), senderBalance); continue; } (bool success, bytes memory data) = call.target.call{value: call.value}(call.callData); if (!success) revert CallFailed(i, data); } } function _setCallDataParameter( bytes memory callData, uint256 parameterPosition, uint256 value ) private pure { assembly { // 36 bytes shift because 32 for prefix + 4 for selector mstore(add(callData, add(36, mul(parameterPosition, 32))), value) } } /// @notice Implementation required by ERC165 for NFT reception. /// See https://eips.ethereum.org/EIPS/eip-165. function supportsInterface(bytes4 interfaceId) external pure returns (bool) { return interfaceId == ERC1155_TOKENRECEIVER_INTERFACE_ID || interfaceId == ERC721_TOKENRECEIVER_INTERFACE_ID || interfaceId == ERC165_INTERFACE_ID; } /// @notice Implementation required by ERC721 for NFT reception. /// See https://eips.ethereum.org/EIPS/eip-721. function onERC721Received( address, address, uint256, bytes calldata ) external pure returns (bytes4) { return IERC721Receiver.onERC721Received.selector; } /// @notice Implementation required by ERC1155 for NFT reception. /// See https://eips.ethereum.org/EIPS/eip-1155. function onERC1155Received( address, address, uint256, uint256, bytes calldata ) external pure returns (bytes4) { return IERC1155Receiver.onERC1155Received.selector; } /// @notice Implementation required by ERC1155 for NFT reception. /// See https://eips.ethereum.org/EIPS/eip-1155. function onERC1155BatchReceived( address, address, uint256[] calldata, uint256[] calldata, bytes calldata ) external pure returns (bytes4) { return IERC1155Receiver.onERC1155BatchReceived.selector; } /// @dev Enable native tokens reception with .transfer or .send receive() external payable {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// 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); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /// @title SquidMulticall /// @notice Multicall logic specific to Squid calls format. The contract specificity is mainly /// to enable ERC20 and native token amounts in calldata between two calls. /// @dev Support receiption of NFTs. interface ISquidMulticall { /// @notice Call type that enables to specific behaviours of the multicall. enum CallType { // Will simply run calldata Default, // Will update amount field in calldata with ERC20 token balance of the multicall contract. FullTokenBalance, // Will update amount field in calldata with native token balance of the multicall contract. FullNativeBalance, // Will run a safeTransferFrom to get full ERC20 token balance of the caller. CollectTokenBalance } /// @notice Calldata format expected by multicall. struct Call { // Call type, see CallType struct description. CallType callType; // Address that will be called. address target; // Native token amount that will be sent in call. uint256 value; // Calldata that will be send in call. bytes callData; // Extra data used by multicall depending on call type. // Default: unused (provide 0x) // FullTokenBalance: address of the ERC20 token to get balance of and zero indexed position // of the amount parameter to update in function call contained by calldata. // Expect format is: abi.encode(address token, uint256 amountParameterPosition) // Eg: for function swap(address tokenIn, uint amountIn, address tokenOut, uint amountOutMin,) // amountParameterPosition would be 1. // FullNativeBalance: unused (provide 0x) // CollectTokenBalance: address of the ERC20 token to collect. // Expect format is: abi.encode(address token) bytes payload; } /// Thrown when one of the calls fails. /// @param callPosition Zero indexed position of the call in the call set provided to the /// multicall. /// @param reason Revert data returned by contract called in failing call. error CallFailed(uint256 callPosition, bytes reason); /// @notice Main function of the multicall that runs the call set. /// @param calls Call set to be ran by multicall. function run(Call[] calldata calls) external payable; }
{ "optimizer": { "enabled": true, "runs": 99999 }, "viaIR": true, "evmVersion": "paris", "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":"callPosition","type":"uint256"},{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"CallFailed","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"enum ISquidMulticall.CallType","name":"callType","type":"uint8"},{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"payload","type":"bytes"}],"internalType":"struct ISquidMulticall.Call[]","name":"calls","type":"tuple[]"}],"name":"run","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080806040523461001657610d14908161001c8239f35b600080fdfe6080604052600436101561001b575b361561001957600080fd5b005b6000803560e01c90816301ffc9a71461006e57508063150b7a0214610069578063bc197c8114610064578063f23a6e611461005f5763f87ef8000361000e57610400565b61036f565b6102a8565b6101e6565b346101855760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018557600435907fffffffff000000000000000000000000000000000000000000000000000000008216809203610185577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061012c7f4e2312e000000000000000000000000000000000000000000000000000000000841484811561015b575b8115610131575b50151560805260a090565b016080f35b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501483610121565b7f150b7a02000000000000000000000000000000000000000000000000000000008114915061011a565b80fd5b73ffffffffffffffffffffffffffffffffffffffff8116036101a657565b600080fd5b35906101b682610188565b565b9181601f840112156101a65782359167ffffffffffffffff83116101a657602083818601950101116101a657565b346101a65760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a657610220600435610188565b61022b602435610188565b60643567ffffffffffffffff81116101a65761024b9036906004016101b8565b505060206040517f150b7a02000000000000000000000000000000000000000000000000000000008152f35b9181601f840112156101a65782359167ffffffffffffffff83116101a6576020808501948460051b0101116101a657565b346101a65760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576102e2600435610188565b6102ed602435610188565b67ffffffffffffffff6044358181116101a65761030e903690600401610277565b50506064358181116101a657610328903690600401610277565b50506084359081116101a6576103429036906004016101b8565b50506040517fbc197c81000000000000000000000000000000000000000000000000000000008152602090f35b346101a65760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576103a9600435610188565b6103b4602435610188565b60843567ffffffffffffffff81116101a6576103d49036906004016101b8565b505060206040517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b6020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576004803567ffffffffffffffff81116101a65761044c903690600401610277565b929060005b84811061045a57005b61046d61046882878561072f565b6108cc565b6001815161047a81610954565b61048381610954565b036106225761049e60808201518580825183010191016109c0565b8560405180937f70a082310000000000000000000000000000000000000000000000000000000082528173ffffffffffffffffffffffffffffffffffffffff816105088d3090830191909173ffffffffffffffffffffffffffffffffffffffff6020820193169052565b0392165afa90811561061d57610539926000926105ee575b5081806105c4575b50606084015160249160051b010152565b60008061055c8684015173ffffffffffffffffffffffffffffffffffffffff1690565b92604093606085830151920151918883519301915af19061057b6109df565b911561058d5750506001905b01610451565b517f5c0dee5d0000000000000000000000000000000000000000000000000000000081529182916105c091838801610a6d565b0390fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01915038610528565b61060f919250873d8911610616575b610607818361080a565b8101906109a5565b9038610520565b503d6105fd565b6109b4565b6002815161062f81610954565b61063881610954565b0361064857476040820152610539565b6003815161065581610954565b61065e81610954565b036105395761067f61067f608061069893015186808251830101910161098d565b73ffffffffffffffffffffffffffffffffffffffff1690565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815233868201908152919291859082908190602001038173ffffffffffffffffffffffffffffffffffffffff87165afa801561061d5760019361070b92600092610710575b5030903390610a84565b610587565b610728919250873d891161061657610607818361080a565b9038610701565b919081101561076f5760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61813603018212156101a6570190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176107e957604052565b61079e565b6040810190811067ffffffffffffffff8211176107e957604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176107e957604052565b67ffffffffffffffff81116107e957601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f820112156101a65780359061089c8261084b565b926108aa604051948561080a565b828452602083830101116101a657816000926020809301838601378301015290565b60a0813603126101a657604051906108e3826107cd565b803560048110156101a65782526108fc602082016101ab565b60208301526040810135604083015260608101359067ffffffffffffffff918281116101a65761092f9036908301610885565b606084015260808101359182116101a65761094c91369101610885565b608082015290565b6004111561095e57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b908160209103126101a657516109a281610188565b90565b908160209103126101a6575190565b6040513d6000823e3d90fd5b91908260409103126101a657602082516109d981610188565b92015190565b3d15610a0a573d906109f08261084b565b916109fe604051938461080a565b82523d6000602084013e565b606090565b919082519283825260005b848110610a595750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201610a1a565b6040906109a2939281528160208201520190610a0f565b91610b41929391936040519260208401957f23b872dd00000000000000000000000000000000000000000000000000000000875273ffffffffffffffffffffffffffffffffffffffff93848092166024870152166044850152606484015260648352610aef836107cd565b1660405191610afd836107ee565b602083527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646020840152600080958192519082855af1610b3b6109df565b91610c12565b8051908115918215610b5a575b50506101b69150610b87565b8192509060209181010312610b83576020015190811515820361018557506101b6903880610b4e565b5080fd5b15610b8e57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b91929015610c8d5750815115610c26575090565b3b15610c2f5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b825190915015610ca05750805190602001fd5b6105c0906040519182917f08c379a0000000000000000000000000000000000000000000000000000000008352602060048401526024830190610a0f56fea2646970667358221220c5436f06d1e050a95cb7829ce861e76b73c682bf34087a8a82c7942f6559776e64736f6c63430008170033
Deployed Bytecode
0x6080604052600436101561001b575b361561001957600080fd5b005b6000803560e01c90816301ffc9a71461006e57508063150b7a0214610069578063bc197c8114610064578063f23a6e611461005f5763f87ef8000361000e57610400565b61036f565b6102a8565b6101e6565b346101855760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018557600435907fffffffff000000000000000000000000000000000000000000000000000000008216809203610185577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061012c7f4e2312e000000000000000000000000000000000000000000000000000000000841484811561015b575b8115610131575b50151560805260a090565b016080f35b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501483610121565b7f150b7a02000000000000000000000000000000000000000000000000000000008114915061011a565b80fd5b73ffffffffffffffffffffffffffffffffffffffff8116036101a657565b600080fd5b35906101b682610188565b565b9181601f840112156101a65782359167ffffffffffffffff83116101a657602083818601950101116101a657565b346101a65760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a657610220600435610188565b61022b602435610188565b60643567ffffffffffffffff81116101a65761024b9036906004016101b8565b505060206040517f150b7a02000000000000000000000000000000000000000000000000000000008152f35b9181601f840112156101a65782359167ffffffffffffffff83116101a6576020808501948460051b0101116101a657565b346101a65760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576102e2600435610188565b6102ed602435610188565b67ffffffffffffffff6044358181116101a65761030e903690600401610277565b50506064358181116101a657610328903690600401610277565b50506084359081116101a6576103429036906004016101b8565b50506040517fbc197c81000000000000000000000000000000000000000000000000000000008152602090f35b346101a65760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576103a9600435610188565b6103b4602435610188565b60843567ffffffffffffffff81116101a6576103d49036906004016101b8565b505060206040517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b6020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576004803567ffffffffffffffff81116101a65761044c903690600401610277565b929060005b84811061045a57005b61046d61046882878561072f565b6108cc565b6001815161047a81610954565b61048381610954565b036106225761049e60808201518580825183010191016109c0565b8560405180937f70a082310000000000000000000000000000000000000000000000000000000082528173ffffffffffffffffffffffffffffffffffffffff816105088d3090830191909173ffffffffffffffffffffffffffffffffffffffff6020820193169052565b0392165afa90811561061d57610539926000926105ee575b5081806105c4575b50606084015160249160051b010152565b60008061055c8684015173ffffffffffffffffffffffffffffffffffffffff1690565b92604093606085830151920151918883519301915af19061057b6109df565b911561058d5750506001905b01610451565b517f5c0dee5d0000000000000000000000000000000000000000000000000000000081529182916105c091838801610a6d565b0390fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01915038610528565b61060f919250873d8911610616575b610607818361080a565b8101906109a5565b9038610520565b503d6105fd565b6109b4565b6002815161062f81610954565b61063881610954565b0361064857476040820152610539565b6003815161065581610954565b61065e81610954565b036105395761067f61067f608061069893015186808251830101910161098d565b73ffffffffffffffffffffffffffffffffffffffff1690565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815233868201908152919291859082908190602001038173ffffffffffffffffffffffffffffffffffffffff87165afa801561061d5760019361070b92600092610710575b5030903390610a84565b610587565b610728919250873d891161061657610607818361080a565b9038610701565b919081101561076f5760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61813603018212156101a6570190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176107e957604052565b61079e565b6040810190811067ffffffffffffffff8211176107e957604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176107e957604052565b67ffffffffffffffff81116107e957601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f820112156101a65780359061089c8261084b565b926108aa604051948561080a565b828452602083830101116101a657816000926020809301838601378301015290565b60a0813603126101a657604051906108e3826107cd565b803560048110156101a65782526108fc602082016101ab565b60208301526040810135604083015260608101359067ffffffffffffffff918281116101a65761092f9036908301610885565b606084015260808101359182116101a65761094c91369101610885565b608082015290565b6004111561095e57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b908160209103126101a657516109a281610188565b90565b908160209103126101a6575190565b6040513d6000823e3d90fd5b91908260409103126101a657602082516109d981610188565b92015190565b3d15610a0a573d906109f08261084b565b916109fe604051938461080a565b82523d6000602084013e565b606090565b919082519283825260005b848110610a595750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201610a1a565b6040906109a2939281528160208201520190610a0f565b91610b41929391936040519260208401957f23b872dd00000000000000000000000000000000000000000000000000000000875273ffffffffffffffffffffffffffffffffffffffff93848092166024870152166044850152606484015260648352610aef836107cd565b1660405191610afd836107ee565b602083527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646020840152600080958192519082855af1610b3b6109df565b91610c12565b8051908115918215610b5a575b50506101b69150610b87565b8192509060209181010312610b83576020015190811515820361018557506101b6903880610b4e565b5080fd5b15610b8e57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b91929015610c8d5750815115610c26575090565b3b15610c2f5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b825190915015610ca05750805190602001fd5b6105c0906040519182917f08c379a0000000000000000000000000000000000000000000000000000000008352602060048401526024830190610a0f56fea2646970667358221220c5436f06d1e050a95cb7829ce861e76b73c682bf34087a8a82c7942f6559776e64736f6c63430008170033
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.