import { BigNumber } from 'ethers';
import { Logger } from '../utils/logger';
import { Config } from '../config/config';
import { Prometheus } from '../prometheus';
import { NetworkConfig } from '../config/types';
import { OrderArbitrageStrategies, OrderArbitrageStrategy } from '../config/executor-arbitrage-strategies';
import { Sieve } from '../transmitter/sieve';
import { Transmitter } from '../transmitter/transmitter.service';
import { BatchQueueItem, QueueItem } from '../transmitter/types';
import { OrderService } from '../order/order.service';
import { Order } from '../order/types';
import { AssetName, AssetNumber } from '../pricer/enums';
import { PricerApi } from '../pricer/pricer-api';
import { NetworkIdT3rn, OrderProfitability } from '../pricer/types';
export declare class Executor {
    private readonly prometheus;
    private shutdownInProgress;
    private readonly config;
    readonly sieve: Sieve;
    private readonly wallet;
    private readonly walletBalances;
    private readonly nonceManager;
    private readonly rpc;
    private readonly transmitter;
    private readonly orderService;
    private readonly pricerApi;
    private escrowGmpContract;
    private remoteOrderContract;
    private claimerGMP;
    private attestersContract;
    private avpBatchSubmitterContract;
    private erc20MockContract;
    private protocolFees;
    private protocolFeesMin;
    private protocolFeesMax;
    private orderBookContract;
    private escrowOrderBookContract;
    private singleAttestationBookContract;
    private singleAttestationBookContractV1;
    private singleAttestationBookContractV2;
    private singleAttestationBookContractV3;
    private attestationBatchMakerContract;
    private attestationBatchMakerRemoteContract;
    private biddingBookContract;
    private confirmationBookContract;
    private readonly enabledNetworks;
    readonly enabledNetworksIds: NetworkIdT3rn[];
    private insurance;
    private sumOfNative;
    private gasPriceL3;
    private rewardsOn;
    private haltProcessingNewOrders;
    private dbBidsWon;
    private readonly networkConfigL3;
    bidQueue: Order[];
    private arbitrageStrategies;
    private priceNetworkMap;
    private balancesLocalCache;
    private readonly balancesCacheTTLSec;
    private processExecutionsIntervalSec;
    private processOrdersIntervalSec;
    private rejectionReasons;
    constructor(_config: Config, prometheus: Prometheus);
    getConfig(): Config;
    getPricerApi(): PricerApi;
    getPrometheus(): Prometheus;
    getTransmitterL3(): Transmitter | undefined;
    getGasPriceL3(): BigNumber;
    getOrderService(): OrderService;
    getMyAddress(): string;
    getPendingOrdersInterval(): number;
    getPendingExecutionsInterval(): number;
    getBalances(): Record<string, BigNumber>;
    /**
     *
     * Fetches the balances of all tokens for the current executor.
     *
     */
    getBalancesWithTokens(): Promise<Record<string, Record<string, string>>>;
    getHaltProcessingNewOrders(): boolean;
    getInsurance(): BigNumber;
    getTransmitter(): Map<string, Transmitter>;
    getArbitrageStrategies(): OrderArbitrageStrategies;
    setArbitrageStrategies(newStrategies: OrderArbitrageStrategies): void;
    getEnabledNetworksIds(): NetworkIdT3rn[];
    getExecutorEnabledNetworksAndAssets(): {
        networkIds: NetworkIdT3rn[];
        assets: AssetName[];
    };
    handleProcessNewOrderApi(...args: Parameters<typeof this.processNewOrderApi>): boolean;
    rebalanceWallet(address: string, amount: string, sourceNetwork: NetworkIdT3rn, destinationNetwork: NetworkIdT3rn, fromAsset: AssetName, toAsset: AssetName): Promise<{
        id: string;
        txHash: string;
        nonce: number;
        orderTimestamp: number;
        sender: string;
    }>;
    init(): Promise<void>;
    /**
     * Starts all continuous processes and service instances for the Prophet service
     */
    start(): void;
    startFetchingAssetPrices(): Promise<void>;
    gasPriceFetcher(): Promise<void>;
    protocolFeeFetcher(networkId: NetworkIdT3rn): Promise<void>;
    getProtocolFee(networkId: NetworkIdT3rn): BigNumber;
    getProtocolFeeFlatMin(networkId: NetworkIdT3rn): BigNumber;
    getProtocolFeeFlatMax(networkId: NetworkIdT3rn): BigNumber;
    intervalsFetcher(): Promise<void>;
    /**
     * Returns the current shutdown state of the service
     */
    isShutdownInProgress(): boolean;
    /**
     * Triggers a shutdown process of the service, by removing listeners for new incoming orders,
     * and waiting for Transmitter queues to process and dry out.
     */
    triggerShutdown(): Promise<void>;
    /**
     * Listen for RemoteOrderCreated events on L3
     *
     * @param {NetworkConfig} network
     */
    listenOrderCreatedEventsOnL3(network: NetworkConfig): void;
    /**
     * Listen for Claimed events
     *
     * @param {NetworkConfig} network
     */
    listenClaimedEvents(network: NetworkConfig): void;
    /**
     * Listen for OutbidReceived events on L3
     *
     * @param {NetworkConfig} network
     */
    listenOutbidReceivedEventsOnL3(network: NetworkConfig): void;
    onBatchBidComplete(queueItem: BatchQueueItem): Promise<void>;
    private onBidOrderComplete;
    /**
     * Proceeds with executing the order, if the bid has been won by the current executor
     *
     * @param {queueItem} queueItem
     */
    onBidComplete(queueItem: QueueItem): Promise<void>;
    onBidOrderFailed(order: Order, error?: string, executor?: string, bidWinner?: string, txHash?: string): void;
    onBidFailed(queueItem: QueueItem, executor?: string, bidWinner?: string): void;
    onExecuteComplete(queueItem: QueueItem): void;
    onExecuteFailed(queueItem: QueueItem): void;
    onExecuteBatchComplete(queueItem: BatchQueueItem): void;
    onExecuteBatchFailed(queueItem: BatchQueueItem): void;
    /**
     * This function is triggered when an order is successfully claimed after being attested.
     * It updates the metrics.
     *
     * @param sourceNetwork
     * @param amount
     * @param _assetAddress
     * @param {Logger}  childLogger
     */
    private onClaimedSuccess;
    private areAssetsSupported;
    private areOrderNetworksValid;
    pushRejectionReason(reason: string | null): void;
    verifyUnderbidMargin(order: Order, profit: BigNumber): {
        proceed: boolean;
        availableUnderbidMarginInUSD: number;
        availableUnderbidMarginInAssetWei: BigNumber;
        proposePercentageDrop: number;
        proposedUnderbidAmountInUSD: number;
        proposedUnderbidAmountInAssetWei: BigNumber;
    };
    /**
     * Processes a new order received from RemoteOrderCreated event.
     *
     * @param {Order} order
     * @param {Logger}  childLogger
     * @param {boolean} transmitBid
     */
    private processNewOrderApi;
    private logRejectionReasons;
    /**
     * Processes a new order received from RemoteOrderCreated event.
     *
     * @param {Order} order
     * @param {Logger}  childLogger
     */
    private processBidQueue;
    private processNewOrder;
    isOrderProfitable(order: Order, profit: BigNumber, loss: BigNumber, isProfitable: boolean, childLogger: Logger): boolean;
    /**
     * Calculates the profitability of an order based on the balance, cost on the destination, strategy, and pricing.
     *
     * @param {Order} order - The order object.
     * @param {BigNumber} balance - The balance of the executor's wallet.
     * @returns {Promise<OrderProfitability>} - Returns an object containing the profitability information.
     */
    private getOrderProfitability;
    evaluateOrderProfitability(order: Order, balance: BigNumber, strategy: OrderArbitrageStrategy): OrderProfitability;
    private evaluateDeal;
    processClaimSegment(networkId: NetworkIdT3rn, batchPayload: string, batchHash: string, orderIds: string[], childLogger: Logger): Promise<void>;
    /**
     * Continuously fetches the current insurance value from the OrderBook contract,
     * and sets it to the insurance class param.
     *
     * @private
     */
    private fetchLatestInsurance;
    /**
     * Checks if the wallet balances are enough to execute transactions.
     *
     * @param {Wallet} sourceWallet - The source wallet object.
     * @param {Wallet} destinationWallet - The destination wallet object.
     * @param {any} childLogger - The child logger object.
     * @returns {Promise<boolean>} - Returns TRUE if the wallet balances are enough, FALSE otherwise
     */
    private isWalletBalanceEnough;
    /**
     * Initializes the listeners on the Transmitter instance for the given network and start the instance.
     *
     * @param {NetworkIdT3rn}  networkId
     */
    private initTransmitterListenersAndStart;
    /**
     * For all active Arbitrage strategies, set infinite allowance for traded tokens for RemoteOrder contract
     *
     * @private
     */
    private setInfiniteAllowanceForRemoteOrderContract;
    getBalance(networkId: NetworkIdT3rn, assetId?: number | undefined): BigNumber;
    getBalanceByKey(key: string): BigNumber;
    /**
     * Returns the asset key on the network
     *
     * @param networkId - The network ID
     * @param assetId - The asset ID
     * @returns {string} - The asset key on the network
     */
    getAssetOnNetworkKey(networkId: NetworkIdT3rn, assetId: AssetNumber): string;
    /**
     * Subscribes to token balance fetch for the given asset on the given network
     *
     * @param networkId - The network ID
     * @param assetId - The asset ID
     * @param provider - The provider
     * @param childLogger - The child logger
     * @returns {Promise<void>}
     */
    private subscribeTokenBalanceFetch;
}
//# sourceMappingURL=executor.service.d.ts.map