import { decodeAbiParameters, encodeAbiParameters } from "viem";
const ABI = [
    { name: "allowedTargets", type: "address[]" },
    { name: "allowedTokens", type: "address[]" },
    { name: "maxAmountPerTokenPerTx", type: "uint128" },
    { name: "allowMint", type: "bool" },
    { name: "allowIncrease", type: "bool" },
    { name: "allowDecrease", type: "bool" },
    { name: "allowCollect", type: "bool" },
    { name: "allowBurn", type: "bool" },
];
export const ammLiquidityTemplate = {
    name: "SharedAMMLiquidityPermission",
    address: "0x0000000000000000000000000000000000000000",
    encoder: {
        encode(params) {
            return encodeAbiParameters(ABI, [
                params.allowedTargets,
                params.allowedTokens,
                params.maxAmountPerTokenPerTx,
                params.allowMint,
                params.allowIncrease,
                params.allowDecrease,
                params.allowCollect,
                params.allowBurn,
            ]);
        },
        decode(data) {
            const decoded = decodeAbiParameters(ABI, data);
            return {
                allowedTargets: [...decoded[0]],
                allowedTokens: [...decoded[1]],
                maxAmountPerTokenPerTx: decoded[2],
                allowMint: decoded[3],
                allowIncrease: decoded[4],
                allowDecrease: decoded[5],
                allowCollect: decoded[6],
                allowBurn: decoded[7],
            };
        },
    },
    explainer: {
        explain(params) {
            const warnings = [];
            if (params.allowedTargets.length === 0) {
                warnings.push("No targets specified — all liquidity operations will be blocked");
            }
            const ops = [
                params.allowMint && "mint",
                params.allowIncrease && "increase",
                params.allowDecrease && "decrease",
                params.allowCollect && "collect",
                params.allowBurn && "burn",
            ].filter(Boolean);
            return {
                templateName: "SharedAMMLiquidityPermission",
                humanReadable: [
                    `Maximum amount per token per tx: ${params.maxAmountPerTokenPerTx.toString()} (base units)`,
                    `Allowed targets (${params.allowedTargets.length}): ${params.allowedTargets.join(", ")}`,
                    `Allowed tokens: ${params.allowedTokens.join(", ")}`,
                    `Enabled operations: ${ops.length ? ops.join(", ") : "none"}`,
                ],
                warnings,
            };
        },
    },
};
//# sourceMappingURL=ammLiquidity.js.map