Discover more of Apescan's tools and services in one place.
Contract Source Code:
File 1 of 3 : GNSMulticall.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import "../../interfaces/IMulticall.sol"; import "../../interfaces/IGeneralErrors.sol"; /** * @dev Facet #12: Multicall */ contract GNSMulticall is IMulticall { /// @inheritdoc IMulticall /// @dev NEVER make this function `payable`! delegatecall forwards msg.value to all calls regardless of it being spent or not function multicall(bytes[] calldata data) external returns (bytes[] memory results) { if (data.length > 20) { revert IGeneralErrors.AboveMax(); } results = new bytes[](data.length); for (uint256 i; i < data.length; ++i) { (bool success, bytes memory result) = address(this).delegatecall(data[i]); if (!success) { assembly { returndatacopy(0x00, 0x00, returndatasize()) revert(0x00, returndatasize()) } } results[i] = result; } } }
File 2 of 3 : IGeneralErrors.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; /** * @dev Interface for errors potentially used in all libraries (general names) */ interface IGeneralErrors { error InitError(); error InvalidAddresses(); error InvalidAddress(); error InvalidInputLength(); error InvalidCollateralIndex(); error WrongParams(); error WrongLength(); error WrongOrder(); error WrongIndex(); error BlockOrder(); error Overflow(); error ZeroAddress(); error ZeroValue(); error AlreadyExists(); error DoesntExist(); error Paused(); error BelowMin(); error AboveMax(); error NotAuthorized(); error WrongTradeType(); error WrongOrderType(); error InsufficientBalance(); error UnsupportedChain(); }
File 3 of 3 : IMulticall.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; interface IMulticall { /** * @dev Call multiple functions in a single call. * @param data The data for the calls. * @return results The results of the calls. */ function multicall(bytes[] calldata data) external returns (bytes[] memory results); }
Please enter a contract address above to load the contract details and source code.
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.