import { BigNumber } from '@ethersproject/bignumber'; import { BigNumber as OldBigNumber } from './utils/bignumber'; export interface SorConfig { chainId: number; vault: string; weth: string; staBal3Pool?: { id: string; address: string; }; usdcConnectingPool?: { id: string; usdc: string; }; wETHwstETH?: { id: string; address: string; }; lbpRaisingTokens?: string[]; } export type NoNullableField = { [P in keyof T]: NonNullable; }; export declare enum SwapTypes { SwapExactIn = 0, SwapExactOut = 1 } export declare enum PoolTypes { Weighted = 0, Stable = 1, Element = 2, MetaStable = 3, Linear = 4, Gyro2 = 5, Gyro3 = 6, GyroE = 7 } export interface SwapOptions { gasPrice: BigNumber; swapGas: BigNumber; timestamp: number; maxPools: number; poolTypeFilter: PoolFilter; forceRefresh: boolean; } export type PoolPairBase = { id: string; address: string; poolType: PoolTypes; swapFee: BigNumber; tokenIn: string; tokenOut: string; decimalsIn: number; decimalsOut: number; balanceIn: BigNumber; balanceOut: BigNumber; }; export interface Swap { pool: string; tokenIn: string; tokenOut: string; swapAmount?: string; limitReturnAmount?: string; maxPrice?: string; tokenInDecimals: number; tokenOutDecimals: number; returnAmount?: string; } export interface SubgraphPoolBase { id: string; address: string; poolType: string; swapFee: string; swapEnabled: boolean; totalShares: string; tokens: SubgraphToken[]; tokensList: string[]; totalWeight?: string; amp?: string; expiryTime?: number; unitSeconds?: number; principalToken?: string; baseToken?: string; mainIndex?: number; wrappedIndex?: number; lowerTarget?: string; upperTarget?: string; sqrtAlpha?: string; sqrtBeta?: string; root3Alpha?: string; alpha?: string; beta?: string; c?: string; s?: string; lambda?: string; tauAlphaX?: string; tauAlphaY?: string; tauBetaX?: string; tauBetaY?: string; u?: string; v?: string; w?: string; z?: string; dSq?: string; } export type SubgraphToken = { address: string; balance: string; decimals: number; priceRate: string; weight: string | null; }; export interface SwapV2 { poolId: string; assetInIndex: number; assetOutIndex: number; amount: string; userData: string; returnAmount?: string; } export interface SwapInfo { tokenAddresses: string[]; swaps: SwapV2[]; swapAmount: BigNumber; swapAmountForSwaps: BigNumber; returnAmount: BigNumber; returnAmountFromSwaps: BigNumber; returnAmountConsideringFees: BigNumber; tokenIn: string; tokenInForSwaps?: string; tokenOut: string; tokenOutFromSwaps?: string; marketSp: string; } export interface PoolDictionary { [poolId: string]: PoolBase; } export interface PoolPairDictionary { [tokenInOut: string]: PoolPairBase; } export interface hopDictionary { [hopToken: string]: Set; } export interface NewPath { id: string; swaps: Swap[]; poolPairData: PoolPairBase[]; limitAmount: BigNumber; pools: PoolBase[]; filterEffectivePrice?: OldBigNumber; } export declare enum PoolFilter { All = "All", Weighted = "Weighted", Stable = "Stable", MetaStable = "MetaStable", LBP = "LiquidityBootstrapping", Investment = "Investment", Element = "Element", AaveLinear = "AaveLinear", StablePhantom = "StablePhantom", ERC4626Linear = "ERC4626Linear", ComposableStable = "ComposableStable", Gyro2 = "Gyro2", Gyro3 = "Gyro3", GyroE = "GyroE" } export interface PoolBase { poolType: PoolTypes; id: string; address: string; tokensList: string[]; mainIndex?: number; isLBP?: boolean; parsePoolPairData: (tokenIn: string, tokenOut: string) => D; getNormalizedLiquidity: (poolPairData: D) => OldBigNumber; getLimitAmountSwap: (poolPairData: D, swapType: SwapTypes) => OldBigNumber; /** * @param {string} token - Address of token. * @param {BigNumber} newBalance - New balance of token. EVM scaled. */ updateTokenBalanceForPool: (token: string, newBalance: BigNumber) => void; _exactTokenInForTokenOut: (poolPairData: D, amount: OldBigNumber) => OldBigNumber; _tokenInForExactTokenOut: (poolPairData: D, amount: OldBigNumber) => OldBigNumber; _spotPriceAfterSwapExactTokenInForTokenOut: (poolPairData: D, amount: OldBigNumber) => OldBigNumber; _spotPriceAfterSwapTokenInForExactTokenOut: (poolPairData: D, amount: OldBigNumber) => OldBigNumber; _derivativeSpotPriceAfterSwapExactTokenInForTokenOut: (poolPairData: D, amount: OldBigNumber) => OldBigNumber; _derivativeSpotPriceAfterSwapTokenInForExactTokenOut: (poolPairData: D, amount: OldBigNumber) => OldBigNumber; } export interface WeightedPool extends PoolBase { totalWeight: string; } export interface TokenPriceService { /** * This should return the price of the native asset (ETH) in the token defined by tokenAddress. * Example: BAL = $20 USD, ETH = $4,000 USD, then 1 ETH = 200 BAL. This function would return 200. * @param tokenAddress */ getNativeAssetPriceInToken(tokenAddress: string): Promise; } export interface PoolDataService { getPools(): Promise; }