import { GalaChainContext } from "@gala-chain/chaincode"; import BigNumber from "bignumber.js"; import { GetTickDataDto, TickData } from "../../api/"; /** * Fetches TickData objects for the given tickLower and tickUpper values. * If the data does not exist on-chain, new default TickData instances are created instead. * * @param ctx - The GalaChain context used to access the ledger * @param poolHash - Unique identifier for the liquidity pool * @param tickLower - Lower tick boundary * @param tickUpper - Upper tick boundary * @returns An object containing tickLowerData and tickUpperData */ export declare function fetchOrCreateTickDataPair(ctx: GalaChainContext, poolHash: string, tickLower: number, tickUpper: number): Promise<{ tickUpperData: TickData; tickLowerData: TickData; }>; /** * Fetches an initialised tick from the chain and crosses it. * * The swap loop only reaches this path for a tick it has already identified as * INITIALISED via the pool bitmap (see `needsAsyncTickFetch = ... && step.initialised`). * An initialised tick is, by construction, one that was flipped and persisted during * `addLiquidity` (`updateTick` sets `feeGrowthOutside` relative to the current tick, then * the TickData is written). Its TickData therefore MUST exist. * * SECURITY: do NOT fabricate a default TickData when it is missing. `new TickData(...)` * has `feeGrowthOutside = 0`, and the immediately following `tickCross` sets * `feeGrowthOutside = feeGrowthGlobal - 0 = feeGrowthGlobal`. That injects the pool's * ENTIRE accumulated fee growth into the tick's outside-reference, corrupting the * `getFeeGrowthInside` frame so a position bracketing the tick can back-claim * `feeGrowthGlobal x liquidity` as owed fees that were never earned (observed on mainnet: * a position credited ~102.8M GALA while `feeGrowthGlobal` was flat). A missing TickData * for an initialised tick is a bitmap/storage desync that must fail loudly, not be papered * over with a fabricated tick. * * @param ctx - The GalaChain context for accessing the ledger. * @param poolHash - Unique identifier for the liquidity pool. * @param tick - The tick index to fetch and cross. * @param feeGrowthGlobal0 - Global fee growth for token 0. * @param feeGrowthGlobal1 - Global fee growth for token 1. * @returns The net change in liquidity after crossing the tick. * @throws ConflictError when an initialised tick has no persisted TickData. */ export declare function fetchOrCreateAndCrossTick(ctx: GalaChainContext, poolHash: string, tick: number, feeGrowthGlobal0: BigNumber, feeGrowthGlobal1: BigNumber): Promise; export declare function getTickData(ctx: GalaChainContext, dto: GetTickDataDto): Promise; //# sourceMappingURL=tickData.helper.d.ts.map