UNPKG

@owlprotocol/contracts-account-abstraction

Version:

ERC4337 Account Abstraction support for deploying relevant smart contracts and interacting with UserOps.

49 lines (48 loc) 3.08 kB
const Exec = { compiler: { version: "0.8.23+commit.f704f362" }, language: "Solidity", output: { abi: [], devdoc: { kind: "dev", methods: {}, version: 1 }, userdoc: { kind: "user", methods: {}, notice: "Utility functions helpful when making different kinds of contract calls in Solidity.", version: 1 } }, settings: { compilationTarget: { "@account-abstraction/contracts/utils/Exec.sol": "Exec" }, evmVersion: "paris", libraries: {}, metadata: { bytecodeHash: "ipfs", useLiteralContent: true }, optimizer: { enabled: true, runs: 1e6 }, remappings: [], viaIR: true }, sources: { "@account-abstraction/contracts/utils/Exec.sol": { content: '// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.23;\n\n// solhint-disable no-inline-assembly\n\n/**\n * Utility functions helpful when making different kinds of contract calls in Solidity.\n */\nlibrary Exec {\n\n function call(\n address to,\n uint256 value,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly ("memory-safe") {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function staticcall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal view returns (bool success) {\n assembly ("memory-safe") {\n success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function delegateCall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly ("memory-safe") {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n // get returned data from last call or calldelegate\n function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\n assembly ("memory-safe") {\n let len := returndatasize()\n if gt(len, maxLen) {\n len := maxLen\n }\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n // revert with explicit byte array (probably reverted info from call)\n function revertWithData(bytes memory returnData) internal pure {\n assembly ("memory-safe") {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n\n function callAndRevert(address to, bytes memory data, uint256 maxLen) internal {\n bool success = call(to,0,data,gasleft());\n if (!success) {\n revertWithData(getReturnData(maxLen));\n }\n }\n}\n', keccak256: "0x86b1b1cd11158dddb9d381040c57fdc643c74b5e4eed3e7e036f32452672ad74", license: "LGPL-3.0-only" } }, version: 1 }; export { Exec };