import { Contract } from "ethers"; import winston from "winston"; import { EventSearchConfig, MakeOptional } from "../../utils"; import { ConfigStoreVersionUpdate, DisabledChainsUpdate, GlobalConfigUpdate, LiteChainsIdListUpdate, Log, RateModelUpdate, RouteRateModelUpdate, SpokePoolTargetBalance, SpokeTargetBalanceUpdate, TokenConfig } from "../../interfaces"; import { BaseAbstractClient, UpdateFailureReason } from "../BaseAbstractClient"; import { RateModel } from "../../lpFeeCalculator"; type ConfigStoreUpdateSuccess = { success: true; chainId: number; searchEndBlock: number; events: { updatedTokenConfigEvents: Log[]; updatedGlobalConfigEvents: Log[]; globalConfigUpdateTimes: number[]; }; }; type ConfigStoreUpdateFailure = { success: false; reason: UpdateFailureReason; }; export type ConfigStoreUpdate = ConfigStoreUpdateSuccess | ConfigStoreUpdateFailure; export declare const DEFAULT_CONFIG_STORE_VERSION = 0; export declare enum GLOBAL_CONFIG_STORE_KEYS { MAX_RELAYER_REPAYMENT_LEAF_SIZE = "MAX_RELAYER_REPAYMENT_LEAF_SIZE", MAX_POOL_REBALANCE_LEAF_SIZE = "MAX_POOL_REBALANCE_LEAF_SIZE", VERSION = "VERSION", DISABLED_CHAINS = "DISABLED_CHAINS", CHAIN_ID_INDICES = "CHAIN_ID_INDICES", LITE_CHAIN_ID_INDICES = "LITE_CHAIN_ID_INDICES" } export declare class AcrossConfigStoreClient extends BaseAbstractClient { readonly logger: winston.Logger; readonly configStore: Contract; readonly configStoreVersion: number; cumulativeRateModelUpdates: RateModelUpdate[]; cumulativeRouteRateModelUpdates: RouteRateModelUpdate[]; cumulativeMaxRefundCountUpdates: GlobalConfigUpdate[]; cumulativeMaxL1TokenCountUpdates: GlobalConfigUpdate[]; chainIdIndicesUpdates: GlobalConfigUpdate[]; liteChainIndicesUpdates: LiteChainsIdListUpdate[]; cumulativeSpokeTargetBalanceUpdates: SpokeTargetBalanceUpdate[]; cumulativeConfigStoreVersionUpdates: ConfigStoreVersionUpdate[]; cumulativeDisabledChainUpdates: DisabledChainsUpdate[]; hasLatestConfigStoreVersion: boolean; chainId: number | undefined; constructor(logger: winston.Logger, configStore: Contract, eventSearchConfig: MakeOptional | undefined, configStoreVersion: number); getRateModelForBlockNumber(l1Token: string, originChainId: number | string, destinationChainId: number | string, blockNumber?: number | undefined): RateModel; getRouteRateModelForBlockNumber(l1Token: string, route: string, blockNumber?: number | undefined): RateModel | undefined; /** * Resolve the implied set of chain ID indices based on the chain ID of the ConfigStore. * @param chainId Chain ID of the ConfigStore. * @dev If the resolved chain ID is part of the default set, assume the protocol defaults. * Otherwise, assume this is a test deployment with a lone chain ID. * @dev The protocol defaults are [1, 10, 137, 288, 42161] (outlined in UMIP-157). * @dev chainId is marked optional to appease tsc. It must always be passed in. */ protected implicitChainIdIndices(chainId?: number): number[]; /** * Resolves the chain ids that were available to the protocol at a given block range. * @param blockNumber Block number to search for. Defaults to latest block. * @returns List of chain IDs that were available to the protocol at the given block number. * @note This dynamic functionality has been added after the launch of Across. * @note This function will return a default list of chain IDs if the block requested * existed before the initial inclusion of this dynamic key/value entry. In the * case that a block number is requested that is before the initial inclusion of * this key/value entry, the function will return the default list of chain IDs as * outlined per the UMIP (https://github.com/UMAprotocol/UMIPs/pull/590). */ getChainIdIndicesForBlock(blockNumber?: number): number[]; /** * Resolves the lite chain ids that were available to the protocol at a given block range. * @param blockNumber Block number to search for. Defaults to latest block. * @returns List of lite chain IDs that were available to the protocol at the given block number. * @note This dynamic functionality has been added after the launch of Across. */ getLiteChainIdIndicesForBlock(blockNumber?: number): number[]; /** * Resolves the lite chain ids that were available to the protocol at a given timestamp. * @param timestamp Timestamp to search for. Defaults to latest time - in seconds. * @returns List of lite chain IDs that were available to the protocol at the given timestamp. * @note This dynamic functionality has been added after the launch of Across. */ getLiteChainIdIndicesForTimestamp(timestamp?: number): number[]; /** * Checks if a chain ID was a lite chain at a given timestamp. * @param chainId The chain ID to check. * @param timestamp The timestamp to check. Defaults to latest time - in seconds. * @returns True if the chain ID was a lite chain at the given timestamp. False otherwise. */ isChainLiteChainAtTimestamp(chainId: number, timestamp?: number): boolean; getSpokeTargetBalancesForBlock(l1Token: string, chainId: number, blockNumber?: number): SpokePoolTargetBalance; getMaxRefundCountForRelayerRefundLeafForBlock(blockNumber?: number): number; getMaxL1TokenCountForPoolRebalanceLeafForBlock(blockNumber?: number): number; /** * Returns list of chains that have been enabled at least once in the block range. * If a chain was disabled in the block range, it will be included in the list provided it was enabled * at some point in the block range. * @dev If fromBlock == toBlock then defaults to returning enabled chains at fromBlock * @param fromBlock Start block to search inclusive * @param toBlock End block to search inclusive. Defaults to MAX_SAFE_INTEGER, so grabs all disabled chain events * up until `latest`. * @returns List of chain IDs that have been enabled at least once in the block range. Sorted from lowest to highest. */ getEnabledChainsInBlockRange(fromBlock: number, toBlock?: number): number[]; getEnabledChains(block?: number): number[]; getDisabledChainsForBlock(blockNumber?: number): number[]; getConfigStoreVersionForTimestamp(timestamp?: number): number; getConfigStoreVersionForBlock(blockNumber?: number): number; hasValidConfigStoreVersionForTimestamp(timestamp?: number): boolean; /** * Resolve the chain ID for the ConfigStore Provider instance. * @dev When the provider is a StatisJsonRpcProvider instance, the getNetwork() is non-blocking. * @returns Chain ID for the ConfigStore deployment. */ protected resolveChainId(): Promise; protected _update(): Promise; update(): Promise; validateTokenConfigUpdate(args: TokenConfig): { spokeTargetBalances: SpokeTargetBalanceUpdate["spokeTargetBalances"]; rateModel: string | undefined; routeRateModel: RouteRateModelUpdate["routeRateModel"]; }; isValidRateModel(rateModel: RateModel): boolean; filterDisabledChains(disabledChains: number[]): number[]; } export {};