import { Interface } from '@ethersproject/abi'; import { DeepReadonly } from 'ts-essentials'; import { Log, Logger } from '../../types'; import { StatefulEventSubscriber } from '../../stateful-event-subscriber'; import { IDexHelper } from '../../dex-helper'; import { CommonAddresses, PoolWithDecimals } from './types'; import { Address } from '../../types'; type OnPoolCreatedCallback = (pools: readonly PoolWithDecimals[]) => void; export declare class FluidDexFactory extends StatefulEventSubscriber { readonly parentName: string; readonly commonAddresses: CommonAddresses; protected network: number; protected dexHelper: IDexHelper; protected readonly onPoolCreated: OnPoolCreatedCallback; handlers: { [event: string]: (event: any, state: DeepReadonly, log: Readonly) => Promise | null>; }; logDecoder: (log: Log) => any; addressesSubscribed: Address[]; protected dexFactoryIface: Interface; constructor(parentName: string, commonAddresses: CommonAddresses, network: number, dexHelper: IDexHelper, logger: Logger, onPoolCreated: OnPoolCreatedCallback); /** * Handle a trade rate change on the pool. */ handleDexDeployed(): Promise | null>; /** * The function is called every time any of the subscribed * addresses release log. The function accepts the current * state, updates the state according to the log, and returns * the updated state. * @param state - Current state of event subscriber * @param log - Log released by one of the subscribed addresses * @returns Updates state of the event subscriber after the log */ processLog(state: DeepReadonly, log: Readonly): Promise | null>; getStateOrGenerate(blockNumber: number, readonly?: boolean): Promise>; /** * The function generates state using on-chain calls. This * function is called to regenerate state if the event based * system fails to fetch events and the local state is no * more correct. * @param blockNumber - Blocknumber for which the state should * should be generated * @returns state of the event subscriber at blocknumber */ generateState(blockNumber: number): Promise>; } export {};