"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.disabledNetworks = exports.AppNameSchema = exports.getDefaultRpcs = exports.EnvironmentSchema = void 0;
const tslib_1 = require("tslib");
const dotenv_1 = tslib_1.__importDefault(require("dotenv"));
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
// first assign the env vars from .env.tests file if ENVIRONMENT is 'tests'
const dotEnvLoadSettings = process.env.ENVIRONMENT === 'tests' ? { path: '.env.tests' } : undefined;
dotenv_1.default.config(dotEnvLoadSettings);
const env_var_1 = tslib_1.__importDefault(require("env-var"));
const types_1 = require("./types");
const networks_1 = tslib_1.__importStar(require("./networks"));
const validation_1 = require("./validation");
const zod_1 = require("zod");
const logger_1 = require("../utils/logger");
const rpcEndpoints_1 = require("./rpcEndpoints");
const ethers_1 = require("ethers");
const get = env_var_1.default.get;
/*
 * ============= Custom env vars logic =================
 */
exports.EnvironmentSchema = zod_1.z.nativeEnum(types_1.Environment);
const environment = exports.EnvironmentSchema.parse(get('ENVIRONMENT').required().default('testnet').asString());
// Load RPCs in JSON format
const configuredRPCEndpoints = get('RPC_ENDPOINTS').default(rpcEndpoints_1.defaultRpcEndpoints).asJsonObject();
const assignRpcsToNetworks = () => {
    for (const [_, networkConfig] of Object.entries(networks_1.default)) {
        const { id } = networkConfig;
        networkConfig.rpcEndpoints = configuredRPCEndpoints[id];
        logger_1.logger.trace({
            networkId: id,
            rpcEndpoints: networkConfig.rpcEndpoints,
        }, `📶 RPC endpoints attached to network ${id}`);
    }
};
const getDefaultRpcs = (networkId) => {
    return rpcEndpoints_1.defaultRpcEndpoints[networkId];
};
exports.getDefaultRpcs = getDefaultRpcs;
const getNetworkConfigs = () => {
    assignRpcsToNetworks();
    return {
        ...networks_1.default,
    };
};
exports.AppNameSchema = zod_1.z.enum([
    'across',
    'distributor',
    'executor',
    'fastwriter',
    'guardian',
    'local',
    'messiah',
    'monitor',
    'placer',
    'pricer',
    'stats',
    'prophet',
    'test',
    't3',
]);
const appName = exports.AppNameSchema.parse(get('APP_NAME').required().default('local').asString()).toUpperCase();
const podName = get('POD_NAME').asString();
let privateKey;
try {
    if (process.env.PRIVATE_KEY_LOAD_FROM_FILE === 'true') {
        const privateKeyPath = process.env.PRIVATE_KEY_PATH;
        if (privateKeyPath) {
            privateKey = node_fs_1.default.readFileSync(privateKeyPath, 'utf8').trim();
        }
        else {
            throw new Error('PRIVATE_KEY_PATH is not defined');
        }
    }
    else {
        privateKey = node_fs_1.default.readFileSync(`/etc/private-key/${podName}`, 'utf8');
    }
}
catch {
    privateKey = get(`PRIVATE_KEY_${appName}`).default('').asString();
}
const L3Networks = {
    mainnet: 't3rn',
    testnet: 'l2rn',
    devnet: 'l0rn',
    tests: 'l0rn',
};
const l3Network = L3Networks[environment];
if (!l3Network) {
    throw new Error(`❌ No enabled L3 network found for ${environment}`);
}
exports.disabledNetworks = get('NETWORKS_DISABLED').default('arbitrum,base,optimism').asArray();
// all: ['arbitrum-sepolia', 'base-sepolia', 'berachain-bartio', 'binance-testnet', 'blast-sepolia', 'linea-sepolia', 'lisk-sepolia', 'optimism-sepolia', 'unichain-sepolia', 'abstract-sepolia', skale-sepolia'],
const enabledNetworksList = [
    'optimism-sepolia',
    'arbitrum-sepolia',
    'base-sepolia',
    'binance-testnet',
    'blast-sepolia',
    'monad-testnet',
    'sei-testnet',
    'unichain-sepolia',
    'gnosis-testnet',
    'lisk-sepolia',
    'linea-sepolia',
    'abstract-sepolia',
    'berachain-bepolia',
    'arbitrum',
    'base',
    'binance',
    'ethereum',
    'linea',
    'optimism',
];
const enabledNetworks = {
    tests: [l3Network],
    devnet: [l3Network, ...enabledNetworksList],
    testnet: [l3Network, ...enabledNetworksList],
    mainnet: [l3Network, ...enabledNetworksList],
}[environment].filter((network) => !exports.disabledNetworks.includes(network));
const getPolymerApiUrl = () => {
    const local = get('POLYMER_URL').asString();
    if (local && local.length > 1) {
        return local;
    }
    switch (environment) {
        case types_1.Environment.mainnet: {
            return 'https://proof.testnet.polymer.zone';
        }
        case types_1.Environment.testnet: {
            return 'https://proof.testnet.polymer.zone';
        }
        case types_1.Environment.devnet: {
            return 'https://proof.testnet.polymer.zone';
        }
        case types_1.Environment.tests: {
            return 'https://proof.testnet.polymer.zone';
        }
        default: {
            throw new Error(`❌ Environment '${environment}' not supported. Valid envs: ${Object.values(types_1.Environment).join(', ')}`);
        }
    }
};
const getPricerApiUrl = () => {
    const local = get('PRICER_URL').asString();
    if (local && local.length > 1) {
        return local;
    }
    switch (environment) {
        case types_1.Environment.mainnet: {
            return 'https://api.t3rn.io';
        }
        case types_1.Environment.testnet: {
            return 'https://api.t2rn.io';
        }
        case types_1.Environment.devnet: {
            return 'https://api.t0rn.io';
        }
        case types_1.Environment.tests: {
            return 'http://localhost:9001';
        }
        default: {
            throw new Error(`❌ Environment '${environment}' not supported. Valid envs: ${Object.values(types_1.Environment).join(', ')}`);
        }
    }
};
const getDefaultProtocolFeeInMicroPercent = () => {
    const defaultProtocolFeePercentage = get('DEFAULT_PROTOCOL_FEE_PERCENTAGE').default(0.00001).asFloat(); // Normal percentage e.g., 10 for 10%, 0.5 for 0.5%
    const microPercentage = Math.round(defaultProtocolFeePercentage * 1e8);
    return ethers_1.BigNumber.from(microPercentage);
};
const getDefaultProtocolFlatFee = () => {
    const defaultProtocolFlatFee = get('DEFAULT_PROTOCOL_FLAT_FEE').default('0.000012').asString(); // ether unit
    return ethers_1.ethers.utils.parseEther(defaultProtocolFlatFee);
};
/*
 * ============= END custom env vars logic =================
 */
