UNPKG

hardhat-gas-reporter

Version:
74 lines 2.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDefaultOptions = void 0; const constants_1 = require("../constants"); /** * Validates Optimism hardfork option * @param hardfork * @returns {boolean} */ function isOptimismHardfork(hardfork) { if (hardfork === undefined) return false; return ["bedrock, ecotone"].includes(hardfork); } /** * Sets default reporter options */ function getDefaultOptions(userConfig) { let optimismHardfork; let opStackBaseFeeScalar = 0; let opStackBlobBaseFeeScalar = 0; const userOptions = userConfig.gasReporter; // NB: silently coercing to default if there's a misspelling or option not avail if (userOptions) { if (userOptions.L2 === "optimism" || userOptions.L2 === "base") if (!isOptimismHardfork(userOptions.optimismHardfork)) { optimismHardfork = constants_1.DEFAULT_OPTIMISM_HARDFORK; } if (userOptions.L2 === "optimism") { if (!userOptions.opStackBaseFeeScalar) { opStackBaseFeeScalar = constants_1.OPTIMISM_ECOTONE_BASE_FEE_SCALAR; } if (!userOptions.opStackBlobBaseFeeScalar) { opStackBlobBaseFeeScalar = constants_1.OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR; } } if (userOptions.L2 === "base") { if (!userOptions.opStackBaseFeeScalar) { opStackBaseFeeScalar = constants_1.BASE_ECOTONE_BASE_FEE_SCALAR; } if (!userOptions.opStackBlobBaseFeeScalar) { opStackBlobBaseFeeScalar = constants_1.BASE_ECOTONE_BLOB_BASE_FEE_SCALAR; } } } return { currency: constants_1.DEFAULT_CURRENCY, currencyDisplayPrecision: constants_1.DEFAULT_CURRENCY_DISPLAY_PRECISION, darkMode: false, enabled: true, excludeContracts: [], excludeAutoGeneratedGetters: false, forceTerminalOutput: false, includeBytecodeInJSON: false, includeIntrinsicGas: true, L1: "ethereum", noColors: false, offline: false, opStackBaseFeeScalar, opStackBlobBaseFeeScalar, optimismHardfork, outputJSON: false, outputJSONFile: constants_1.DEFAULT_JSON_OUTPUT_FILE, reportFormat: constants_1.TABLE_NAME_TERMINAL, reportPureAndViewMethods: false, rst: false, rstTitle: "", suppressTerminalOutput: false, showMethodSig: false, showUncalledMethods: false, }; } exports.getDefaultOptions = getDefaultOptions; //# sourceMappingURL=options.js.map