@owlprotocol/contracts-account-abstraction
Version:
ERC4337 Account Abstraction support for deploying relevant smart contracts and interacting with UserOps.
83 lines (81 loc) • 3.83 kB
text/typescript
import { SolcMetadata } from "@owlprotocol/viem-utils";
export const SenderCreator: SolcMetadata = {
compiler: {
version: "0.8.23+commit.f704f362",
},
language: "Solidity",
output: {
abi: [
{
inputs: [
{
internalType: "bytes",
name: "initCode",
type: "bytes",
},
],
name: "createSender",
outputs: [
{
internalType: "address",
name: "sender",
type: "address",
},
],
stateMutability: "nonpayable",
type: "function",
},
],
devdoc: {
kind: "dev",
methods: {
"createSender(bytes)": {
params: {
initCode:
"- The initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata.",
},
returns: {
sender: " - The returned address of the created account, or zero address on failure.",
},
},
},
version: 1,
},
userdoc: {
kind: "user",
methods: {
"createSender(bytes)": {
notice: 'Call the "initCode" factory to create and return the sender account address.',
},
},
notice: 'Helper contract for EntryPoint, to call userOp.initCode from a "neutral" address, which is explicitly not the entryPoint itself.',
version: 1,
},
},
settings: {
compilationTarget: {
"@account-abstraction/contracts/core/SenderCreator.sol": "SenderCreator",
},
evmVersion: "paris",
libraries: {},
metadata: {
bytecodeHash: "ipfs",
useLiteralContent: true,
},
optimizer: {
enabled: true,
runs: 1000000,
},
remappings: [],
viaIR: true,
},
sources: {
"@account-abstraction/contracts/core/SenderCreator.sol": {
content:
'// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.23;\n\n/**\n * Helper contract for EntryPoint, to call userOp.initCode from a "neutral" address,\n * which is explicitly not the entryPoint itself.\n */\ncontract SenderCreator {\n /**\n * Call the "initCode" factory to create and return the sender account address.\n * @param initCode - The initCode value from a UserOp. contains 20 bytes of factory address,\n * followed by calldata.\n * @return sender - The returned address of the created account, or zero address on failure.\n */\n function createSender(\n bytes calldata initCode\n ) external returns (address sender) {\n address factory = address(bytes20(initCode[0:20]));\n bytes memory initCallData = initCode[20:];\n bool success;\n /* solhint-disable no-inline-assembly */\n assembly ("memory-safe") {\n success := call(\n gas(),\n factory,\n 0,\n add(initCallData, 0x20),\n mload(initCallData),\n 0,\n 32\n )\n sender := mload(0)\n }\n if (!success) {\n sender = address(0);\n }\n }\n}\n',
keccak256: "0xeb95afb6e4cf921c1ed105ecb9f549ca46bee57f68acd1d2f4f84607ac0db5c5",
license: "GPL-3.0",
},
},
version: 1,
};