const config = {
    nodeEnv: get('NODE_ENV').default('development').asString(),
    environment,
    version: get('VERSION').default('dev-build').asString(),
    instance: get('INSTANCE').default(types_1.Instance.alfa).asEnum(Object.values(types_1.Instance)).toLowerCase(),
    replicas: get('REPLICAS').default(1).asIntPositive(),
    enabledNetworks,
    privateKey,
    appName,
    podName,
    podNumber: Number(podName?.split('-').pop() || '0'),
    networks: getNetworkConfigs(),
    testnetNetworkIds: networks_1.testnetNetworkIds,
    mainnetNetworkIds: networks_1.mainnetNetworkIds,
    walletCheckIntervalSec: get('WALLET_CHECK_INTERVAL_SEC').default(60).asInt(),
    log: {
        level: get('LOG_LEVEL').default(types_1.LogLevel.INFO).asEnum(Object.values(types_1.LogLevel)),
        pretty: get('LOG_PRETTY').default('false').asBoolStrict(),
    },
    archivedNetworks: get('NETWORKS_ARCHIVED').default('').asArray(),
    featureFlags: {
        supportRevertCommitments: get('FEATURE_FLAG_SUPPORT_REVERT_COMMITMENTS').default('true').asBoolStrict(),
        updateDynamoExecutorBalanceOnClaim: get('FEATURE_FLAG_UPDATE_DYNAMO_EXECUTOR_BALANCE_ON_CLAIM')
            .default('false')
            .asBoolStrict(),
        enableRemoteL3: get('FEATURE_FLAG_ENABLE_REMOTE_L3').default('false').asBoolStrict(),
        processInvalidPendingRefund: get('FEATURE_FLAG_PROCESS_INVALID_PENDING_REFUND').default('false').asBoolStrict(),
        processInvalidAttestations: get('FEATURE_FLAG_PROCESS_INVALID_ATTESTATIONS').default('false').asBoolStrict(),
        traverseLongRangeBatches: get('FEATURE_FLAG_TRAVERSE_LONG_RANGE_BATCHES').default('true').asBoolStrict(),
        healthCheckAlwaysTrue: get('FEATURE_FLAG_HEALTH_CHECK_ALWAYS_TRUE').default('true').asBoolStrict(),
        v2: get('FEATURE_FLAG_V2').default('true').asBoolStrict(),
        v3: get('FEATURE_FLAG_V3').default('false').asBoolStrict(),
        v4: get('FEATURE_FLAG_V4').default('true').asBoolStrict(),
        remoteL3AttestationBook: get('FEATURE_FLAG_REMOTE_L3_ATTESTATION_BOOK').default('l0rn').asString(),
        quickL2BackdoorSubmission: get('FEATURE_FLAG_QUICK_L2_BACKDOOR_SUBMISSION').default('true').asBoolStrict(),
        adhocOrdersBatchPopulate: get('FEATURE_FLAG_ADHOC_ORDERS_POPULATE').default('false').asBoolStrict(),
        pushMissingIntervals: get('FEATURE_FLAG_PUSH_MISSING_INTERVALS').default('false').asBoolStrict(),
        pushViaTraverse: get('FEATURE_FLAG_PUSH_VIA_TRAVERSE').default('false').asBoolStrict(),
        v2OrdersBatchPopulate: get('FEATURE_FLAG_V2_ORDERS_BATCH_POPULATE').default('true').asBoolStrict(),
        remotePopulateAttestedOnly: get('FEATURE_FLAG_REMOTE_POPULATE_ATTESTED_ONLY').default('true').asBoolStrict(),
        boostL3ToL2Pusher: get('FEATURE_FLAG_BOOST_L3_TO_L2_PUSHER').default('false').asBoolStrict(),
        backdoorPastVersions: get('FEATURE_FLAG_BACKDOOR_PAST_VERSIONS').default('false').asBoolStrict(),
        extraPopulateAttestations: get('FEATURE_FLAG_EXTRA_POPULATE_ATTESTATIONS').default('false').asBoolStrict(),
        missingL3ToL2Pusher: get('FEATURE_FLAG_MISSING_L3_TO_L2_PUSHER').default('false').asBoolStrict(),
        adhocPopulate: get('FEATURE_FLAG_ADHOC_POPULATE').default('true').asBoolStrict(),
        adhocAttestationPopulateToL3ConfirmationBook: get('FEATURE_FLAG_ADHOC_POPULATE_TO_L3_CONFIRMATION_BOOK')
            .default('false')
            .asBoolStrict(),
        adhocAttest: get('FEATURE_FLAG_ADHOC_ATTEST').default('false').asBoolStrict(),
        adhocTryConstructBatch: get('FEATURE_FLAG_ADHOC_TRY_CONSTRUCT_BATCH').default('false').asBoolStrict(),
        v2RevertProcessCacheMemos: get('FEATURE_FLAG_V2_REVERT_PROCESS_CACHE_MEMOS').default('false').asBoolStrict(),
        processReAttestQueue: get('FEATURE_FLAG_PROCESS_RE_ATTEST_QUEUE').default('true').asBoolStrict(),
        intervalTryConstructBatch: get('FEATURE_FLAG_INTERVAL_TRY_CONSTRUCT_BATCH').default('true').asBoolStrict(),
        reversePopulateConfirmedAttributes: get('FEATURE_FLAG_REVERSE_POPULATE_CONFIRMED_ATTRIBUTES')
            .default('true')
            .asBoolStrict(),
        pricerBackdoor: get('FEATURE_FLAG_PRICER_BACKDOOR').default('true').asBoolStrict(),
        feedPricePoints: get('FEATURE_FLAG_FEED_PRICE_POINTS_MONITOR').default('false').asBoolStrict(),
        supportTokens: get('FEATURE_FLAG_SUPPORT_TOKENS').default('true').asBoolStrict(),
        executorSkipClaimsVerification: get('FEATURE_FLAG_EXECUTOR_SKIP_CLAIMS_VERIFICATION')
            .default('true')
            .asBoolStrict(),
        reDeliverL3DLQEnabled: get('FEATURE_FLAG_REDELIVER_L3_DLQ_ENABLED').default('false').asBoolStrict(),
        processGMPMismatchQueue: get('FEATURE_FLAG_PROCESS_GMP_MISMATCH_QUEUE').default('false').asBoolStrict(),
        reDeliverL3AttestationsEnabled: get('FEATURE_FLAG_REDELIVER_ATTESTATIONS_DLQ_ENABLED')
            .default('false')
            .asBoolStrict(),
        executorUnderbidMicroPercentage: get('FEATURE_FLAG_EXECUTOR_UNDERBID_MICRO_PERCENTAGE').default('0').asInt(),
        transmitterPendingTxReceiptsUseSQS: {
            executor: get('FEATURE_FLAG_TRANSMITTER_PENDING_TX_RECEIPTS_USE_SQS_EXECUTOR').default('false').asBoolStrict(),
            prophet: get('FEATURE_FLAG_TRANSMITTER_PENDING_TX_RECEIPTS_USE_SQS_PROPHET').default('true').asBoolStrict(),
            guardian: get('FEATURE_FLAG_TRANSMITTER_PENDING_TX_RECEIPTS_USE_SQS_GUARDIAN').default('true').asBoolStrict(),
        },
        estimateDisableGasFee: get('FEATURE_FLAG_ESTIMATE_DISABLE_GAS_FEE').default('false').asBoolStrict(),
    },
    tokens: {
        bytes32Zero: get('BYTES32_ZERO')
            .default('0x0000000000000000000000000000000000000000000000000000000000000000')
            .asString(),
        oneOn18Decimals: get('ONE_ON_18_DECIMALS').default(1_000_000_000_000_000_000).asIntPositive(),
        maxPrecision: get('MAX_PRECISION').default(6).asIntPositive(),
        commitGmpByte: get('COMMIT_GMP_BYTE').default('0x00').asString(),
        commitOpenMarketGmpByte: get('COMMIT_OPEN_MARKET_GMP_BYTE').default('0x05').asString(),
        revertGmpByte: get('REVERT_GMP_BYTE').default('0x01').asString(),
    },
    orders: {
        excludedLifecyclesFromBatching: validation_1.OrderLifecycleArraySchema.parse(get('EXCLUDED_LIFECYCLES_FROM_BATCHING').default('Bid').asArray(',')),
        defaultProtocolFeeInMicroPercentage: getDefaultProtocolFeeInMicroPercent(),
        defaultProtocolFlatFee: getDefaultProtocolFlatFee(),
    },
    l3: {
        currentActiveNetwork: l3Network,
    },
    prometheus: {
        enabled: get('PROMETHEUS_ENABLED').default('true').asBoolStrict(),
        port: get('PROMETHEUS_PORT').default(9090).asPortNumber(),
    },
    rpc: {
        gasPriceFetchIntervalSec: get('RPC_GAS_PRICE_FETCH_INTERVAL_SEC').default(30).asIntPositive(),
        gasFeeBump: get('RPC_GAS_FEE_BUMP').default(1).asInt(),
        healthCheckIntervalSec: get('RPC_HEALTH_CHECK_INTERVAL_SEC').default(3).asInt(),
        pollInterval: get('RPC_POLL_INTERVAL_MS').default(2000).asInt(),
        feeDataCacheKey: get('RPC_FEE_DATA_CACHE_KEY').default('feeData').asString(),
    },
    pricer: {
        expirationSec: {
            estimate: get('PRICER_EXPIRATION_SEC_ESTIMATE').default(2).asIntPositive(),
            order: get('PRICER_EXPIRATION_SEC_ORDER').default(10).asIntPositive(),
        },
        slippage: {
            low: get('PRICER_SLIPPAGE_LOW').default(1).asFloat(),
            regular: get('PRICER_SLIPPAGE_REGULAR').default(5).asFloat(),
            high: get('PRICER_SLIPPAGE_HIGH').default(10).asFloat(),
            max: get('PRICER_SLIPPAGE_MAX').default(25).asFloat(),
        },
        apiOnly: get('PRICER_API_ONLY').default('false').asBoolStrict(),
        pendingOrders: {
            verifyAgainstExecutable: get('PRICER_PENDING_ORDERS_VERIFY_AGAINST_EXECUTABLE').default('false').asBoolStrict(),
            applyHitMap: get('PRICER_APPLY_HITMAP_TO_PENDING_ORDERS').default('true').asBoolStrict(),
            implementation: get('PRICER_PENDING_ORDERS_IMPLEMENTATION').default('default').asString(),
            randomize: get('PRICER_PENDING_ORDERS_RANDOMIZE').default('true').asBoolStrict(),
            longFetchLimit: get('PRICER_PENDING_ORDERS_LONG_FETCH_LIMIT').default(500).asIntPositive(),
            fetchLimit: get('PRICER_PENDING_ORDERS_FETCH_LIMIT').default(120).asIntPositive(),
            cutOffLimit: get('PRICER_PENDING_ORDERS_CUT_OFF_LIMIT').default(180).asIntPositive(),
            cacheTimeSec: get('PRICER_PENDING_ORDERS_CACHE_TIME_SEC').default(5).asIntPositive(),
        },
        pendingExecutions: {
            randomize: get('PRICER_PENDING_EXECUTIONS_RANDOMIZE').default('true').asBoolStrict(),
            fetchLimit: get('PRICER_PENDING_EXECUTIONS_LIMIT_FETCH_LIMIT').default(50).asIntPositive(),
            cacheExpireSec: get('PRICER_PENDING_EXECUTIONS_CACHE_EXPIRE_SEC').default(30).asIntPositive(),
        },
        useDefaultGasLimitNoEstimate: get('PRICER_USE_DEFAULT_GAS_LIMIT_NO_ESTIMATE').default('true').asBoolStrict(),
        forceType0Estimates: get('PRICER_FORCE_TYPE_0_ESTIMATES').default('true').asBoolStrict(),
        minFlatExecutorFeeMicroUSD: get('PRICER_MIN_FLAT_EXECUTOR_FEE_MICRO_USD').default(200).asIntPositive(), // 0.0002 USD
        executorFeeOfProtocolFee: get('PRICER_EXECUTOR_FEE_OF_PROTOCOL_FEE').default(32).asIntPositive(), // 32% of protocol fee
        gasPriceSpikeFactorPercent: get('PRICER_GAS_SPIKE_FACTOR_PERCENT').default(32).asIntPositive(), // 32% of protocol fee
        buffGasLimit: get('PRICER_BUFF_GAS_LIMIT').default('false').asBoolStrict(),
        applyL3GasSpikePendingDecrease: get('PRICER_APPLY_L3_GAS_SPIKE_PENDING_DECREASE').default('false').asBoolStrict(),
        filterPendingBySupportedStrategies: get('PRICER_FILTER_PENDING_BY_SUPPORTED_STRATEGIES')
            .default('true')
            .asBoolStrict(),
        returnClaimsExtendedAsIds: get('PRICER_CLAIMS_EXTENDED_AS_IDS').default('false').asBoolStrict(),
        url: getPricerApiUrl(),
        fetchIntervalSec: get('PRICER_FETCH_INTERVAL_SEC').default(40).asIntPositive(),
        loadAssetsFromCacheIntervalSec: get('PRICER_LOAD_ASSETS_FROM_CACHE_INTERVAL_SEC').default(20).asIntPositive(),
        fetchBetweenNetworksIntervalSec: get('PRICER_FETCH_BETWEEN_NETWORKS_INTERVAL_SEC').default(5).asIntPositive(),
        fetchMinAmountBetweenNetworksIntervalSec: get('PRICER_FETCH_MIN_AMOUNT_BETWEEN_NETWORKS_INTERVAL_SEC')
            .default(60 * 60)
            .asIntPositive(),
        corsOrigins: get('PRICER_CORS_ORIGINS').default('').asArray(),
        maxDecimals18: get('MAX_DECIMALS_18').default(18).asIntPositive(),
        erc20TransferGasLimit: get('PRICER_ERC20_TRANSFER_GAS_LIMIT').default(120_000).asIntPositive(),
        ethTransferGasLimit: get('PRICER_ETH_TRANSFER_GAS_LIMIT').default(90_000).asIntPositive(),
        ethClaimGasLimit: get('PRICER_ETH_CLAIM_GAS_LIMIT').default(120_000).asIntPositive(),
        erc20ClaimGasLimit: get('PRICER_ERC20_CLAIM_GAS_LIMIT').default(120_000).asIntPositive(),
        executorFee: get('PRICER_EXECUTOR_FEE').default(0.2).asFloat(),
        priceMaxAgeMs: get('PRICER_MAX_AGE_MS')
            .default(10 * 60 * 1000)
            .asIntPositive(), // 1 minute
        pendingOrdersCleanupTimeoutMs: get('PRICER_PENDING_ORDERS_CLEANUP_TIMEOUT_MS')
            .default(10 * 60 * 1000)
            .asIntPositive(),
        executorInactivityTimeoutMs: get('PRICER_EXECUTOR_INACTIVITY_TIMEOUT_MS')
            .default(1 * 24 * 60 * 60 * 1000)
            .asIntPositive(),
        pendingOrdersCleanupIntervalSec: get('PRICER_PENDING_ORDERS_CLEANUP_INTERVAL_SEC')
            .default(60 * 60)
            .asIntPositive(),
        fetchProtocolFeeIntervalSec: get('PRICER_FETCH_PROTOCOL_FEE_INTERVAL_SEC').default(600).asIntPositive(),
        fetchOrderRefundTimeoutIntervalSec: get('PRICER_FETCH_ORDER_REFUND_TIMEOUT_INTERVAL_SEC')
            .default(10)
            .asIntPositive(),
        fetchTokenPricesCacheSec: get('PRICER_FETCH_TOKEN_PRICES_CACHE_SEC').default(15).asIntPositive(),
        compareETHPriceIntervalSec: get('PRICER_COMPARE_ETH_PRICE_INTERVAL_SEC').default(60).asIntPositive(),
        newProcesingOrdersFlow: get('PRICER_NEW_PROCESSING_ORDERS_FLOW').default('true').asBoolStrict(),
        errorMaxEstimatedRewardInUSD: get('PRICER_ERROR_MAX_ESTIMATED_REWARD_IN_USD').default('false').asBoolStrict(),
        maxCountClaimLimit: get('PRICER_MAX_COUNT_CLAIM_LIMIT').default(32).asIntPositive(),
        maxCountPendingRefundLimit: get('PRICER_MAX_COUNT_PENDING_REFUND_LIMIT').default(32).asIntPositive(),
        maxCountPendingFetchRefundLimit: get('PRICER_MAX_COUNT_PENDING_FETCH_REFUND_LIMIT').default(32).asIntPositive(),
        disabledNetworks: get('PRICER_NETWORKS_DISABLED').default('').asArray(),
        hardcodeT3rnAssets: get('PRICER_HARDCODE_T3RN_ASSETS').default('true').asBoolStrict(),
        thresholdDeviationPercentage: get('PRICER_PENDING_ORDERS_THRESHOLD_DEVIATION_PERCENTAGE').default(2).asFloat(),
    },
    guardian: {
        processExpirations: {
            enabled: get('GUARDIAN_PROCESS_EXPIRATIONS_ENABLED').default('true').asBoolStrict(),
            enabledArchives: get('GUARDIAN_PROCESS_EXPIRATIONS_ARCHIVES_ENABLED').default('false').asBoolStrict(),
            enabledOrderBookChain: get('GUARDIAN_PROCESS_EXPIRATIONS_ORDER_BOOK_CHAIN_ENABLED')
                .default('true')
                .asBoolStrict(),
            archivesGenesisStartId: get('GUARDIAN_ARCHIVES_GENESIS_START_ID')
                .default('0x91ff0afaaf708161f39449b4b5efbc69efc3fd8e65e3ad8d76f4f41bb88efcad')
                .asString(),
            processingExpiredLimit: get('GUARDIAN_PROCESSING_EXPIRED_LIMIT').default(128).asIntPositive(),
        },
        processPendingRefundWaiting: get('GUARDIAN_PROCESS_PENDING_REFUND_WAITING').default('true').asBoolStrict(),
        processPendingRefundWaitingInterval: get('GUARDIAN_PROCESS_PENDING_REFUND_WAITING_INTERVAL')
            .default(12)
            .asIntPositive(),
        processingExecutedOrdersLimit: get('PROCESSING_EXECUTED_ORDERS_LIMIT').default(32).asIntPositive(),
        processingExecutedOrdersBatch: get('PROCESSING_EXECUTED_ORDERS_BATCH').default('true').asBoolStrict(),
        disableL3Ping: get('GUARDIAN_DISABLE_L3_PING').default('false').asBoolStrict(),
        processingAttestedL3OrdersLimit: get('PROCESSING_EXECUTED_ORDERS_LIMIT').default(1000).asIntPositive(),
        processingExecutedOrdersBatchSize: get('PROCESSING_EXECUTED_ORDERS_BATCH_SIZE').default(1).asIntPositive(),
        processingExecutedOrdersInterval: get('PROCESSING_EXECUTED_ORDERS_INTERVAL').default(2).asInt(),
        processingAttestedL3OrdersInterval: get('PROCESSING_EXECUTED_ORDERS_INTERVAL').default(10).asInt(),
        attestationBatchSize: get('ATTESTATION_BATCH_SIZE').default(10).asIntPositive(),
        attestation_allow_incomplete_batches: get('ATTESTATION_ALLOW_INCOMPLETE_BATCHES').default('true').asBoolStrict(),
        attestation_onion_check: get('ATTESTATION_ONION_CHECK').default('false').asBoolStrict(),
        maxL3PopulateBatchSize: get('GUARDIAN_MAX_L3_POPULATE_BATCH_SIZE').default(10).asIntPositive(),
        startAttestingReverts: get('GUARDIAN_START_ATTESTING_REVERTS').default('false').asBoolStrict(),
        startAttestingCommits: get('GUARDIAN_START_ATTESTING_COMMITS').default('false').asBoolStrict(),
        checkForL2ConfirmationBeforeAttestL3: get('GUARDIAN_CHECK_FOR_L2_CONFIRMATION_BEFORE_ATTESTATION')
            .default('true')
            .asBoolStrict(),
        polymerUrl: getPolymerApiUrl(),
        polymerVerifierChainId: get('POLYMER_VERIFIER_CHAIN_ID').default(334).asIntPositive(),
        polymerVerifierContractAddress: get('POLYMER_VERIFIER_CONTRACT_ADDRESS')
            .default('0xBf822582b24a0227Dda5d665c1F56B5268D04444')
            .asString(),
        processSelectedEmergencyClaims: get('GUARDIAN_PROCESS_SELECTED_EMERGENCY_CLAIMS').default('false').asBoolStrict(),
        listenConfirmationEvents: get('GUARDIAN_LISTEN_CONFIRMATION_EVENTS').default('false').asBoolStrict(),
        listenTransferCommitApplied: get('GUARDIAN_LISTEN_TRANSFER_COMMIT_APPLIED').default('false').asBoolStrict(),
        anchorLatestRevertBatch: get('GUARDIAN_ANCHOR_LATEST_REVERT_BATCH').default('false').asBoolStrict(),
        waitTimeSeconds: get('GUARDIAN_SQS_WAIT_TIME_SECONDS').default(1).asInt(),
    },
    executor: {
        claimsListenerEnabled: get('EXECUTOR_CLAIMS_LISTENER_ENABLED').default('false').asBoolStrict(),
        useArbitrageStrategy: get('EXECUTOR_USE_ARBITRAGE_STRATEGY').default('true').asBoolStrict(),
        aggressionRate: get('AGGRESSION_RATE').default(0).asIntPositive(),
        fetchPendingOrdersShared: get('EXECUTOR_FETCH_PENDING_ORDERS_SHARED').default('true').asBoolStrict(),
        enableArbitrageStrategy: get('EXECUTOR_ENABLE_ARBITRAGE_STRATEGY').default('true').asBoolStrict(),
        processOrders: {
            enabled: get('EXECUTOR_PROCESS_ORDERS_ENABLED').default('true').asBoolStrict(),
            api: {
                enabled: get('EXECUTOR_PROCESS_ORDERS_API_ENABLED').default('true').asBoolStrict(),
                intervalSec: get('EXECUTOR_PROCESS_ORDERS_API_INTERVAL_SEC').default(10).asInt(),
            },
            batch: get('EXECUTOR_PROCESS_ORDERS_BATCH').default('true').asBoolStrict(),
        },
        processPendingExecutions: {
            enabled: get('EXECUTOR_PROCESS_PENDING_EXECUTIONS_ENABLED').default('true').asBoolStrict(),
            adHoc: get('EXECUTOR_PROCESS_PENDING_EXECUTIONS_ADHOC').default('true').asBoolStrict(),
            api: {
                enabled: get('EXECUTOR_PROCESS_PENDING_EXECUTIONS_API_ENABLED').default('true').asBoolStrict(),
                intervalSec: get('EXECUTOR_PROCESS_PENDING_EXECUTIONS_API_INTERVAL_SEC').default(10).asInt(),
            },
            batch: get('EXECUTOR_PROCESS_PENDING_EXECUTIONS_BATCH').default('true').asBoolStrict(),
        },
        haltBasedOnRatio: get('EXECUTOR_HALT_BASED_ON_RATIO').default('false').asBoolStrict(),
        enableBiddingProcessing: get('EXECUTOR_ENABLE_BIDDING_PROCESSING').default('true').asBoolStrict(),
        maxL3GasPrice: get('EXECUTOR_MAX_L3_GAS_PRICE').default(1000).asInt(),
        skipClaimGasEstimate: get('EXECUTOR_SKIP_CLAIM_GAS_ESTIMATE').default('true').asBoolStrict(),
        minBalanceThresholdEth: get('EXECUTOR_MIN_BALANCE_THRESHOLD_ETH').default('3').asString(),
        batchSize: get('EXECUTOR_BATCH_SIZE').default(10).asInt(),
        batchCreationTimeoutSec: get('EXECUTOR_BATCH_CREATION_TIMEOUT_SEC').default(3).asInt(),
        bidDecreaseFactor: get('BID_DECREASE_FACTOR').default(1_000_000).asInt(),
        bidDecreasePercent: get('BID_DECREASE_PERCENT').default(10).asInt(),
        arbitrageStrategy: get('ARBITRAGE_STRATEGY').asJsonObject(),
        enabledNetworks: get('EXECUTOR_ENABLED_NETWORKS')
            .default('arbitrum-sepolia,base-sepolia,optimism-sepolia,monad-testnet,unichain-sepolia')
            .asArray(),
        enabledAssets: get('EXECUTOR_ENABLED_ASSETS')
            .default('eth,t3eth,t3usd,t3btc,t3mon,t3sei,mon,sei,bnb,t3sol,lrn,bera,t3tia')
            .asArray(),
    },
    fastWriter: {
        trnNotMintedYet: get('FAST_WRITER_TRN_NOT_MINTED_YET').default('true').asBoolStrict(),
        transmitterCacheSec: get('FAST_WRITER_TRANSMITTER_CACHE_SEC').default(5).asIntPositive(),
        verifyAssets: get('FAST_WRITER_VERIFY_ASSETS').default('true').asBoolStrict(),
        maxAmountUSD: get('FAST_WRITER_MAX_AMOUNT_USD').default(1).asFloat(),
        minAmountUSD: get('FAST_WRITER_MIN_AMOUNT_USD').default(0.5).asFloat(),
        mainnetOrders: get('FAST_WRITER_MAINNET_ORDERS').default('false').asBoolStrict(),
        profitableOrders: get('FAST_WRITER_PROFITABLE_ORDERS').default('true').asBoolStrict(),
        fetchProtocolFees: get('FAST_WRITER_FETCH_PROTOCOL_FEES').default('true').asBoolStrict(),
        submitOrders: get('FAST_WRITER_SUBMIT_ORDERS').default('true').asBoolStrict(),
        submitEscrowOrders: get('FAST_WRITER_SUBMIT_ESCROW_ORDERS').default('false').asBoolStrict(),
        waitForReceipt: get('FAST_WRITER_WAIT_FOR_TX').default('false').asBoolStrict(),
        destinationAddress: get('FAST_WRITER_DESTINATION_ADDRESS').default('0xunsupported').asString(),
        asset: get('FAST_WRITER_ASSET').default('0x00000000').asString(),
        rewardAsset: get('FAST_WRITER_REWARD_ASSET')
            .required()
            .default('0x0000000000000000000000000000000000000000')
            .asString(),
        insurance: get('FAST_WRITER_INSURANCE_GWEI').default('50000000').asString(),
        maxAmount: get('FAST_WRITER_MAX_AMOUNT_GWEI').default('10000000').asString(),
        delaySec: get('FAST_WRITER_DELAY_SEC').default('1').asInt(),
        delayStressL3Sec: get('FAST_WRITER_L3_STRESS_DELAY_MS').default('1000').asInt(),
        disabledNetworks: get('FAST_WRITER_NETWORKS_DISABLED').default('ethereum').asArray(),
    },
    prophet: {
        useOrderMissingExecutorStatus: get('PROPHET_USE_ORDER_MISSING_EXECUTOR_STATUS').default('false').asBoolStrict(),
        listenRemoteOrderCreatedEvents: get('PROPHET_LISTEN_REMOTE_ORDER_CREATED_EVENTS').default('true').asBoolStrict(),
        pushNewOrdersToSQS: get('PROPHET_PUSH_NEW_ORDERS_TO_SQS').default('false').asBoolStrict(),
        enableExoticNetworks: get('PROPHET_ENABLE_EXOTIC_NETWORKS').default('false').asBoolStrict(),
        processPlacedOrdersTillHalf: get('PROPHET_PROCESS_PLACED_ORDERS_TILL_HALF').default('false').asBoolStrict(),
        processMissingConfirmation: get('PROPHET_PROCESS_MISSING_CONFIRMATION').default('true').asBoolStrict(),
        processConfirmedRefundConfirmation: get('PROPHET_PROCESS_CONFIRMED_REFUND_CONFIRMATION')
            .default('false')
            .asBoolStrict(),
        processMissingExecutorField: {
            enabled: get('PROPHET_PROCESS_MISSING_EXECUTOR_FIELD_ENABLED').default('true').asBoolStrict(),
            fetchItemCount: get('PROPHET_PROCESS_MISSING_EXECUTOR_FIELD_FETCH_ITEM_COUNT').default(100).asInt(),
        },
        processingEvents: {
            claimed: {
                processClaimedEventOnRefund: get('PROPHET_PROCESS_CLAIMED_EVENT_ON_REFUND').default('true').asBoolStrict(),
            },
        },
        processEscrowOrders: get('PROPHET_PROCESS_ESCROW_ORDERS').default('false').asBoolStrict(),
        listenAVPEvents: get('PROPHET_LISTEN_AVP_EVENTS').default('false').asBoolStrict(),
        expireOrders: {
            enabled: get('PROPHET_EXPIRE_ORDERS_ENABLED').default('true').asBoolStrict(),
            expirationMinutes: get('PROPHET_BID_EXPIRATION_MINUTES').default(25).asInt(),
            expirationMinutesWithBuffer: get('PROPHET_BID_EXPIRATION_MINUTES_WITH_BUFFER').default(30).asInt(),
            expirationPendingNoBidsMinutes: get('PROPHET_BID_EXPIRATION_PENDING_NO_BIDS_MINUTES').default(20).asInt(),
            fetchedItemsCount: get('PROPHET_FETCHED_ITEMS_COUNT').default(32).asInt(),
            waitTimeSec: get('PROPHET_EXPIRE_ORDERS_WAIT_TIME_SEC').default(3).asInt(),
        },
        storeLastBlockNumber: get('PROPHET_STORE_LAST_BLOCK_NUMBER').default('false').asBoolStrict(),
        processNonClaimableEvents: get('PROPHET_PROCESS_NON_CLAIMABLE_EVENTS').default('false').asBoolStrict(),
        listenGasConsumedEvents: get('PROPHET_LISTEN_GAS_CONSUMED_EVENTS').default('true').asBoolStrict(),
        listenGasConsumedExecuteEvents: get('PROPHET_LISTEN_GAS_CONSUMED_EVENTS').default('true').asBoolStrict(),
        listenGasConsumedOrderCreatedEvents: get('PROPHET_LISTEN_GAS_CONSUMED_EVENTS').default('false').asBoolStrict(),
        processNonRefundableEvents: get('PROPHET_PROCESS_NON_REFUNDABLE_EVENTS').default('true').asBoolStrict(),
        processClaimedBatchEvents: get('PROPHET_CLAIMED_BATCH_EVENTS').default('false').asBoolStrict(),
        enableMonitorWalletBalance: get('PROPHET_ENABLE_MONITOR_WALLET_BALANCE').default('true').asBoolStrict(),
        enableRotateAttestersCommittee: get('PROPHET_ENABLE_ROTATE_ATTESTERS_COMMITTEE').default('true').asBoolStrict(),
        enableRPCListeners: get('PROPHET_ENABLE_RPC_LISTENERS').default('true').asBoolStrict(),
        supportConfirmationBookUpdates: get('PROPHET_SUPPORT_CONFIRMATION_BOOK_UPDATES').default('false').asBoolStrict(),
        listenBonusesL3: get('PROPHET_LISTEN_BONUSES_L3').default('true').asBoolStrict(),
        adHocFetchMissingBidWinner: get('PROPHET_ADHOC_FETCH_MISSING_BID_WINNER').default('true').asBoolStrict(),
        backdoorNonClaimable: get('PROPHET_BACKDOOR_NON_CLAIMABLE').default('false').asBoolStrict(),
        checkForConfirmedRefunds: get('PROPHET_CHECK_FOR_CONFIRMED_REFUNDS').default('false').asBoolStrict(),
        processSQS: get('PROPHET_PROCESS_SQS').default('true').asBoolStrict(),
        processSQSDLQ: get('PROPHET_PROCESS_SQS_DLQ').default('false').asBoolStrict(),
        eventProcessorCount: get('PROPHET_EVENT_PROCESSOR_COUNT').default(50).asInt(),
        eventProcessorDLQCount: get('PROPHET_EVENT_PROCESSOR_DLQ_COUNT').default(12).asInt(),
        txReceiptAwaitTimeoutSec: get('PROPHET_TX_RECEIPT_AWAIT_TIMEOUT_SEC').default(12).asInt(),
        confirmationWaitTimeSec: get('PROPHET_CONFIRMATION_WAIT_TIME_SEC').default(30).asInt(),
        returnEventTimestampAsDateNow: get('PROPHET_RETURN_EVENT_TIMESTAMP_AS_DATE_NOW').default('false').asBoolStrict(),
        sortSQSEventsByPriority: get('PROPHET_SORT_SQS_EVENTS_BY_PRIORITY').default('false').asBoolStrict(),
    },
    transmitter: {
        listenNewBlock: get('TRANSMITTER_LISTEN_NEW_BLOCK').default('true').asBoolStrict(),
        preSyncNonceManager: get('TRANSMITTER_PRE_SYNC_NONCE_MANAGER').default('true').asBoolStrict(),
        backoffEventNameBatchItem: get('TRANSMITTER_BACKOFF_EVENT_NAME_BATCH_ITEM').default('backoff_batch').asString(),
        queueCapacity: get('TRANSMITTER_QUEUE_CAPACITY').default(1000).asInt(),
        preLoadNonce: get('TRANSMITTER_PRE_LOAD_NONCE').default('false').asBoolStrict(),
        backoffEventNameSingleItem: get('TRANSMITTER_BACKOFF_EVENT_NAME_SINGLE_ITEM').default('backoff_single').asString(),
        backoffEventNameTxReceipt: get('TRANSMITTER_BACKOFF_EVENT_NAME_TX_RECEIPT')
            .default('backoff_tx_receipt')
            .asString(),
        defaultTxBackoffSec: get('TRANSMITTER_DEFAULT_TX_BACKOFF_SEC').default(5).asInt(),
        logQueueStatsWaitTimeSec: get('TRANSMITTER_LOG_QUEUE_STATS_WAIT_TIME_SEC').default(30).asInt(),
        useSliceForSendOuts: get('USE_SLICE_FOR_SEND_OUTS').default('false').asBoolStrict(),
        maxTxRetries: get('TRANSMITTER_MAX_TX_RETRIES').default(4).asInt(),
        queueIntervalL3Sec: get('TRANSMITTER_QUEUE_L3_INTERVAL_SEC').default(5).asInt(),
        queueIntervalSec: get('TRANSMITTER_QUEUE_INTERVAL_SEC').default(4).asInt(),
        parallelSendOutSize: get('TRANSMITTER_PARALLEL_SEND_OUT_SIZE').default(1).asInt(),
        txReceiptAwaitTimeoutSec: get('TRANSMITTER_TX_RECEIPT_AWAIT_TIMEOUT_SEC').default(40).asInt(),
        txReceiptRecoverIntervalSec: get('TRANSMITTER_TX_RECEIPT_RECOVER_INTERVAL_SEC').default(4).asInt(),
        txReceiptRecoverTimeoutSec: get('TRANSMITTER_TX_RECEIPT_RECOVER_TIMEOUT_SEC').default(40).asInt(),
        maxTxPerBlock: get('TRANSMITTER_MAX_TX_PER_BLOCK').default(500).asInt(),
        maxTxPerBlockL2: get('TRANSMITTER_MAX_TX_PER_BLOCK').default(50).asInt(),
        maxAVPAttestPendingReceiptItems: get('TRANSMITTER_MAX_AVP_ATTEST_PENDING_RECEIPT_ITEMS').default(10).asInt(),
        maxAVPAttestQueueItems: get('TRANSMITTER_MAX_AVP_ATTEST_QUEUE_ITEMS').default(2).asInt(),
        coalesceAVPBatch: get('TRANSMITTER_COALESCE_AVP_BATCH').default('true').asBoolStrict(),
        coalesceAVPClaim: get('TRANSMITTER_COALESCE_AVP_CLAIM').default('true').asBoolStrict(),
        maxAVPBatchSize: get('TRANSMITTER_MAX_AVP_BATCH_SIZE').default(6).asInt(),
    },
    monitor: {
        monitorDoubleSpend: get('MONITOR_DOUBLE_SPEND').default('true').asBoolStrict(),
        monitorAttestations: get('MONITOR_ATTESTATIONS').default('false').asBoolStrict(),
        adjustOrderTimeout: get('MONITOR_ADJUST_ORDER_TIMEOUT').default('false').asBoolStrict(),
        adjustBidDifficulty: get('MONITOR_ADJUST_BID_DIFFICULTY').default('false').asBoolStrict(),
        observeBRNRewards: get('MONITOR_OBSERVE_BRN_REWARDS').default('false').asBoolStrict(),
        startUpdatingExecutorsBalances: get('MONITOR_START_UPDATING_EXECUTORS_BALANCES').default('false').asBoolStrict(),
        orderTimeoutAdjustmentIntervalSec: get('MONITOR_ORDER_TIMEOUT_ADJUSTMENT_INTERVAL_SEC').default(1800).asInt(),
        orderStatusCountMetricsIntervalSec: get('MONITOR_ORDER_STATUS_COUNT_METRICS_INTERVAL_SEC')
            .default(60 * 15)
            .asInt(),
        orderStatusMetricsIntervalSec: get('MONITOR_ORDER_STATUS_METRICS_INTERVAL_SEC').default(60).asInt(),
        orderStatusCountTotalMetricsIntervalSec: get('MONITOR_ORDER_STATUS_METRICS_INTERVAL_SEC').default(60).asInt(),
        gasFeeLimitThreshold: get('MONITOR_GAS_FEE_LIMIT_THRESHOLD').default(100).asInt(),
        bidDifficultyDecreaseLimit: get('MONITOR_BID_DIFFICULTY_DECREASE_LIMIT').default(1000000000).asInt(),
        bidDifficultyIncreaseLimit: get('MONITOR_BID_DIFFICULTY_INCREASE_LIMIT').default(5000000000).asInt(),
        bidDifficultyIncreaseLimitMax: get('MONITOR_BID_DIFFICULTY_INCREASE_LIMIT_MAX').default(1024).asInt(),
    },
    dynamo: {
        // 7 day for TTL
        orderTTL: get('ORDER_TTL')
            .default(7 * (60 * 60 * 24))
            .asInt(),
    },
    passport: {
        apiKey: get('GITCOIN_PASSPORT_API_KEY').default('').asString(),
        scorerId: get('GITCOIN_PASSPORT_SCORER_ID').default(11684).asIntPositive(),
        passingScore: get('GITCOIN_PASSPORT_PASSING_SCORE').default(20).asIntPositive(),
        endpointPassword: get('GITCOIN_ENDPOINT_PASSWORD').default('2(K0_290TCza').asString(),
    },
    aws: {
        region: get('AWS_REGION').default('eu-west-1').asString(),
        sqs: {
            enabled: get('AWS_SQS_ENABLED').default('true').asBoolStrict(),
            eventListenerQueue: get('SQS_EVENT_LISTENER_QUEUE').default('guardian-events').asString(),
            eventListenerQueueDLQ: get('SQS_EVENT_LISTENER_QUEUE_DLQ').default('guardian-events-DLQ').asString(),
            placerOrderQueue: get('SQS_PLACER_ORDER_QUEUE').default('guardian-events-orderCreated').asString(),
            placerOrderQueueDLQ: get('SQS_PLACER_ORDER_QUEUE_DLQ').default('guardian-events-orderCreated-DLQ').asString(),
            backdoorBatchHashQueue: get('SQS_BACKDOOR_BATCH_HASH_QUEUE').default('guardian-backdoor-batch-hash').asString(),
            signalSegmentsProductionQueue: get('SQS_SIGNAL_SEGMENTS_PRODUCTION_QUEUE')
                .default('guardian-signal-segments-production')
                .asString(),
            backdoorBatchHashQueueDLQ: get('SQS_BACKDOOR_BATCH_HASH_QUEUE_DLQ')
                .default('guardian-backdoor-batch-hash-DLQ')
                .asString(),
            transmitterPendingTxReceiptsQueue: get('SQS_TRANSMITTER_PENDING_TX_RECEIPTS_QUEUE')
                .default('guardian-transmitter-pending-tx-receipts')
                .asString(),
            transmitterPendingTxReceiptsQueueDLQ: get('SQS_TRANSMITTER_PENDING_TX_RECEIPTS_QUEUE_DLQ')
                .default('guardian-transmitter-pending-tx-receipts-DLQ')
                .asString(),
            maxNumberOfMessages: get('SQS_MAX_MESSAGES').default(10).asInt(),
            waitTimeSeconds: get('SQS_WAIT_TIME_SECONDS').default(20).asInt(), // 20 seconds is max for SQS long polling
            preCheckForDedup: get('SQS_PRE_CHECK_FOR_DEDUP').default('true').asBoolStrict(),
        },
        redshift: {
            enabled: get('AWS_REDSHIFT_ENABLED').default('false').asBoolStrict(),
            workGroupName: get('REDSHIFT_WORK_GROUP_NAME').default('default-workgroup').asString(),
            database: get('REDSHIFT_DATABASE').default('guardian_orders').asString(),
        },
    },
    redis: {
        cacheUrl: get('REDIS_CACHE_URL').default('redis://localhost:6379').asString(),
        cacheEnabled: get('REDIS_CACHE_ENABLED').default('true').asBoolStrict(),
    },
    moralis: {
        apiKey: get('MORALIS_API_KEY').default('').asString(),
    },
    parachain: {
        networks: get('PARACHAIN_NETWORKS').default('t0rn,t1rn,t2rn').asArray(),
    },
    shutdown: {
        waitMaxSec: get('SHUTDOWN_WAIT_MAX_SEC').default(30).asIntPositive(),
        waitBetweenRetriesSec: get('SHUTDOWN_WAIT_BETWEEN_RETRIES_SEC').default(5).asIntPositive(),
    },
    distributor: {
        autoClaim: {
            enabled: get('DISTRIBUTOR_AUTO_CLAIM_ENABLED').default('true').asBoolStrict(),
            checkAlreadyClaimed: get('DISTRIBUTOR_AUTO_CLAIM_CHECK_ALREADY_CLAIMED').default('true').asBoolStrict(),
            fetchLimit: get('DISTRIBUTOR_AUTO_CLAIM_FETCH_LIMIT').default(50).asIntPositive(),
            batchLimit: get('DISTRIBUTOR_AUTO_CLAIM_BATCH_LIMIT').default(50).asIntPositive(),
            sleepSec: get('DISTRIBUTOR_AUTO_CLAIM_SLEEP_SEC').default(1).asIntPositive(),
            sleepSecEmpty: get('DISTRIBUTOR_AUTO_CLAIMS_SLEEP_SEC_EMPTY').default(30).asIntPositive(),
        },
        autoRefunds: {
            enabled: get('DISTRIBUTOR_AUTO_REFUNDS_ENABLED').default('true').asBoolStrict(),
            fetchLimit: get('DISTRIBUTOR_AUTO_REFUNDS_FETCH_LIMIT').default(100).asIntPositive(),
            sleepSecEmpty: get('DISTRIBUTOR_AUTO_REFUNDS_SLEEP_SEC_EMPTY').default(30).asIntPositive(),
            sleepSec: get('DISTRIBUTOR_AUTO_REFUNDS_SLEEP_SEC').default(1).asIntPositive(),
        },
        invalidPendingRefundLimit: get('DISTRIBUTOR_INVALID_PENDING_REFUND_LIMIT').default(15).asIntPositive(),
        protocolFeeWithdrawAmountThresholdGwei: get('DISTRIBUTOR_PROTOCOL_FEE_WITHDRAW_AMOUNT_THRESHOLD_GWEI')
            .default(1000)
            .asIntPositive(),
        enableProcessingFallbackRecovery: get('DISTRIBUTOR_ENABLE_PROCESSING_FALLBACK_RECOVERY')
            .default('false')
            .asBoolStrict(),
        enableProcessingInvalidPendingRefunds: get('DISTRIBUTOR_ENABLE_PROCESSING_INVALID_PENDING_REFUNDS')
            .default('false')
            .asBoolStrict(),
        verifyIsExecuted: get('DISTRIBUTOR_VERIFY_IS_EXECUTED').default('true').asBoolStrict(),
        enableAutoInsuranceClaimOnFlight: get('DISTRIBUTOR_ENABLE_AUTO_INSURANCE_CLAIM_ON_FLIGHT')
            .default('false')
            .asBoolStrict(),
        validatePayloadAutoClaimOnFlight: get('DISTRIBUTOR_ENABLE_AUTO_CLAIM_ON_FLIGHT').default('true').asBoolStrict(),
        enableAutoChargeOperators: get('DISTRIBUTOR_ENABLE_AUTO_CHARGE_OPERATORS').default('true').asBoolStrict(),
        archivedNetworksEnabled: get('DISTRIBUTOR_ARCHIVED_NETWORKS_ENABLED').default('false').asBoolStrict(),
        fetchAndLogPendingRefunds: get('DISTRIBUTOR_FETCH_AND_LOG_PENDING_REFUNDS').default('false').asBoolStrict(),
        enableRemoteOrderAdminsMonitoring: get('DISTRIBUTOR_ENABLE_REMOTE_ORDER_ADMINS_MONITORING')
            .default('true')
            .asBoolStrict(),
        enableGasFeeLimitsUpdate: get('DISTRIBUTOR_ENABLE_GAS_FEE_LIMITS_UPDATE').default('true').asBoolStrict(),
        pendingRefundLimitSize: get('DISTRIBUTOR_PENDING_REFUND_LIMIT_SIZE').default(120).asIntPositive(),
        updateGasFeeLimitsIntervalSec: get('DISTRIBUTOR_UPDATE_GAS_FEE_LIMITS_INTERVAL_SEC')
            .default(60 * 60)
            .asIntPositive(),
        disabledNetworks: get('DISTRIBUTOR_NETWORKS_DISABLED').default('').asArray(),
    },
    placer: {
        enabled: get('PLACER_PROCESS_PLACED_ORDERS').default('true').asBoolStrict(),
        enabledOrderCache: get('PLACER_ENABLE_ORDER_CACHE').default('true').asBoolStrict(),
        updateUnsupportedNetworkStatus: get('PLACER_UPDATE_UNSUPPORTED_NETWORK_STATUS').default('false').asBoolStrict(),
        placeExoticOrders: get('PLACER_PLACE_EXOTIC_ORDERS').default('true').asBoolStrict(),
        checkCachedOrders: get('PLACER_CHECK_CACHED_ORDERS').default('false').asBoolStrict(),
        intervalSec: get('PLACER_PROCESS_PLACED_ORDERS_INTERVAL_SEC').default(1).asInt(),
        exoticIntervalSec: get('PLACER_PROCESS_PLACED_ORDERS_INTERVAL_SEC').default(12).asInt(),
        fetchLimit: get('PLACER_PROCESS_PLACED_ORDERS_FETCH_LIMIT').default(100).asInt(),
        batchEnabled: get('PLACER_PROCESS_PLACED_ORDERS_BATCH_ENABLED').default('true').asBoolStrict(),
        batchSize: get('PLACER_PROCESS_PLACED_ORDERS_BATCH_SIZE').default(85).asInt(),
        processPlacedOrdersFromSQS: get('PLACER_PROCESS_PLACED_ORDERS_FROM_SQS').default('true').asBoolStrict(),
        sqsProcessorCount: get('PLACER_SQS_PROCESSOR_COUNT').default(32).asInt(),
        sqsDLQProcessorCount: get('PLACER_SQS_DLQ_PROCESSOR_COUNT').default(4).asInt(),
    },
    messiah: {
        enableRedis: get('MESSIAH_ENABLE_REDIS').default('true').asBoolStrict(),
        blockQuickNodeRPC: get('MESSIAH_BLOCK_QUICK_NODE_RPC').default('true').asBoolStrict(),
        startLocalSQSQueue: get('MESSIAH_START_LOCAL_SQS_QUEUE').default('false').asBoolStrict(),
        noProphetMode: get('MESSIAH_NO_PROPHET_MODE').default('true').asBoolStrict(),
        checkForConfirmedRefunds: get('MESSIAH_CHECK_FOR_CONFIRMED_REFUNDS').default('false').asBoolStrict(),
        resetLastBlockAtRestartPod0: get('MESSIAH_RESET_LAST_BLOCK_AT_RESTART_POD_0').default('false').asBoolStrict(),
        resetLastBlockAtRestartPod1: get('MESSIAH_RESET_LAST_BLOCK_AT_RESTART_POD_1').default('false').asBoolStrict(),
        trackGasConsumedAddOns: get('MESSIAH_TRACK_GAS_CONSUMED_ADD_ONS').default('true').asBoolStrict(),
        handleEventsWithSQS: get('MESSIAH_HANDLE_EVENTS_SQS').default('true').asBoolStrict(),
        reportStatements: get('MESSIAH_REPORT_STATEMENTS').default('false').asBoolStrict(),
        produceHourlyStatements: get('MESSIAH_PRODUCE_HOURLY_STATEMENTS').default('false').asBoolStrict(),
        fetchBlockSize: get('MESSIAH_FETCH_BLOCK_SIZE').default(2).asInt(),
        maxFetchBlockSize: get('MESSIAH_FETCH_BLOCK_SIZE').default(256).asInt(),
        waitOnNewBlockSec: get('MESSIAH_WAIT_ON_NEW_BLOCK_SEC').default(10).asInt(),
        safeStartingBlockOffset: get('MESSIAH_SAFE_STARTING_BLOCK_OFFSET').default(5).asInt(),
        pod0MinOffsetMinutes: get('MESSIAH_POD_0_MIN_OFFSET_MINUTES').default(0).asInt(),
        pod1MinOffsetMinutes: get('MESSIAH_POD_1_MIN_OFFSET_MINUTES').default(12).asInt(),
        submitPolymerOrderCreatedProofs: get('PROPHET_SUBMIT_POLYMER_ORDER_CREATED_PROOFS').default('false').asBoolStrict(),
        submitPolymerOrderConfirmedProofs: get('PROPHET_SUBMIT_POLYMER_ORDER_CONFIRMED_PROOFS')
            .default('false')
            .asBoolStrict(),
        maxTowerFetchSize: get('MESSIAH_TOWER_FETCH_SIZE').default(16).asInt(),
        dlqEnabled: get('MESSIAH_DLQ_ENABLED').default('false').asBoolStrict(),
        pod0SkipDBVerify: get('MESSIAH_POD_0_SKIP_DB_VERIFY').default('false').asBoolStrict(),
        pod1SkipDBVerify: get('MESSIAH_POD_1_SKIP_DB_VERIFY').default('false').asBoolStrict(),
        filterOutBots: get('MESSIAH_FILTER_OUT_BOTS').default('false').asBoolStrict(),
        usePublicRpcForPods: get('MESSIAH_USE_PUBLIC_RPC_PODS').default('').asArray(),
        genesisTimePod0: get('MESSIAH_POD_0_GENESIS_TIME').default('0').asString(),
        genesisTimePod1: get('MESSIAH_POD_1_GENESIS_TIME').default('2025-05-24T05:00:00Z').asString(),
        disabledNetworks: get('MESSIAH_NETWORKS_DISABLED').default('').asArray(),
        disabledNetworksPod1: get('MESSIAH_NETWORKS_DISABLED_POD_1')
            .default('binance-testnet,sei-testnet,monad-testnet,berachain-bepolia')
            .asArray(),
    },
};
exports.default = config;
//# sourceMappingURL=config.js.map