import { ChainObject, TokenClassKey } from "@gala-chain/api"; import BigNumber from "bignumber.js"; import { SwapState } from "../utils"; import { DexFeePercentageTypes } from "./DexFeeTypes"; import { DexPositionData } from "./DexPositionData"; import { TickData } from "./TickData"; export declare class Pool extends ChainObject { static INDEX_KEY: string; readonly token0: string; readonly token1: string; readonly fee: DexFeePercentageTypes; readonly token0ClassKey: TokenClassKey; readonly token1ClassKey: TokenClassKey; bitmap: Record; sqrtPrice: BigNumber; tick?: number; liquidity: BigNumber; grossPoolLiquidity: BigNumber; feeGrowthGlobal0: BigNumber; feeGrowthGlobal1: BigNumber; maxLiquidityPerTick: BigNumber; tickSpacing: number; protocolFees: number; protocolFeesToken0: BigNumber; protocolFeesToken1: BigNumber; isPrivate: boolean; whitelist: string[]; creator: string; /** * @dev Creates and initializes a new Pool with a given sqrtPrice. * @param token0 TokenKey0 used to create a composite key for the pool. * @param token1 TokenKey1 used to create a composite key for the pool. * @param token0ClassKey Token class key to identify token0. * @param token1ClassKey Token class key to identify token1. * @param fee Fee parameter that determines the pool's fee structure and tick spacing. * @param initialSqrtPrice Initial square root price for the V3 pool. * @param protocolFees Protocol fee percentage (default 0). * @param isPrivate Whether the pool is private (default false). * @param whitelist Array of whitelisted user addresses (default empty). * @param creator Address of the pool creator (default empty). */ constructor(token0: string, token1: string, token0ClassKey: TokenClassKey, token1ClassKey: TokenClassKey, fee: DexFeePercentageTypes, initialSqrtPrice: BigNumber, protocolFees?: number, isPrivate?: boolean, whitelist?: string[], creator?: string); /** * @dev Effect some changes to a position * @param position The Dex position that is being updated here * @param tickLowerData The tick data of the lower tick of the position's tick range * @param tickUpperData The tick data of the upper tick of the position's tick range * @param liquidityDelata The amount of liquidity to change in the position * @return amount0 the amount of token0 owed to the pool, negative if the pool should pay the recipient * @return amount1 the amount of token1 owed to the pool, negative if the pool should pay the recipient */ private _modifyPosition; /** * @dev Gets and updates a position with the given liquidity delta * @param position The Dex position that is being updated here * @param tickLowerData the tick data of the lower tick of the position's tick range * @param tickUpperData the tick data of the upper tick of the position's tick range * @param tickCurrent the current tick */ _updatePosition(position: DexPositionData, tickLowerData: TickData, tickUpperData: TickData, liquidityDelta: BigNumber, tickCurrent: number): void; /** * @notice Adds liquidity for the given recipient/tickLower/tickUpper position * @param position The Dex position that is being updated here * @param tickLowerData The tick data of the lower tick of the position in which to add liquidity * @param tickUpperData The tick data of the upper tick of the position in which to add liquidity * @param liquidity The amount of liquidity to mint * @return amount0 The amount of token0 that was paid to mint the given amount of liquidity * @return amount1 The amount of token1 that was paid to mint the given amount of liquidity */ mint(position: DexPositionData, tickLowerData: TickData, tickUpperData: TickData, liquidity: BigNumber): BigNumber[]; /** * @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position * @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 * @dev Fees must be collected separately via a call to #collect * @param position The Dex position that is being updated here * @param tickLowerData The tick data of the lower tick of the position for which to burn liquidity * @param tickUpperData The tick data of the upper tick of the position for which to burn liquidity * @param amount How much liquidity to burn * @return amount0 The amount of token0 sent to the recipient * @return amount1 The amount of token1 sent to the recipient */ burn(position: DexPositionData, tickLowerData: TickData, tickUpperData: TickData, amount: BigNumber): BigNumber[]; /** * @dev It will estimate the tokens required to add liquidity * @param amount Amount for which one wants estimation * @param tickLowerData The tick data of the lower tick of the position for which to add liquidity * @param tickUpperData The tick data of the upper tick of the position for which to add liquidity * @param isToken0 Is the amount for token0 * @return amount0 The amount of token0 are required to add liquidity * @return amount1 The amount of token1 are required to add liquidity * @return liquidity The amount of liquidity that it consist of */ getAmountForLiquidity(amount: BigNumber, tickLower: number, tickUpper: number, isToken0: boolean): BigNumber[]; /** * @dev this will change the Protocol fee of the pool * @param protocolFees Percentage of protocol fees that needs to be deducted */ configureProtocolFee(protocolFees: number): number; /** * @dev this will bring the state of protocolFeesTokens and reset them to 0 * @returns [protocolFeeToken0,protocolFeesToken1] */ collectProtocolFees(token0PoolBalance: BigNumber, token1PoolBalance: BigNumber): BigNumber[]; /** * * @param position The Dex position that is being updated here * @param tickLowerData The tick data of the lower tick of the position for which to collect fee accumulated * @param tickUpperData The tick data of the upper tick of the position for which to collect fee accumulated * @param amount0Requested amount0 The amount of token0 sent to be collected by the recipient * @param amount1Requested amount1 The amount of token1 sent to be collected by the recipient * @returns */ collect(position: DexPositionData, tickLowerData: TickData, tickUpperData: TickData, amount0Requested: BigNumber, amount1Requested: BigNumber): BigNumber[]; /** * @dev it will give Estimation for the tokens collected due swaps * @param position The Dex position that is being updated here * @param tickLowerData The tick data of the lower tick of the position for which to collect fee accumulated * @param tickUpperData The tick data of the upper tick of the position for which to collect fee accumulated * @returns the amount of tokens that this position have accumulated as its fees */ getFeeCollectedEstimation(position: DexPositionData, tickLowerData: TickData, tickUpperData: TickData): BigNumber[]; /** * @dev returns a hash that is unique to this pool * @returns poolHash */ genPoolHash(): string; /** * @dev returns service address which holds the pool's liquidity * @returns poolAlias */ getPoolAlias(): import("@gala-chain/api").UserAlias; /** * Estimates the amount of token0 and token1 required to burn a given liquidity amount * within a specified tick range. * * @param liquidityDelta - The amount of liquidity to be removed (burned). * @param tickLowerData - Tick data of the lower tick boundary of the burn range. * @param tickUpperData - Tick data of the upper tick boundary of the burn range. * @returns A tuple containing: * - amount0Req: The estimated amount of token0 to be burned. * - amount1Req: The estimated amount of token1 to be burned. */ burnEstimate(liquidityDelta: BigNumber, tickLower: number, tickUpper: number): [amount0Req: BigNumber, amount1Req: BigNumber]; /** * Performs a swap based on the specified amount and direction, updating global state. * * @param zeroForOne - Boolean indicating the swap direction (true for token0 -> token1, false for token1 -> token0). * @param state - The current state of the swap, including price, liquidity, fee growth, and protocol fees. * @param amountSpecified - The amount specified for the swap. * @returns A tuple of [amount0, amount1] representing the swap amounts for token0 and token1. */ swap(zeroForOne: boolean, state: SwapState, amountSpecified: BigNumber): [amount0: BigNumber, amount1: BigNumber]; /** * @dev Checks if a user is whitelisted for this private pool * @param user The user address to check * @returns true if user is whitelisted or pool is public */ isWhitelisted(user: string): boolean; /** * @dev Checks if a user can make this pool public * @param user The user address to check * @returns true if user is whitelisted */ canMakePublic(user: string): boolean; /** * @dev Makes a private pool public * @param user The user requesting to make the pool public * @throws ValidationFailedError if user is not whitelisted or pool is already public */ makePublic(user: string): void; /** * @dev Adds a user to the whitelist * @param user The user requesting to add someone * @param newUser The user to add to the whitelist * @throws ValidationFailedError if requesting user is not creator */ addToWhitelist(user: string, newUser: string): void; /** * @dev Removes a user from the whitelist * @param user The user requesting to remove someone * @param userToRemove The user to remove from the whitelist * @throws ValidationFailedError if requesting user is not creator or trying to remove creator */ removeFromWhitelist(user: string, userToRemove: string): void; } //# sourceMappingURL=DexV3Pool.d.ts.map