"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable import/no-extraneous-dependencies */
require("@matterlabs/hardhat-zksync");
require("@nomicfoundation/hardhat-toolbox");
require("@nomicfoundation/hardhat-verify");
const dotenv_1 = __importDefault(require("dotenv"));
require("hardhat-artifactor");
require("hardhat-contract-sizer");
require("solidity-docgen");
// Don't forget to import new tasks here
require("./tasks/deploy");
const constants_1 = require("./tasks/helpers/constants");
require("./tasks/runner/benchmarks");
require("./tasks/runner/deployFull");
require("./tasks/runner/deployPoll");
require("./tasks/runner/encodeErrors");
require("./tasks/runner/merge");
require("./tasks/runner/prove");
require("./tasks/runner/submitOnChain");
require("./tasks/runner/verifyFull");
dotenv_1.default.config();
const DEFAULT_BLOCK_GAS_LIMIT = 30000000;
const DEFAULT_GAS_MULTIPLIER = 2;
const TEST_MNEMONIC = "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat";
const NETWORKS_RPC_URL = (0, constants_1.getNetworkRpcUrls)();
const GAS_PRICE = process.env.GAS_PRICE ? Number(process.env.GAS_PRICE) : "auto";
const getCommonNetworkConfig = (networkName, chainId, mnemonic) => ({
    url: NETWORKS_RPC_URL[networkName],
    blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
    gasMultiplier: DEFAULT_GAS_MULTIPLIER,
    gasPrice: GAS_PRICE,
    saveDeployments: true,
    chainId,
    accounts: process.env.PRIVATE_KEY
        ? [process.env.PRIVATE_KEY]
        : {
            mnemonic: mnemonic || process.env.MNEMONIC || TEST_MNEMONIC,
            path: "m/44'/60'/0'/0",
            initialIndex: process.env.INITIAL_INDEX ? Number(process.env.INITIAL_INDEX) : 0,
            count: 20,
        },
});
const config = {
    solidity: {
        version: "0.8.28",
        settings: {
            optimizer: {
                enabled: true,
                runs: 200,
            },
        },
    },
    defaultNetwork: "localhost",
    networks: {
        mainnet: getCommonNetworkConfig(constants_1.ESupportedChains.Mainnet, constants_1.EChainId.Mainnet),
        sepolia: getCommonNetworkConfig(constants_1.ESupportedChains.Sepolia, constants_1.EChainId.Sepolia),
        optimism: getCommonNetworkConfig(constants_1.ESupportedChains.Optimism, constants_1.EChainId.Optimism),
        optimism_sepolia: getCommonNetworkConfig(constants_1.ESupportedChains.OptimismSepolia, constants_1.EChainId.OptimismSepolia),
        scroll: getCommonNetworkConfig(constants_1.ESupportedChains.Scroll, constants_1.EChainId.Scroll),
        scroll_sepolia: getCommonNetworkConfig(constants_1.ESupportedChains.ScrollSepolia, constants_1.EChainId.ScrollSepolia),
        arbitrum: getCommonNetworkConfig(constants_1.ESupportedChains.Arbitrum, constants_1.EChainId.Arbitrum),
        arbitrum_sepolia: getCommonNetworkConfig(constants_1.ESupportedChains.ArbitrumSepolia, constants_1.EChainId.ArbitrumSepolia),
        base: getCommonNetworkConfig(constants_1.ESupportedChains.Base, constants_1.EChainId.Base),
        base_sepolia: getCommonNetworkConfig(constants_1.ESupportedChains.BaseSepolia, constants_1.EChainId.BaseSepolia),
        gnosis: getCommonNetworkConfig(constants_1.ESupportedChains.Gnosis, constants_1.EChainId.Gnosis),
        gnosis_chiado: getCommonNetworkConfig(constants_1.ESupportedChains.GnosisChiado, constants_1.EChainId.GnosisChiado),
        polygon: getCommonNetworkConfig(constants_1.ESupportedChains.Polygon, constants_1.EChainId.Polygon),
        polygon_amoy: getCommonNetworkConfig(constants_1.ESupportedChains.PolygonAmoy, constants_1.EChainId.PolygonAmoy),
        linea: getCommonNetworkConfig(constants_1.ESupportedChains.Linea, constants_1.EChainId.Linea),
        linea_sepolia: getCommonNetworkConfig(constants_1.ESupportedChains.LineaSepolia, constants_1.EChainId.LineaSepolia),
        zksync_era: getCommonNetworkConfig(constants_1.ESupportedChains.ZkSyncEra, constants_1.EChainId.ZkSyncEra),
        zksync_sepolia: getCommonNetworkConfig(constants_1.ESupportedChains.ZkSyncSepolia, constants_1.EChainId.ZkSyncSepolia),
        polygon_zkevm: getCommonNetworkConfig(constants_1.ESupportedChains.PolygonZkEvm, constants_1.EChainId.PolygonZkEvm),
        polygon_cardona_zkevm: getCommonNetworkConfig(constants_1.ESupportedChains.PolygonCardonaZkEvm, constants_1.EChainId.PolygonCardonaZkEvm),
        coverage: getCommonNetworkConfig(constants_1.ESupportedChains.Coverage, constants_1.EChainId.Coverage, TEST_MNEMONIC),
        localhost: {
            url: "http://localhost:8545",
            loggingEnabled: false,
        },
        hardhat: {
            blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
            gasMultiplier: DEFAULT_GAS_MULTIPLIER,
            gasPrice: "auto",
            chainId: constants_1.EChainId.Hardhat,
            zksync: Boolean(process.env.ZK_SYNC),
            accounts: {
                mnemonic: TEST_MNEMONIC,
                path: "m/44'/60'/0'/0",
                initialIndex: 0,
                count: 20,
            },
            gas: DEFAULT_BLOCK_GAS_LIMIT,
            loggingEnabled: process.env.HARDHAT_LOGGING === "true",
            allowUnlimitedContractSize: true,
            throwOnTransactionFailures: true,
            throwOnCallFailures: true,
            mining: {
                auto: true,
                interval: 100,
            },
            forking: process.env.FORKING_URL
                ? {
                    url: process.env.FORKING_URL,
                    blockNumber: process.env.FORKING_BLOCK_NUMBER ? parseInt(process.env.FORKING_BLOCK_NUMBER, 10) : 0,
                }
                : undefined,
        },
    },
    contractSizer: {
        alphaSort: true,
        runOnCompile: true,
        disambiguatePaths: false,
    },
    etherscan: {
        apiKey: process.env.ETH_ETHERSCAN_API_KEY,
        customChains: [
            {
                network: constants_1.ESupportedChains.Sepolia,
                chainId: constants_1.EChainId.Sepolia,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.Sepolia}`,
                    browserURL: "https://sepolia.etherscan.io",
                },
            },
            {
                network: constants_1.ESupportedChains.Optimism,
                chainId: constants_1.EChainId.Optimism,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.Optimism}`,
                    browserURL: "https://optimistic.etherscan.io",
                },
            },
            {
                network: constants_1.ESupportedChains.OptimismSepolia,
                chainId: constants_1.EChainId.OptimismSepolia,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.OptimismSepolia}`,
                    browserURL: "https://sepolia-optimistic.etherscan.io",
                },
            },
            {
                network: constants_1.ESupportedChains.Scroll,
                chainId: constants_1.EChainId.Scroll,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.Scroll}`,
                    browserURL: "https://scrollscan.com/",
                },
            },
            {
                network: constants_1.ESupportedChains.ScrollSepolia,
                chainId: constants_1.EChainId.ScrollSepolia,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.ScrollSepolia}`,
                    browserURL: "https://sepolia.scrollscan.com/",
                },
            },
            {
                network: constants_1.ESupportedChains.Arbitrum,
                chainId: constants_1.EChainId.Arbitrum,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.Arbitrum}`,
                    browserURL: "https://arbiscan.io/",
                },
            },
            {
                network: constants_1.ESupportedChains.ArbitrumSepolia,
                chainId: constants_1.EChainId.ArbitrumSepolia,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.ArbitrumSepolia}`,
                    browserURL: "https://sepolia.arbiscan.io/",
                },
            },
            {
                network: constants_1.ESupportedChains.Base,
                chainId: constants_1.EChainId.Base,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.Base}`,
                    browserURL: "https://basescan.org/",
                },
            },
            {
                network: constants_1.ESupportedChains.BaseSepolia,
                chainId: constants_1.EChainId.BaseSepolia,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.BaseSepolia}`,
                    browserURL: "https://sepolia.basescan.org/",
                },
            },
            {
                network: constants_1.ESupportedChains.Gnosis,
                chainId: constants_1.EChainId.Gnosis,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.Gnosis}`,
                    browserURL: "https://gnosisscan.io/",
                },
            },
            {
                network: constants_1.ESupportedChains.GnosisChiado,
                chainId: constants_1.EChainId.GnosisChiado,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.GnosisChiado}`,
                    browserURL: "https://gnosis-chiado.blockscout.com/",
                },
            },
            {
                network: constants_1.ESupportedChains.Polygon,
                chainId: constants_1.EChainId.Polygon,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.Polygon}`,
                    browserURL: "https://polygonscan.com/",
                },
            },
            {
                network: constants_1.ESupportedChains.PolygonAmoy,
                chainId: constants_1.EChainId.PolygonAmoy,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.PolygonAmoy}`,
                    browserURL: "https://amoy.polygonscan.com/",
                },
            },
            {
                network: constants_1.ESupportedChains.Linea,
                chainId: constants_1.EChainId.Linea,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.Linea}`,
                    browserURL: "https://lineascan.build/",
                },
            },
            {
                network: constants_1.ESupportedChains.LineaSepolia,
                chainId: constants_1.EChainId.LineaSepolia,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.LineaSepolia}`,
                    browserURL: "https://sepolia.lineascan.build/",
                },
            },
            {
                network: constants_1.ESupportedChains.ZkSyncEra,
                chainId: constants_1.EChainId.ZkSyncEra,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.ZkSyncEra}`,
                    browserURL: "https://explorer.zksync.io",
                },
            },
            {
                network: constants_1.ESupportedChains.ZkSyncSepolia,
                chainId: constants_1.EChainId.ZkSyncSepolia,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.ZkSyncSepolia}`,
                    browserURL: "https://sepolia.explorer.zksync.io",
                },
            },
            {
                network: constants_1.ESupportedChains.PolygonZkEvm,
                chainId: constants_1.EChainId.PolygonZkEvm,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.PolygonZkEvm}`,
                    browserURL: "https://zkevm.polygonscan.com/",
                },
            },
            {
                network: constants_1.ESupportedChains.PolygonCardonaZkEvm,
                chainId: constants_1.EChainId.PolygonCardonaZkEvm,
                urls: {
                    apiURL: `https://api.etherscan.io/v2/api?chainid=${constants_1.EChainId.PolygonCardonaZkEvm}`,
                    browserURL: "https://docs.polygonscan.com/cardona-polygon-zkevm",
                },
            },
        ],
    },
    sourcify: {
        enabled: true,
    },
    paths: {
        tests: "./tests",
        artifacts: "./artifacts",
    },
    docgen: {
        outputDir: "./docs",
        pages: "files",
        exclude: ["./trees/zeros"],
    },
    gasReporter: {
        currency: "USD",
        gasPrice: process.env.GAS_REPORTER_PRICE ? Number(process.env.GAS_REPORTER_PRICE) : undefined,
        coinmarketcap: process.env.COINMARKETCAP_API_KEY,
        enabled: true,
    },
};
exports.default = config;
//# sourceMappingURL=hardhat.config.js.map