Skip to content

@gala-chain/chaincodeAPI


API > fetchOrCreateAndCrossTick

Function: fetchOrCreateAndCrossTick()

fetchOrCreateAndCrossTick(ctx, poolHash, tick, feeGrowthGlobal0, feeGrowthGlobal1): Promise\<BigNumber>

Fetches an existing tick from the chain or creates it if not found, then crosses the tick.

Parameters

ctx: GalaChainContext

The GalaChain context for accessing the ledger.

poolHash: string

Unique identifier for the liquidity pool.

tick: number

The tick index to fetch or create.

feeGrowthGlobal0: BigNumber

Global fee growth for token 0.

feeGrowthGlobal1: BigNumber

Global fee growth for token 1.

Returns

The net change in liquidity after crossing the tick.

Source

chaincode/src/dex/tickData.helper.ts:72