import { Interface } from '@ethersproject/abi'; import { Contract } from 'web3-eth-contract'; import { DeepReadonly } from 'ts-essentials'; import { Log, Logger, Token } from '../../types'; import { SwapSide } from '../../constants'; import { StatefulEventSubscriber } from '../../stateful-event-subscriber'; import { IDexHelper } from '../../dex-helper/idex-helper'; import { PoolState, PoolInfo } from './types'; export declare class BalancerV1EventPool extends StatefulEventSubscriber { protected network: number; protected balancerMulticall: Contract; readonly poolInfo: PoolInfo; static readonly iface: Interface; handlers: { [event: string]: (event: any, state: DeepReadonly, log: Readonly) => DeepReadonly | null; }; addressesSubscribed: string[]; protected swapFee: bigint; protected totalWeight: bigint; protected tokenWeights: { [tokenAddress: string]: bigint; }; constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, balancerMulticall: Contract, poolInfo: PoolInfo); checkBalance(srcToken: Token, destToken: Token, amount: bigint, side: SwapSide, blockNumber: number): boolean; estimatePoolTotalBalance(token: Token, blockNumber: number): bigint; calcPrices(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number): bigint[]; /** * 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>; handleJoinPool(event: any, state: DeepReadonly, _log: Readonly): DeepReadonly | null; handleExitPool(event: any, state: DeepReadonly, _log: Readonly): DeepReadonly | null; handleSwap(event: any, state: DeepReadonly, _log: Readonly): DeepReadonly | null; }