import { Contract, EventFilter } from "ethers";
import winston from "winston";
import { CachingMechanismInterface, CancelledRootBundle, CrossChainContractsSet, Deposit, DepositWithBlock, DestinationTokenWithBlock, DisputedRootBundle, ExecutedRootBundle, TokenInfo, Log, LpToken, PendingRootBundle, ProposedRootBundle, RealizedLpFee, TokenRunningBalance, L1TokenInfo } from "../interfaces";
import { EVMBlockFinder } from "../arch/evm";
import { BigNumber, EventSearchConfig, MakeOptional, EvmAddress, Address } from "../utils";
import { AcrossConfigStoreClient as ConfigStoreClient } from "./AcrossConfigStoreClient/AcrossConfigStoreClient";
import { BaseAbstractClient, UpdateFailureReason } from "./BaseAbstractClient";
type HubPoolUpdateSuccess = {
    success: true;
    currentTime: number;
    pendingRootBundleProposal: PendingRootBundle;
    events: Record<string, Log[]>;
    searchEndBlock: number;
};
type HubPoolUpdateFailure = {
    success: false;
    reason: UpdateFailureReason;
};
export type HubPoolUpdate = HubPoolUpdateSuccess | HubPoolUpdateFailure;
type HubPoolEvent = "SetPoolRebalanceRoute" | "L1TokenEnabledForLiquidityProvision" | "ProposeRootBundle" | "RootBundleCanceled" | "RootBundleDisputed" | "RootBundleExecuted" | "CrossChainContractsSet";
export type LpFeeRequest = Pick<Deposit, "originChainId" | "inputToken" | "inputAmount" | "quoteTimestamp"> & {
    paymentChainId?: number;
};
export declare class HubPoolClient extends BaseAbstractClient {
    readonly logger: winston.Logger;
    readonly hubPool: Contract;
    configStoreClient: ConfigStoreClient;
    deploymentBlock: number;
    readonly chainId: number;
    protected readonly configOverride: {
        ignoredHubExecutedBundles: number[];
        ignoredHubProposedBundles: number[];
        timeToCache?: number;
    };
    protected l1Tokens: L1TokenInfo[];
    protected lpTokens: {
        [token: string]: LpToken;
    };
    protected proposedRootBundles: ProposedRootBundle[];
    protected canceledRootBundles: CancelledRootBundle[];
    protected disputedRootBundles: DisputedRootBundle[];
    protected executedRootBundles: ExecutedRootBundle[];
    protected crossChainContracts: {
        [l2ChainId: number]: CrossChainContractsSet[];
    };
    protected l1TokensToDestinationTokensWithBlock: {
        [l1Token: string]: {
            [destinationChainId: number]: DestinationTokenWithBlock[];
        };
    };
    protected pendingRootBundle: PendingRootBundle | undefined;
    currentTime: number | undefined;
    readonly blockFinder: EVMBlockFinder;
    constructor(logger: winston.Logger, hubPool: Contract, configStoreClient: ConfigStoreClient, deploymentBlock?: number, chainId?: number, eventSearchConfig?: MakeOptional<EventSearchConfig, "to">, configOverride?: {
        ignoredHubExecutedBundles: number[];
        ignoredHubProposedBundles: number[];
        timeToCache?: number;
    }, cachingMechanism?: CachingMechanismInterface);
    protected hubPoolEventFilters(): Record<HubPoolEvent, EventFilter>;
    hasPendingProposal(): boolean;
    getPendingRootBundle(): PendingRootBundle | undefined;
    getProposedRootBundles(): ProposedRootBundle[];
    getCancelledRootBundles(): CancelledRootBundle[];
    getDisputedRootBundles(): DisputedRootBundle[];
    getExecutedRootBundles(): ExecutedRootBundle[];
    getSpokePoolForBlock(chain: number, block?: number): Address;
    getSpokePoolActivationBlock(chain: number, spokePool: Address): number | undefined;
    getL2TokenForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, latestHubBlock?: number): Address | undefined;
    getL1TokenForL2TokenAtBlock(l2Token: Address, destinationChainId: number, latestHubBlock?: number): EvmAddress | undefined;
    protected getL1TokenForDeposit(deposit: Pick<DepositWithBlock, "originChainId" | "inputToken" | "quoteBlockNumber">): EvmAddress | undefined;
    l2TokenEnabledForL1Token(l1Token: EvmAddress, destinationChainId: number): boolean;
    l2TokenEnabledForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, hubBlockNumber: number): boolean;
    l2TokenHasPoolRebalanceRoute(l2Token: Address, l2ChainId: number, hubPoolBlock?: number): boolean;
    /**
     * @dev If tokenAddress + chain do not exist in TOKEN_SYMBOLS_MAP then this will throw.
     * @param tokenAddress Token address on `chain`
     * @param chainId Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
     * @returns Token info for the given token address on the L2 chain including symbol and decimal.
     */
    getTokenInfoForAddress(address: Address, chainId: number): TokenInfo;
    /**
     * Resolve a given timestamp to a block number on the HubPool chain.
     * @param timestamp A single timestamp to be resolved to a block number on the HubPool chain.
     * @returns The block number corresponding to the supplied timestamp.
     */
    getBlockNumber(timestamp: number): Promise<number>;
    /**
     * For an array of timestamps, resolve each unique timestamp to a block number on the HubPool chain.
     * @dev Inputs are filtered for uniqueness and sorted to improve BlockFinder efficiency.
     * @dev Querying block numbers sequentially also improves BlockFinder efficiency.
     * @param timestamps Array of timestamps to be resolved to a block number on the HubPool chain.
     * @returns A mapping of quoteTimestamp -> HubPool block number.
     */
    getBlockNumbers(timestamps: number[]): Promise<{
        [quoteTimestamp: number]: number;
    }>;
    getCurrentPoolUtilization(l1Token: EvmAddress): Promise<BigNumber>;
    /**
     * For a HubPool token at a specific block number, compute the relevant utilization.
     * @param hubPoolToken HubPool token to query utilization for.
     * @param blocknumber Block number to query utilization at.
     * @param amount Amount to query. If set to 0, the closing utilization at blockNumber is returned.
     * @param amount timestamp Associated quoteTimestamp for query, used for caching evaluation.
     * @param timeToCache Age at which the response is able to be cached.
     * @returns HubPool utilization at `blockNumber` after optional `amount` increase in utilization.
     */
    protected getUtilization(hubPoolToken: EvmAddress, blockNumber: number, depositAmount: BigNumber, timestamp: number, timeToCache: number): Promise<BigNumber>;
    computeRealizedLpFeePct(deposit: LpFeeRequest): Promise<RealizedLpFee>;
    batchComputeRealizedLpFeePct(deposits: LpFeeRequest[]): Promise<RealizedLpFee[]>;
    getL1Tokens(): L1TokenInfo[];
    getTokenInfoForL1Token(l1Token: EvmAddress): L1TokenInfo | undefined;
    getLpTokenInfoForL1Token(l1Token: EvmAddress): LpToken | undefined;
    areTokensEquivalent(tokenA: Address, chainIdA: number, tokenB: Address, chainIdB: number, hubPoolBlock?: number): boolean;
    getSpokeActivationBlockForChain(chainId: number): number;
    isRootBundleValid(rootBundle: ProposedRootBundle, latestMainnetBlock: number): boolean;
    getRootBundleEvalBlockNumberContainingBlock(latestMainnetBlock: number, block: number, chain: number, chainIdListOverride?: number[]): number | undefined;
    getProposedRootBundlesInBlockRange(startingBlock: number, endingBlock: number): ProposedRootBundle[];
    getCancelledRootBundlesInBlockRange(startingBlock: number, endingBlock: number): CancelledRootBundle[];
    getDisputedRootBundlesInBlockRange(startingBlock: number, endingBlock: number): DisputedRootBundle[];
    /**
     * Retrieves token mappings that were modified within a specified block range.
     * @param startingBlock - The starting block of the range (inclusive).
     * @param endingBlock - The ending block of the range (inclusive).
     * @returns An array of destination tokens, each containing the `l2ChainId`, that
     *          were modified within the given block range.
     */
    getTokenMappingsModifiedInBlockRange(startingBlock: number, endingBlock: number): (DestinationTokenWithBlock & {
        l2ChainId: number;
    })[];
    getLatestProposedRootBundle(): ProposedRootBundle;
    getFollowingRootBundle(currentRootBundle: ProposedRootBundle): ProposedRootBundle | undefined;
    getExecutedLeavesForRootBundle(rootBundle: ProposedRootBundle, latestMainnetBlockToSearch: number): ExecutedRootBundle[];
    getValidatedRootBundles(latestMainnetBlock?: number): ProposedRootBundle[];
    getLatestFullyExecutedRootBundle(latestMainnetBlock: number): ProposedRootBundle | undefined;
    getEarliestFullyExecutedRootBundle(latestMainnetBlock: number, startBlock?: number): ProposedRootBundle | undefined;
    getNthFullyExecutedRootBundle(n: number, startBlock?: number): ProposedRootBundle | undefined;
    getLatestBundleEndBlockForChain(chainIdList: number[], latestMainnetBlock: number, chainId: number): number;
    getNextBundleStartBlockNumber(chainIdList: number[], latestMainnetBlock: number, chainId: number): number;
    getOptimisticBundleStartBlockNumber(chainIdList: number[], latestMainnetBlock: number, chainId: number): number;
    getLatestExecutedRootBundleContainingL1Token(block: number, chain: number, l1Token: EvmAddress): ExecutedRootBundle | undefined;
    getRunningBalanceBeforeBlockForChain(block: number, chain: number, l1Token: EvmAddress): TokenRunningBalance;
    getRunningBalanceForToken(l1Token: EvmAddress, executedRootBundle: ExecutedRootBundle | undefined): TokenRunningBalance;
    _update(eventNames: HubPoolEvent[]): Promise<HubPoolUpdate>;
    update(eventsToQuery?: HubPoolEvent[]): Promise<void>;
    protected getBundleEndBlockForChain(proposeRootBundleEvent: ProposedRootBundle, chainId: number, chainIdList: number[]): number;
}
export {};
