import { Interface, Result } from '@ethersproject/abi'; import { DeepReadonly } from 'ts-essentials'; import { Log, Logger } from '../../../types'; import { StatefulEventSubscriber } from '../../../stateful-event-subscriber'; import { IDexHelper } from '../../../dex-helper/idex-helper'; import { Contract } from 'ethers'; import { PoolState, PoolKey } from './pool-utils'; export interface Quote { consumedAmount: bigint; calculatedAmount: bigint; gasConsumed: number; skipAhead: number; } export declare class BasePool extends StatefulEventSubscriber { readonly parentName: string; protected network: number; protected dexHelper: IDexHelper; private readonly coreIface; private readonly dataFetcher; readonly key: PoolKey; readonly addressesSubscribed: string[]; constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, coreIface: Interface, dataFetcher: Contract, key: PoolKey, core: Contract); /** * 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 */ protected processLog(state: DeepReadonly, log: Readonly): DeepReadonly | null; /** * 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>; handleSwappedEvent(data: string, oldState: DeepReadonly): DeepReadonly | null; handlePositionUpdatedEvent(args: Result, oldState: DeepReadonly): DeepReadonly | null; quote(amount: bigint, token: bigint, blockNumber: number): Quote; computeTvl(): [bigint, bigint] | null; }