import { SolcMetadata } from "@owlprotocol/viem-utils";

export const IAggregator: SolcMetadata = {
    compiler: {
        version: "0.8.23+commit.f704f362",
    },
    language: "Solidity",
    output: {
        abi: [
            {
                inputs: [
                    {
                        components: [
                            {
                                internalType: "address",
                                name: "sender",
                                type: "address",
                            },
                            {
                                internalType: "uint256",
                                name: "nonce",
                                type: "uint256",
                            },
                            {
                                internalType: "bytes",
                                name: "initCode",
                                type: "bytes",
                            },
                            {
                                internalType: "bytes",
                                name: "callData",
                                type: "bytes",
                            },
                            {
                                internalType: "bytes32",
                                name: "accountGasLimits",
                                type: "bytes32",
                            },
                            {
                                internalType: "uint256",
                                name: "preVerificationGas",
                                type: "uint256",
                            },
                            {
                                internalType: "bytes32",
                                name: "gasFees",
                                type: "bytes32",
                            },
                            {
                                internalType: "bytes",
                                name: "paymasterAndData",
                                type: "bytes",
                            },
                            {
                                internalType: "bytes",
                                name: "signature",
                                type: "bytes",
                            },
                        ],
                        internalType: "struct PackedUserOperation[]",
                        name: "userOps",
                        type: "tuple[]",
                    },
                ],
                name: "aggregateSignatures",
                outputs: [
                    {
                        internalType: "bytes",
                        name: "aggregatedSignature",
                        type: "bytes",
                    },
                ],
                stateMutability: "view",
                type: "function",
            },
            {
                inputs: [
                    {
                        components: [
                            {
                                internalType: "address",
                                name: "sender",
                                type: "address",
                            },
                            {
                                internalType: "uint256",
                                name: "nonce",
                                type: "uint256",
                            },
                            {
                                internalType: "bytes",
                                name: "initCode",
                                type: "bytes",
                            },
                            {
                                internalType: "bytes",
                                name: "callData",
                                type: "bytes",
                            },
                            {
                                internalType: "bytes32",
                                name: "accountGasLimits",
                                type: "bytes32",
                            },
                            {
                                internalType: "uint256",
                                name: "preVerificationGas",
                                type: "uint256",
                            },
                            {
                                internalType: "bytes32",
                                name: "gasFees",
                                type: "bytes32",
                            },
                            {
                                internalType: "bytes",
                                name: "paymasterAndData",
                                type: "bytes",
                            },
                            {
                                internalType: "bytes",
                                name: "signature",
                                type: "bytes",
                            },
                        ],
                        internalType: "struct PackedUserOperation[]",
                        name: "userOps",
                        type: "tuple[]",
                    },
                    {
                        internalType: "bytes",
                        name: "signature",
                        type: "bytes",
                    },
                ],
                name: "validateSignatures",
                outputs: [],
                stateMutability: "view",
                type: "function",
            },
            {
                inputs: [
                    {
                        components: [
                            {
                                internalType: "address",
                                name: "sender",
                                type: "address",
                            },
                            {
                                internalType: "uint256",
                                name: "nonce",
                                type: "uint256",
                            },
                            {
                                internalType: "bytes",
                                name: "initCode",
                                type: "bytes",
                            },
                            {
                                internalType: "bytes",
                                name: "callData",
                                type: "bytes",
                            },
                            {
                                internalType: "bytes32",
                                name: "accountGasLimits",
                                type: "bytes32",
                            },
                            {
                                internalType: "uint256",
                                name: "preVerificationGas",
                                type: "uint256",
                            },
                            {
                                internalType: "bytes32",
                                name: "gasFees",
                                type: "bytes32",
                            },
                            {
                                internalType: "bytes",
                                name: "paymasterAndData",
                                type: "bytes",
                            },
                            {
                                internalType: "bytes",
                                name: "signature",
                                type: "bytes",
                            },
                        ],
                        internalType: "struct PackedUserOperation",
                        name: "userOp",
                        type: "tuple",
                    },
                ],
                name: "validateUserOpSignature",
                outputs: [
                    {
                        internalType: "bytes",
                        name: "sigForUserOp",
                        type: "bytes",
                    },
                ],
                stateMutability: "view",
                type: "function",
            },
        ],
        devdoc: {
            kind: "dev",
            methods: {
                "aggregateSignatures((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[])": {
                    params: {
                        userOps: "- Array of UserOperations to collect the signatures from.",
                    },
                    returns: {
                        aggregatedSignature: "- The aggregated signature.",
                    },
                },
                "validateSignatures((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[],bytes)": {
                    params: {
                        signature: "- The aggregated signature.",
                        userOps: "- Array of UserOperations to validate the signature for.",
                    },
                },
                "validateUserOpSignature((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes))": {
                    params: {
                        userOp: "- The userOperation received from the user.",
                    },
                    returns: {
                        sigForUserOp:
                            '- The value to put into the signature field of the userOp when calling handleOps.                        (usually empty, unless account and aggregator support some kind of "multisig".',
                    },
                },
            },
            version: 1,
        },
        userdoc: {
            kind: "user",
            methods: {
                "aggregateSignatures((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[])": {
                    notice: "Aggregate multiple signatures into a single value. This method is called off-chain to calculate the signature to pass with handleOps() bundler MAY use optimized custom code perform this aggregation.",
                },
                "validateSignatures((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[],bytes)": {
                    notice: "Validate aggregated signature. Revert if the aggregated signature does not match the given list of operations.",
                },
                "validateUserOpSignature((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes))": {
                    notice: "Validate signature of a single userOp. This method should be called by bundler after EntryPointSimulation.simulateValidation() returns the aggregator this account uses. First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.",
                },
            },
            notice: "Aggregated Signatures validator.",
            version: 1,
        },
    },
    settings: {
        compilationTarget: {
            "@account-abstraction/contracts/interfaces/IAggregator.sol": "IAggregator",
        },
        evmVersion: "paris",
        libraries: {},
        metadata: {
            bytecodeHash: "ipfs",
            useLiteralContent: true,
        },
        optimizer: {
            enabled: true,
            runs: 1000000,
        },
        remappings: [],
        viaIR: true,
    },
    sources: {
        "@account-abstraction/contracts/interfaces/IAggregator.sol": {
            content:
                '// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\nimport "./PackedUserOperation.sol";\n\n/**\n * Aggregated Signatures validator.\n */\ninterface IAggregator {\n    /**\n     * Validate aggregated signature.\n     * Revert if the aggregated signature does not match the given list of operations.\n     * @param userOps   - Array of UserOperations to validate the signature for.\n     * @param signature - The aggregated signature.\n     */\n    function validateSignatures(\n        PackedUserOperation[] calldata userOps,\n        bytes calldata signature\n    ) external view;\n\n    /**\n     * Validate signature of a single userOp.\n     * This method should be called by bundler after EntryPointSimulation.simulateValidation() returns\n     * the aggregator this account uses.\n     * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\n     * @param userOp        - The userOperation received from the user.\n     * @return sigForUserOp - The value to put into the signature field of the userOp when calling handleOps.\n     *                        (usually empty, unless account and aggregator support some kind of "multisig".\n     */\n    function validateUserOpSignature(\n        PackedUserOperation calldata userOp\n    ) external view returns (bytes memory sigForUserOp);\n\n    /**\n     * Aggregate multiple signatures into a single value.\n     * This method is called off-chain to calculate the signature to pass with handleOps()\n     * bundler MAY use optimized custom code perform this aggregation.\n     * @param userOps              - Array of UserOperations to collect the signatures from.\n     * @return aggregatedSignature - The aggregated signature.\n     */\n    function aggregateSignatures(\n        PackedUserOperation[] calldata userOps\n    ) external view returns (bytes memory aggregatedSignature);\n}\n',
            keccak256: "0xf100d6fcc0c3b450b13e979b6a42c628c292a1bc340eccc2e7796b80e3975588",
            license: "GPL-3.0",
        },
        "@account-abstraction/contracts/interfaces/PackedUserOperation.sol": {
            content:
                "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\n/**\n * User Operation struct\n * @param sender                - The sender account of this request.\n * @param nonce                 - Unique value the sender uses to verify it is not a replay.\n * @param initCode              - If set, the account contract will be created by this constructor/\n * @param callData              - The method call to execute on this account.\n * @param accountGasLimits      - Packed gas limits for validateUserOp and gas limit passed to the callData method call.\n * @param preVerificationGas    - Gas not calculated by the handleOps method, but added to the gas paid.\n *                                Covers batch overhead.\n * @param gasFees               - packed gas fields maxPriorityFeePerGas and maxFeePerGas - Same as EIP-1559 gas parameters.\n * @param paymasterAndData      - If set, this field holds the paymaster address, verification gas limit, postOp gas limit and paymaster-specific extra data\n *                                The paymaster will pay for the transaction instead of the sender.\n * @param signature             - Sender-verified signature over the entire request, the EntryPoint address and the chain ID.\n */\nstruct PackedUserOperation {\n    address sender;\n    uint256 nonce;\n    bytes initCode;\n    bytes callData;\n    bytes32 accountGasLimits;\n    uint256 preVerificationGas;\n    bytes32 gasFees;\n    bytes paymasterAndData;\n    bytes signature;\n}\n",
            keccak256: "0x1129b46381db68eddbc5cb49e50664667b66b03c480453858e7b25eabe444359",
            license: "GPL-3.0",
        },
    },
    version: 1,
};
