Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 state

Back to all declarations

assertIsNotUserCall

func(int, rlm .uverse.realm)
Open
OID
0fe078…3476:3
assertIsNotUserCall details

Inspect func

assertIsNotEqualsTokens

func(token0Path string, token1Path string)

assertIsNotEqualsTokens asserts that the token0Path and token1Path are not equal.

Open
OID
0fe078…3476:5
assertIsNotEqualsTokens details

Inspect func

assertIsSupportedFeeTier

func(fee uint32)

assertIsSupportedFeeTier asserts that the fee is a supported fee tier.

Open
OID
0fe078…3476:6
assertIsSupportedFeeTier details

Inspect func

assertIsNotExistsPoolPath

func(instance *v1.poolV1, token0Path string, token1Path string, fee uint32)

assertIsNotExistsPoolPath asserts that the pool path does not exist.

Open
OID
0fe078…3476:7
assertIsNotExistsPoolPath details

Inspect func

assertIsValidTokenOrder

func(token0Path string, token1Path string)
Open
OID
0fe078…3476:8
assertIsValidTokenOrder details

Inspect func

errUnsupportedFeeTier

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-001] unsupported fee tier"

errPoolAlreadyExists

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-002] pool already created"

errOutOfRange

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-003] out of range for numeric value"

errInvalidInput

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-004] invalid input data"

errDataNotFound

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-005] requested data not found"

errLiquidityCalculation

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-006] invalid liquidity calculated"

errZeroLiquidity

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-007] zero liquidity"

errDuplicateTokenInPool

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-008] same token used in single pool"

errTickLowerInvalid

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-009] tickLower is invalid"

errTickUpperInvalid

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-010] tickUpper is invalid"

errInvalidSwapAmount

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-011] invalid swap amount"

errInvalidProtocolFeePct

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-012] invalid protocol fee percentage"

errInvalidWithdrawalFeePct

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-013] invalid withdrawal fee percentage"

errLockedPool

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-014] cannot modify pool while locked"

errPriceOutOfRange

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-015] swap price out of range"

errTransferFailed

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-016] token transfer failed"

errInvalidTickAndTickSpacing

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-017] invalid tick and tick spacing requested"

errInvalidTickRange

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-018] tickLower is greater than or equal to tickUpper"

errUnderflow

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-019] underflow"

errOverflow

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-020] overflow"

errBalanceUpdateFailed

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-021] balance update failed"

errInvalidPayer

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-022] invalid payer"

errNotAccessEOA

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-023] not access EOA"

errInsufficientPayment

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-024] insufficient payment"

errNotInitializedObservation

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-025] not initialized observation"

errObservationTooOld

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-026] target timestamp before oldest observation"

errSpoofedRealm

untyped string

Error definitions for pool operations

Value

"[GNOSWAP-POOL-027] rlm does not match the current crossing frame"

newErrorWithDetail

func(message string, detail string) string

newErrorWithDetail adds detail to an error message.

Open
OID
0fe078…3476:9
newErrorWithDetail details

Inspect func

makeErrorWithDetails

func(message string, details string) .uverse.error

makeErrorWithDetails creates an error with additional context.

Open
OID
0fe078…3476:11
makeErrorWithDetails details

Inspect func

tickEventInfo

type

Value

v1.tickEventInfo

NewTickEventInfo

func(tickID int32, tickInfo pool.TickInfo) *v1.tickEventInfo
Open
OID
0fe078…3476:12
NewTickEventInfo details

Inspect func

FeeTier100

uint32

Value

100

FeeTier500

uint32

Value

500

FeeTier3000

uint32

Value

3000

FeeTier10000

uint32

Value

10000

MIN_SQRT_RATIO

string

Value

"4295128739"

MAX_SQRT_RATIO

string

Value

"1461446703485210103287273052203988822378723970342"

poolCreateConfig

type

poolCreateConfig holds the essential parameters for creating a new pool.

Value

v1.poolCreateConfig

newPoolParams

func(token0Path string, token1Path string, fee uint32, sqrtPriceX96 string, tickSpacing int32, slot0FeeProtocol uint8) *v1.poolCreateConfig

newPoolParams defines the essential parameters for creating a new pool.

Open
OID
0fe078…3476:14
newPoolParams details

Inspect func

validateSqrtPriceX96

func(sqrtPriceX96 *uint256.Uint) .uverse.error

validateSqrtPriceX96 validates that the given sqrtPriceX96 is within valid range

Open
OID
0fe078…3476:16
validateSqrtPriceX96 details

Inspect func

isValidFeeTier

func(feeTier uint32) bool
Open
OID
0fe078…3476:17
isValidFeeTier details

Inspect func

GetPoolPath

func(token0Path string, token1Path string, fee uint32) string

GetPoolPath generates a unique pool path string based on the token paths and fee tier.

Open
OID
0fe078…3476:18
GetPoolPath details

Inspect func

defaultSlot0FeeProtocol

uint8

Value

0

defaultPoolCreationFee

int64

// 100\_GNS

Value

100000000

defaultWithdrawalFeeBPS

uint64

Value

100

defaultUnlocked

untyped bool

Value

true

initStoreData

func(int, rlm .uverse.realm, poolStore pool.IPoolStore) .uverse.error
Open
OID
0fe078…3476:23
initStoreData details

Inspect func

poolV1

type

Value

v1.poolV1

NewPoolV1

func(store pool.IPoolStore) pool.IPool
Open
OID
0fe078…3476:24
NewPoolV1 details

Inspect func

GNS_TOKEN_KEY

string

Value

"gno.land/r/gnoswap/gns.GNS"

validateFeeProtocol

func(feeProtocol0 uint8, feeProtocol1 uint8) .uverse.error

validateFeeProtocol validates the fee protocol values for token0 and token1. This function checks whether the provided fee protocol values (\`feeProtocol0\` and \`feeProtocol1\`) are valid using the \`isValidFeeProtocolValue\` function. If either value is invalid, it returns an error indicating that the protocol fee percentage is invalid. Parameters: - feeProtocol0: uint8, the fee protocol value for token0. - feeProtocol1: uint8, the fee protocol value for token1. Returns: - error: Returns \`errInvalidProtocolFeePct\` if either \`feeProtocol0\` or \`feeProtocol1\` is invalid. Returns \`nil\` if both values are valid.

Open
OID
0fe078…3476:26
validateFeeProtocol details

Inspect func

isValidFeeProtocolValue

func(value uint8) bool

isValidFeeProtocolValue checks if a fee protocol value is within acceptable range. Valid values are either 0 (disabled) or between 4 and 10 inclusive. The value is used as a denominator: protocolFee = swapFee / feeProtocol (e.g., feeProtocol=4 means 1/4 = 25% of swap fees go to protocol)

Open
OID
0fe078…3476:28
isValidFeeProtocolValue details

Inspect func

maxObservationCardinality

uint16

maxObservationCardinality defines the maximum number of observations to store

Value

65535

getTWAP

func(p *pool.Pool, secondsAgo uint32) (int32, *uint256.Uint, .uverse.error)

GetTWAP calculates the time-weighted average price between two points in time Returns the arithmetic mean tick and harmonic mean liquidity over the time period

Open
OID
0fe078…3476:29
getTWAP details

Inspect func

writeObservationByPool

func(p *pool.Pool, currentTime int64, tick int32, liquidity *uint256.Uint) .uverse.error
Open
OID
0fe078…3476:31
writeObservationByPool details

Inspect func

increaseObservationCardinalityNextByPool

func(p *pool.Pool, observationCardinalityNext uint16) .uverse.error
Open
OID
0fe078…3476:32
increaseObservationCardinalityNextByPool details

Inspect func

transform

func(lastObservation *pool.Observation, currentTime int64, tick int32, liquidity *uint256.Uint) (*pool.Observation, .uverse.error)
Open
OID
0fe078…3476:33
transform details

Inspect func

grow

func(os *pool.ObservationState, currentCardinality uint16, nextCardinality uint16) (uint16, .uverse.error)
Open
OID
0fe078…3476:34
grow details

Inspect func

lte

func(time int64, a int64, b int64) bool
Open
OID
0fe078…3476:35
lte details

Inspect func

writeObservation

func(os *pool.ObservationState, currentTime int64, tick int32, liquidity *uint256.Uint) .uverse.error
Open
OID
0fe078…3476:36
writeObservation details

Inspect func

lastObservation

func(os *pool.ObservationState) (*pool.Observation, .uverse.error)
Open
OID
0fe078…3476:37
lastObservation details

Inspect func

observationAt

func(os *pool.ObservationState, index uint16) (*pool.Observation, .uverse.error)

observationAt returns the observation at a specific index Returns error if the observation doesn't exist

Open
OID
0fe078…3476:38
observationAt details

Inspect func

observeSingle

func(os *pool.ObservationState, currentTime int64, secondsAgo uint32, tick int32, index uint16, liquidity *uint256.Uint, cardinality uint16) (int64, string, .uverse.error)

observeSingle returns the data for a single observation at a specific time ago

Open
OID
0fe078…3476:39
observeSingle details

Inspect func

getSurroundingObservations

func(os *pool.ObservationState, target int64, currentTime int64, tick int32, index uint16, liquidity *uint256.Uint, cardinality uint16) (*pool.Observation, *pool.Observation, .uverse.error)

getSurroundingObservations finds the observations immediately before and after the target timestamp. It uses binary search over the logical time-ordered view of the circular buffer. Logical order starts at (index+1) % cardinality (oldest) and ends at index (latest).

Open
OID
0fe078…3476:40
getSurroundingObservations details

Inspect func

binarySearch

func(os *pool.ObservationState, currentTime int64, target int64, index uint16, cardinality uint16) (*pool.Observation, *pool.Observation, .uverse.error)
Open
OID
0fe078…3476:41
binarySearch details

Inspect func

observe

func(os *pool.ObservationState, currentTime int64, secondsAgos []uint32, tick int32, index uint16, liquidity *uint256.Uint, cardinality uint16) ([]int64, []string, .uverse.error)

observe returns the cumulative tick and liquidity as of each timestamp secondsAgo from the current time.

Open
OID
0fe078…3476:42
observe details

Inspect func

minRequestedAmount

func(request int64, available int64) int64
Open
OID
0fe078…3476:43
minRequestedAmount details

Inspect func

getPositionKey

func(tickLower int32, tickUpper int32) string

getPositionKey generates a compact deterministic key for a liquidity position. Creates deterministic identifier for position tracking. Ensures unique positions per price range while preserving lexical ordering. Used internally for position state management. Parameters: - tickLower: Lower boundary tick of position range - tickUpper: Upper boundary tick of position range Key Format: EncodePositionKey(tickLower, tickUpper)

Open
OID
0fe078…3476:45
getPositionKey details

Inspect func

positionUpdate

func(position pool.PositionInfo, liquidityDelta *int256.Int, feeGrowthInside0X128 *uint256.Uint, feeGrowthInside1X128 *uint256.Uint) (pool.PositionInfo, .uverse.error)

positionUpdate updates a position's liquidity and calculates fees owed. Returns the updated position information and any error.

Open
OID
0fe078…3476:47
positionUpdate details

Inspect func

calculateToken0Amount

func(sqrtPriceLower *uint256.Uint, sqrtPriceUpper *uint256.Uint, liquidityDelta *int256.Int) *int256.Int

calculateToken0Amount calculates the amount of token0 based on price range and liquidity delta.

Open
OID
0fe078…3476:48
calculateToken0Amount details

Inspect func

calculateToken1Amount

func(sqrtPriceLower *uint256.Uint, sqrtPriceUpper *uint256.Uint, liquidityDelta *int256.Int) *int256.Int

calculateToken1Amount calculates the amount of token1 based on price range and liquidity delta.

Open
OID
0fe078…3476:49
calculateToken1Amount details

Inspect func

PositionLiquidity

func(p *pool.Pool, key string) string

PositionLiquidity returns the liquidity of a position.

Open
OID
0fe078…3476:50
PositionLiquidity details

Inspect func

PositionFeeGrowthInside0LastX128

func(p *pool.Pool, key string) string

PositionFeeGrowthInside0LastX128 returns the fee growth of token0 inside a position.

Open
OID
0fe078…3476:51
PositionFeeGrowthInside0LastX128 details

Inspect func

PositionFeeGrowthInside1LastX128

func(p *pool.Pool, key string) string

PositionFeeGrowthInside1LastX128 returns the fee growth of token1 inside a position.

Open
OID
0fe078…3476:52
PositionFeeGrowthInside1LastX128 details

Inspect func

PositionTokensOwed0

func(p *pool.Pool, key string) int64

PositionTokensOwed0 returns the amount of token0 owed by a position.

Open
OID
0fe078…3476:53
PositionTokensOwed0 details

Inspect func

PositionTokensOwed1

func(p *pool.Pool, key string) int64

PositionTokensOwed1 returns the amount of token1 owed by a position.

Open
OID
0fe078…3476:54
PositionTokensOwed1 details

Inspect func

GetPositionByPool

func(p *pool.Pool, key string) (pool.PositionInfo, bool)

GetPosition returns the position info for a given key.

Open
OID
0fe078…3476:55
GetPositionByPool details

Inspect func

positionUpdateWithKey

func(p *pool.Pool, positionKey string, liquidityDelta *int256.Int, feeGrowthInside0X128 *uint256.Uint, feeGrowthInside1X128 *uint256.Uint) (pool.PositionInfo, .uverse.error)

positionUpdateWithKey updates a position in the pool and returns the updated position.

Open
OID
0fe078…3476:56
positionUpdateWithKey details

Inspect func

setPosition

func(p *pool.Pool, posKey string, positionInfo pool.PositionInfo)

setPosition sets the position info for a given key.

Open
OID
0fe078…3476:57
setPosition details

Inspect func

mustGetPositionByPool

func(p *pool.Pool, positionKey string) *pool.PositionInfo

mustGetPosition returns the position info for a given key.

Open
OID
0fe078…3476:58
mustGetPositionByPool details

Inspect func

modifyPosition

func(p *pool.Pool, params v1.ModifyPositionParams) (pool.PositionInfo, *uint256.Uint, *uint256.Uint, .uverse.error)

modifyPosition updates a position in the pool and calculates the amount of tokens needed (for minting) or returned (for burning). The calculation depends on the current price (tick) relative to the position's price range. The function handles three cases: 1. Current price below range (tick \< tickLower): only token0 is used/returned 2. Current price in range (tickLower \<= tick \< tickUpper): both tokens are used/returned 3. Current price above range (tick >= tickUpper): only token1 is used/returned Parameters: - params: ModifyPositionParams containing owner, tickLower, tickUpper, and liquidityDelta Returns: - PositionInfo: updated position information - \*u256.Uint: amount of token0 needed/returned - \*u256.Uint: amount of token1 needed/returned

Open
OID
0fe078…3476:59
modifyPosition details

Inspect func

updatePosition

func(p *pool.Pool, positionParams v1.ModifyPositionParams, tick int32) (pool.PositionInfo, .uverse.error)

updatePosition modifies the position's liquidity and updates the corresponding tick states. This function updates the position data based on the specified liquidity delta and tick range. It also manages the fee growth, tick state flipping, and cleanup of unused tick data. Parameters: - positionParams: ModifyPositionParams, the parameters for the position modification, which include: - owner: The address of the position owner. - tickLower: The lower tick boundary of the position. - tickUpper: The upper tick boundary of the position. - liquidityDelta: The change in liquidity (positive or negative). - tick: int32, the current tick position. Returns: - PositionInfo: The updated position information. Workflow: 1. Clone the global fee growth values (token 0 and token 1). 2. If the liquidity delta is non-zero: - Update the lower and upper ticks using \`tickUpdate\`, flipping their states if necessary. - If a tick's state was flipped, update the tick bitmap to reflect the new state. 3. Calculate the fee growth inside the tick range using \`getFeeGrowthInside\`. 4. Generate a unique position key and update the position data using \`positionUpdateWithKey\`. 5. If liquidity is being removed (negative delta), clean up unused tick data by deleting the tick entries. 6. Return the updated position. Notes: - The function flips the tick states and cleans up unused tick data when liquidity is removed. - It ensures fee growth and position data remain accurate after the update. Example Usage: \`\`\`gno updatedPosition := pool.updatePosition(positionParams, currentTick) println("Updated Position Info:", updatedPosition) \`\`\`

Open
OID
0fe078…3476:60
updatePosition details

Inspect func

MaxBpsValue

uint64

// 10%

Value

1000

ZeroBps

uint64

Value

0

calculateAmountWithFee

func(amount *uint256.Uint, fee *uint256.Uint) (feeAmount *uint256.Uint, afterAmount *uint256.Uint)

calculateAmountWithFee calculates the fee amount and the amount after the fee Inputs: - amount: the amount before the fee - fee: the fee in BPS Outputs: - the fee amount - the amount after the fee applied

Open
OID
0fe078…3476:61
calculateAmountWithFee details

Inspect func

zero

*uint256.Uint

Hook functions allow external contracts to be notified of swap events.

Open
OID
0fe078…3476:64
zero details

Inspect pointer

fixedPointQ128

*uint256.Uint

Hook functions allow external contracts to be notified of swap events.

Open
OID
0fe078…3476:70
fixedPointQ128 details

Inspect pointer

maxInt256

*uint256.Uint

Hook functions allow external contracts to be notified of swap events.

Open
OID
0fe078…3476:73
maxInt256 details

Inspect pointer

maxInt64

*int256.Int

Hook functions allow external contracts to be notified of swap events.

Open
OID
0fe078…3476:76
maxInt64 details

Inspect pointer

minInt64

*int256.Int

Hook functions allow external contracts to be notified of swap events.

Open
OID
0fe078…3476:79
minInt64 details

Inspect pointer

SwapResult

type

SwapResult encapsulates all state changes from a swap. It ensures atomic state transitions that can be applied at once.

Value

v1.SwapResult

SwapComputation

type

SwapComputation encapsulates the pure computation logic for swaps.

Value

v1.SwapComputation

tickCrossHookFn

type

tickCrossHookFn is invoked from inside the swap loop whenever an initialized tick is crossed. DrySwap passes nil to skip side effects.

Value

v1.tickCrossHookFn

applySwapResult

func(pool *pool.Pool, result *v1.SwapResult)

applySwapResult updates pool state with computed results. All state changes are applied at once to maintain consistency

Open
OID
0fe078…3476:81
applySwapResult details

Inspect func

validatePriceLimits

func(slot0 pool.Slot0, zeroForOne bool, sqrtPriceLimitX96 *uint256.Uint)

validatePriceLimits ensures the provided price limit is valid for the swap direction The function enforces that: For zeroForOne (selling token0): - Price limit must be below current price - Price limit must be above MIN\_SQRT\_RATIO For !zeroForOne (selling token1): - Price limit must be above current price - Price limit must be below MAX\_SQRT\_RATIO

Open
OID
0fe078…3476:83
validatePriceLimits details

Inspect func

getFeeProtocol

func(slot0 pool.Slot0, zeroForOne bool) uint8

getFeeProtocol returns the appropriate fee protocol based on zero for one. When zeroForOne is true, we want the lower 4 bits (% 16). Otherwise, we want the upper 4 bits (/ 16).

Open
OID
0fe078…3476:84
getFeeProtocol details

Inspect func

getFeeGrowthGlobal

func(pool *pool.Pool, zeroForOne bool) *uint256.Uint

getFeeGrowthGlobal returns the appropriate fee growth global based on zero for one.

Open
OID
0fe078…3476:85
getFeeGrowthGlobal details

Inspect func

shouldContinueSwap

func(state v1.SwapState, sqrtPriceLimitX96 *uint256.Uint) bool

shouldContinueSwap checks if swap should continue based on remaining amount and price limit.

Open
OID
0fe078…3476:86
shouldContinueSwap details

Inspect func

updateFeeProtocol

func(step v1.StepComputations, feeProtocol uint8, state v1.SwapState) (v1.SwapState, v1.StepComputations, .uverse.error)

updateFeeProtocol calculates and updates protocol fees for the current step.

Open
OID
0fe078…3476:87
updateFeeProtocol details

Inspect func

computeSwapStepInit

func(state v1.SwapState, pool *pool.Pool, zeroForOne bool) v1.StepComputations

computeSwapStepInit initializes the computation for a single swap step.

Open
OID
0fe078…3476:88
computeSwapStepInit details

Inspect func

computeTargetSqrtRatio

func(step v1.StepComputations, sqrtPriceLimitX96 *uint256.Uint, zeroForOne bool) *uint256.Uint

computeTargetSqrtRatio determines the target sqrt price for the current swap step.

Open
OID
0fe078…3476:89
computeTargetSqrtRatio details

Inspect func

shouldUsePriceLimit

func(sqrtPriceNext *uint256.Uint, sqrtPriceLimit *uint256.Uint, zeroForOne bool) bool

shouldUsePriceLimit returns true if the price limit should be used instead of the next tick price

Open
OID
0fe078…3476:90
shouldUsePriceLimit details

Inspect func

computeAmounts

func(state v1.SwapState, sqrtRatioTargetX96 *uint256.Uint, pool *pool.Pool, step v1.StepComputations) (v1.SwapState, v1.StepComputations)

computeAmounts calculates the input and output amounts for the current swap step.

Open
OID
0fe078…3476:91
computeAmounts details

Inspect func

updateAmounts

func(step v1.StepComputations, state v1.SwapState, exactInput bool) (v1.SwapState, .uverse.error)

updateAmounts calculates new remaining and calculated amounts based on the swap step. For exact input swaps: - Decrements remaining input amount by (amountIn + feeAmount) - Decrements calculated amount by amountOut For exact output swaps: - Increments remaining output amount by amountOut - Increments calculated amount by (amountIn + feeAmount)

Open
OID
0fe078…3476:92
updateAmounts details

Inspect func

MAX_LIQUIDITY_PER_TICK_SPACING_1

untyped string

Value

"191757530477355301479181766273477"

MAX_LIQUIDITY_PER_TICK_SPACING_10

untyped string

Value

"1917569901783203986719870431555990"

MAX_LIQUIDITY_PER_TICK_SPACING_60

untyped string

Value

"11505743598341114571880798222544994"

MAX_LIQUIDITY_PER_TICK_SPACING_200

untyped string

Value

"38350317471085141830651933667504588"

MIN_TICK

int32

Value

-887272

MAX_TICK

int32

Value

887272

maxLiquidityPerTickSpacing1FromDec

func() *uint256.Uint

maxLiquidityPerTickSpacing\* return the precomputed max-liquidity-per-tick for each supported tick spacing. They are constructors (not package-level vars) so each caller receives a fresh instance — calculateMaxLiquidityPerTick returns the value directly to callers, and a shared singleton could otherwise be mutated in place and corrupt every caller. Values are built from little-endian \[4]uint64 literals to avoid runtime decimal parsing.

Open
OID
0fe078…3476:93
maxLiquidityPerTickSpacing1FromDec details

Inspect func

maxLiquidityPerTickSpacing10FromDec

func() *uint256.Uint
Open
OID
0fe078…3476:95
maxLiquidityPerTickSpacing10FromDec details

Inspect func

maxLiquidityPerTickSpacing60FromDec

func() *uint256.Uint
Open
OID
0fe078…3476:96
maxLiquidityPerTickSpacing60FromDec details

Inspect func

maxLiquidityPerTickSpacing200FromDec

func() *uint256.Uint
Open
OID
0fe078…3476:97
maxLiquidityPerTickSpacing200FromDec details

Inspect func

GetTickLiquidityGross

func(p *pool.Pool, tick int32) string

GetTickLiquidityGross returns the gross liquidity for the specified tick.

Open
OID
0fe078…3476:98
GetTickLiquidityGross details

Inspect func

GetTickLiquidityNet

func(p *pool.Pool, tick int32) string

GetTickLiquidityNet returns the net liquidity for the specified tick.

Open
OID
0fe078…3476:99
GetTickLiquidityNet details

Inspect func

GetTickFeeGrowthOutside0X128

func(p *pool.Pool, tick int32) string

GetTickFeeGrowthOutside0X128 returns the fee growth outside the tick for token 0.

Open
OID
0fe078…3476:100
GetTickFeeGrowthOutside0X128 details

Inspect func

GetTickFeeGrowthOutside1X128

func(p *pool.Pool, tick int32) string

GetTickFeeGrowthOutside1X128 returns the fee growth outside the tick for token 1.

Open
OID
0fe078…3476:101
GetTickFeeGrowthOutside1X128 details

Inspect func

GetTickCumulativeOutside

func(p *pool.Pool, tick int32) int64

GetTickCumulativeOutside returns the cumulative liquidity outside the tick.

Open
OID
0fe078…3476:102
GetTickCumulativeOutside details

Inspect func

GetTickSecondsPerLiquidityOutsideX128

func(p *pool.Pool, tick int32) string

GetTickSecondsPerLiquidityOutsideX128 returns the seconds per liquidity outside the tick.

Open
OID
0fe078…3476:103
GetTickSecondsPerLiquidityOutsideX128 details

Inspect func

GetTickSecondsOutside

func(p *pool.Pool, tick int32) uint32

GetTickSecondsOutside returns the seconds outside the tick.

Open
OID
0fe078…3476:104
GetTickSecondsOutside details

Inspect func

GetTickInitialized

func(p *pool.Pool, tick int32) bool

GetTickInitialized returns whether the tick is initialized.

Open
OID
0fe078…3476:105
GetTickInitialized details

Inspect func

getFeeGrowthInside

func(p *pool.Pool, tickLower int32, tickUpper int32, tickCurrent int32, feeGrowthGlobal0X128 *uint256.Uint, feeGrowthGlobal1X128 *uint256.Uint) (*uint256.Uint, *uint256.Uint)

getFeeGrowthInside calculates the fee growth within a specified tick range. This function computes the accumulated fee growth for token 0 and token 1 inside a given tick range (\`tickLower\` to \`tickUpper\`) relative to the current tick position (\`tickCurrent\`). It isolates the fee growth within the range by subtracting the fee growth below the lower tick and above the upper tick from the global fee growth. Parameters: - tickLower: int32, the lower tick boundary of the range. - tickUpper: int32, the upper tick boundary of the range. - tickCurrent: int32, the current tick index. - feeGrowthGlobal0X128: \*u256.Uint, the global fee growth for token 0 in X128 precision. - feeGrowthGlobal1X128: \*u256.Uint, the global fee growth for token 1 in X128 precision. Returns: - \*u256.Uint: Fee growth inside the tick range for token 0. - \*u256.Uint: Fee growth inside the tick range for token 1. Workflow: 1. Retrieve the tick information (\`lower\` and \`upper\`) for the lower and upper tick boundaries using \`p.getTick\`. 2. Calculate the fee growth below the lower tick using \`getFeeGrowthBelowX128\`. 3. Calculate the fee growth above the upper tick using \`getFeeGrowthAboveX128\`. 4. Subtract the fee growth below and above the range from the global fee growth values: feeGrowthInside = feeGrowthGlobal - feeGrowthBelow - feeGrowthAbove 5. Return the computed fee growth values for token 0 and token 1 within the range. Behavior: - The fee growth is isolated within the range \`\[tickLower, tickUpper]\`. - The function ensures the calculations accurately consider the tick boundaries and the current tick position. Example: \`\`\`gno feeGrowth0, feeGrowth1 := pool.getFeeGrowthInside( 100, 200, 150, globalFeeGrowth0, globalFeeGrowth1, ) println("Fee Growth Inside (Token 0):", feeGrowth0) println("Fee Growth Inside (Token 1):", feeGrowth1) \`\`\`

Open
OID
0fe078…3476:106
getFeeGrowthInside details

Inspect func

tickUpdate

func(p *pool.Pool, tick int32, tickCurrent int32, liquidityDelta *int256.Int, feeGrowthGlobal0X128 *uint256.Uint, feeGrowthGlobal1X128 *uint256.Uint, upper bool, maxLiquidity *uint256.Uint) flipped bool

tickUpdate updates the state of a specific tick. This function applies a given liquidity change (liquidityDelta) to the specified tick, updates the fee growth values if necessary, and adjusts the net liquidity based on whether the tick is an upper or lower boundary. It also verifies that the total liquidity does not exceed the maximum allowed value and ensures the net liquidity stays within the valid int128 range. Parameters: - tick: int32, the index of the tick to update. - tickCurrent: int32, the current active tick index. - liquidityDelta: \*i256.Int, the amount of liquidity to add or remove. - feeGrowthGlobal0X128: \*u256.Uint, the global fee growth value for token 0. - feeGrowthGlobal1X128: \*u256.Uint, the global fee growth value for token 1. - upper: bool, indicates if this is the upper boundary (true for upper, false for lower). - maxLiquidity: \*u256.Uint, the maximum allowed liquidity. Returns: - flipped: bool, indicates if the tick's initialization state has changed. (e.g., liquidity transitioning from zero to non-zero, or vice versa) Workflow: 1. Nil input values are replaced with zero. 2. The function retrieves the tick information for the specified tick index. 3. Applies the liquidityDelta to compute the new total liquidity (liquidityGross). - If the total liquidity exceeds the maximum allowed value, the function panics. 4. Checks whether the tick's initialized state has changed and sets the \`flipped\` flag. 5. If the tick was previously uninitialized and its index is less than or equal to the current tick, the fee growth values are initialized to the current global values. 6. Updates the tick's net liquidity: - For an upper boundary, it subtracts liquidityDelta. - For a lower boundary, it adds liquidityDelta. - Ensures the net liquidity remains within the int128 range using \`checkOverFlowInt128\`. 7. Updates the tick's state with the new values. 8. Returns whether the tick's initialized state has flipped. Panic Conditions: - The total liquidity (liquidityGross) exceeds the maximum allowed liquidity (maxLiquidity). - The net liquidity (liquidityNet) exceeds the int128 range. Example: \`\`\`gno flipped := pool.tickUpdate(10, 5, liquidityDelta, feeGrowth0, feeGrowth1, true, maxLiquidity) println("Tick flipped:", flipped) \`\`\`

Open
OID
0fe078…3476:107
tickUpdate details

Inspect func

tickCross

func(p *pool.Pool, tick int32, feeGrowthGlobal0X128 *uint256.Uint, feeGrowthGlobal1X128 *uint256.Uint, secondsPerLiquidityCumulativeX128 *uint256.Uint, tickCumulative int64, blockTimestamp int64) *int256.Int

tickCross updates a tick's state when it is crossed and returns the liquidity net. Updates fee growth and oracle accumulator values for the tick.

Open
OID
0fe078…3476:108
tickCross details

Inspect func

setTick

func(p *pool.Pool, tick int32, newTickInfo pool.TickInfo)

setTick updates the tick data for the specified tick index in the pool.

Open
OID
0fe078…3476:109
setTick details

Inspect func

deleteTick

func(p *pool.Pool, tick int32)

deleteTick deletes the tick data for the specified tick index in the pool.

Open
OID
0fe078…3476:110
deleteTick details

Inspect func

getTick

func(p *pool.Pool, tick int32) pool.TickInfo

getTick retrieves the TickInfo associated with the specified tick index from the pool. If the TickInfo contains any nil fields, they are replaced with zero values using valueOrZero. Parameters: - tick: The tick index (int32) for which the TickInfo is to be retrieved. Behavior: - Retrieves the TickInfo for the given tick from the pool's tick map. - Ensures that all fields of TickInfo are non-nil by calling valueOrZero, which replaces nil values with zero. - Returns the updated TickInfo. Returns: - TickInfo: The tick data with all fields guaranteed to have valid values (nil fields are set to zero). Use Case: This function ensures the retrieved tick data is always valid and safe for further operations, such as calculations or updates, by sanitizing nil fields in the TickInfo structure.

Open
OID
0fe078…3476:111
getTick details

Inspect func

mustGetTick

func(p *pool.Pool, tick int32) *pool.TickInfo

mustGetTick retrieves the TickInfo for a specific tick, panicking if the tick does not exist. This function ensures that the requested tick data exists in the pool's tick mapping. If the tick does not exist, it panics with an appropriate error message. Parameters: - tick: int32, the index of the tick to retrieve. Returns: - TickInfo: The information associated with the specified tick. Behavior: - Checks if the tick exists in the pool's tick mapping (\`p.ticks\`). - If the tick exists, it returns the corresponding \`TickInfo\`. - If the tick does not exist, the function panics with a descriptive error. Panic Conditions: - The specified tick does not exist in the pool's mapping. Example: \`\`\`gno tickInfo := pool.mustGetTick(10) ufmt.Println("Tick Info:", tickInfo) \`\`\`

Open
OID
0fe078…3476:112
mustGetTick details

Inspect func

calculateMaxLiquidityPerTick

func(tickSpacing int32) *uint256.Uint

calculateMaxLiquidityPerTick calculates the maximum liquidity per tick for a given tick spacing.

Open
OID
0fe078…3476:113
calculateMaxLiquidityPerTick details

Inspect func

getFeeGrowthBelowX128

func(tickLower int32, tickCurrent int32, feeGrowthGlobal0X128 *uint256.Uint, feeGrowthGlobal1X128 *uint256.Uint, lowerTick pool.TickInfo) (*uint256.Uint, *uint256.Uint)

getFeeGrowthBelowX128 calculates the fee growth below a specified tick. This function computes the fee growth for token 0 and token 1 below a given tick (\`tickLower\`) relative to the current tick (\`tickCurrent\`). The fee growth values are adjusted based on whether the \`tickCurrent\` is above or below the \`tickLower\`. Parameters: - tickLower: int32, the lower tick boundary for fee calculation. - tickCurrent: int32, the current tick index. - feeGrowthGlobal0X128: \*u256.Uint, the global fee growth for token 0 in X128 precision. - feeGrowthGlobal1X128: \*u256.Uint, the global fee growth for token 1 in X128 precision. - lowerTick: TickInfo, the fee growth and liquidity details for the lower tick. Returns: - \*u256.Uint: Fee growth below \`tickLower\` for token 0. - \*u256.Uint: Fee growth below \`tickLower\` for token 1. Workflow: 1. If \`tickCurrent\` is greater than or equal to \`tickLower\`: - Return the \`feeGrowthOutside0X128\` and \`feeGrowthOutside1X128\` values of the \`lowerTick\`. 2. If \`tickCurrent\` is below \`tickLower\`: - Compute the fee growth below the lower tick by subtracting \`feeGrowthOutside\` values from the global fee growth values (\`feeGrowthGlobal0X128\` and \`feeGrowthGlobal1X128\`). 3. Return the calculated fee growth values for both tokens. Behavior: - If \`tickCurrent >= tickLower\`, the fee growth outside the lower tick is returned as-is. - If \`tickCurrent \< tickLower\`, the fee growth is calculated as: feeGrowthBelow = feeGrowthGlobal - feeGrowthOutside Example: \`\`\`gno feeGrowth0, feeGrowth1 := getFeeGrowthBelowX128( 100, 150, globalFeeGrowth0, globalFeeGrowth1, lowerTickInfo, ) println("Fee Growth Below:", feeGrowth0, feeGrowth1)

Open
OID
0fe078…3476:114
getFeeGrowthBelowX128 details

Inspect func

getFeeGrowthAboveX128

func(tickUpper int32, tickCurrent int32, feeGrowthGlobal0X128 *uint256.Uint, feeGrowthGlobal1X128 *uint256.Uint, upperTick pool.TickInfo) (*uint256.Uint, *uint256.Uint)

getFeeGrowthAboveX128 calculates the fee growth above a specified tick. This function computes the fee growth for token 0 and token 1 above a given tick (\`tickUpper\`) relative to the current tick (\`tickCurrent\`). The fee growth values are adjusted based on whether the \`tickCurrent\` is above or below the \`tickUpper\`. Parameters: - tickUpper: int32, the upper tick boundary for fee calculation. - tickCurrent: int32, the current tick index. - feeGrowthGlobal0X128: \*u256.Uint, the global fee growth for token 0 in X128 precision. - feeGrowthGlobal1X128: \*u256.Uint, the global fee growth for token 1 in X128 precision. - upperTick: TickInfo, the fee growth and liquidity details for the upper tick. Returns: - \*u256.Uint: Fee growth above \`tickUpper\` for token 0. - \*u256.Uint: Fee growth above \`tickUpper\` for token 1. Workflow: 1. If \`tickCurrent\` is less than \`tickUpper\`: - Return the \`feeGrowthOutside0X128\` and \`feeGrowthOutside1X128\` values of the \`upperTick\`. 2. If \`tickCurrent\` is greater than or equal to \`tickUpper\`: - Compute the fee growth above the upper tick by subtracting \`feeGrowthOutside\` values from the global fee growth values (\`feeGrowthGlobal0X128\` and \`feeGrowthGlobal1X128\`). 3. Return the calculated fee growth values for both tokens. Behavior: - If \`tickCurrent \< tickUpper\`, the fee growth outside the upper tick is returned as-is. - If \`tickCurrent >= tickUpper\`, the fee growth is calculated as: feeGrowthAbove = feeGrowthGlobal - feeGrowthOutside Example: feeGrowth0, feeGrowth1 := getFeeGrowthAboveX128( 200, 150, globalFeeGrowth0, globalFeeGrowth1, upperTickInfo, ) println("Fee Growth Above:", feeGrowth0, feeGrowth1) \`\`\`

Open
OID
0fe078…3476:115
getFeeGrowthAboveX128 details

Inspect func

validateTicks

func(tickLower int32, tickUpper int32) .uverse.error

validateTicks validates the tick range for a liquidity position. This function performs three essential checks to ensure the provided tick values are valid before creating or modifying a liquidity position.

Open
OID
0fe078…3476:116
validateTicks details

Inspect func

bitMask8

untyped bigint

// 256 - 1

Value

(255 <untyped> bigint)

tickBitmapFlipTick

func(p *pool.Pool, tick int32, tickSpacing int32)

tickBitmapFlipTick flips the state of a tick in the tick bitmap. This function toggles the "initialized" state of a tick in the tick bitmap. It ensures that the tick aligns with the specified tick spacing and then flips the corresponding bit in the bitmap representation. Parameters: - tick: int32, the tick index to toggle. - tickSpacing: int32, the spacing between valid ticks. The tick must align with this spacing. Workflow: 1. Validates that the \`tick\` aligns with \`tickSpacing\` using \`checkTickSpacing\`. 2. Computes the position of the bit in the tick bitmap: - \`wordPos\`: Determines which word in the bitmap contains the bit. - \`bitPos\`: Identifies the position of the bit within the word. 3. Creates a bitmask using \`Lsh\` (Left Shift) to target the bit at \`bitPos\`. 4. Toggles (flips) the bit using XOR with the current value of the tick bitmap. 5. Updates the tick bitmap with the modified word. Behavior: - If the bit is \`0\` (uninitialized), it will be flipped to \`1\` (initialized). - If the bit is \`1\` (initialized), it will be flipped to \`0\` (uninitialized). Example: pool.tickBitmapFlipTick(120, 60) // This flips the bit for tick 120 with a tick spacing of 60. Notes: - The \`tick\` must be divisible by \`tickSpacing\`. If not, the function will panic.

Open
OID
0fe078…3476:117
tickBitmapFlipTick details

Inspect func

tickBitmapNextInitializedTickWithInOneWord

func(p *pool.Pool, tick int32, tickSpacing int32, lte bool) (int32, bool)

tickBitmapNextInitializedTickWithInOneWord finds the next initialized tick within one word of the bitmap.

Open
OID
0fe078…3476:119
tickBitmapNextInitializedTickWithInOneWord details

Inspect func

getTickBitmap

func(p *pool.Pool, wordPos int16) *uint256.Uint

getTickBitmap gets the tick bitmap for the given word position if the tick bitmap is not initialized, initialize it to zero

Open
OID
0fe078…3476:120
getTickBitmap details

Inspect func

setTickBitmap

func(p *pool.Pool, wordPos int16, tickBitmap *uint256.Uint)

setTickBitmap sets the tick bitmap for the given word position

Open
OID
0fe078…3476:121
setTickBitmap details

Inspect func

tickBitmapPosition

func(tick int32) (int16, uint8)

tickBitmapPosition calculates the word and bit position for a given tick

Open
OID
0fe078…3476:122
tickBitmapPosition details

Inspect func

getWordAndBitPos

func(tick int32, lte bool) (int16, uint8)

getWordAndBitPos gets tick's wordPos and bitPos depending on the swap direction

Open
OID
0fe078…3476:123
getWordAndBitPos details

Inspect func

getMaskBit

func(bitPos uint, lte bool) *uint256.Uint

getMaskBit generates a mask based on the provided bit position (bitPos) and a boolean flag (lte). The function constructs a bitmask with a shift depending on the bit position and the boolean value. It either returns the mask or its negation, based on the value of 'lte' (swap direction). NOTE: should always use a newly created \`u256.One()\` object.

Open
OID
0fe078…3476:124
getMaskBit details

Inspect func

getNextTick

func(lte bool, initialized bool, compress int32, bitPos uint8, tickSpacing int32, masked *uint256.Uint) int32

getNextTick gets the next tick depending on the initialized state and the swap direction

Open
OID
0fe078…3476:125
getNextTick details

Inspect func

getTickIfInitialized

func(compress int32, tickSpacing int32, bitPos uint8, masked *uint256.Uint, lte bool) int32

getTickIfInitialized gets the next tick if the tick bitmap is initialized

Open
OID
0fe078…3476:126
getTickIfInitialized details

Inspect func

getTickIfNotInitialized

func(compress int32, tickSpacing int32, bitPos uint8, lte bool) int32

getTickIfNotInitialized gets the next tick if the tick bitmap is not initialized

Open
OID
0fe078…3476:127
getTickIfNotInitialized details

Inspect func

validatePoolBalance

func(token0 int64, token1 int64, amount int64, isToken0 bool) .uverse.error

validatePoolBalance checks if the pool has sufficient balance of either token0 and token1 before proceeding with a transfer. This prevents the pool won't go into a negative balance.

Open
OID
0fe078…3476:128
validatePoolBalance details

Inspect func

updatePoolBalance

func(token0 int64, token1 int64, amount int64, isToken0 bool) (int64, .uverse.error)

updatePoolBalance calculates the new balance after a transfer and validate. It ensures the resulting balance won't be negative or overflow.

Open
OID
0fe078…3476:130
updatePoolBalance details

Inspect func

ModifyPositionParams

type

ModifyPositionParams repersents the parameters for modifying a liquidity position. This structure is used internally both \`Mint\` and \`Burn\` operation to manage the liquidity positions.

Value

v1.ModifyPositionParams

newModifyPositionParams

func(owner .uverse.address, tickLower int32, tickUpper int32, liquidityDelta *int256.Int) v1.ModifyPositionParams

newModifyPositionParams creates a new \`ModifyPositionParams\` instance. This is used to preare parameters for the \`modifyPosition\` function, which handles both minting and burning of liquidity positions. Parameters: - owner: address that will own (or owns) the position - tickLower: lower tick bound of the position - tickUpper: upper tick bound of the position - liquidityDelta: amount of liquidity to add (positive) or remove (negative) The tick parameters represent prices as powers of 1.0001: - actual\_price = 1.0001^tick - For example, tick = 100 means price = 1.0001^100 Returns: - ModifyPositionParams: a new instance of ModifyPositionParams

Open
OID
0fe078…3476:131
newModifyPositionParams details

Inspect func

SwapCache

type

SwapCache holds data that remains constant throughout a swap.

Value

v1.SwapCache

newSwapCache

func(feeProtocol uint8, liquidityStart *uint256.Uint, blockTimestamp int64) *v1.SwapCache
Open
OID
0fe078…3476:133
newSwapCache details

Inspect func

SwapState

type

SwapState tracks the changing values during a swap. This type helps manage the state transitions that occur as the swap progresses across different price ranges.

Value

v1.SwapState

newSwapState

func(amountSpecifiedRemaining *int256.Int, feeGrowthGlobalX128 *uint256.Uint, liquidity *uint256.Uint, slot0 pool.Slot0) v1.SwapState
Open
OID
0fe078…3476:134
newSwapState details

Inspect func

StepComputations

type

StepComputations holds intermediate values used during a single step of a swap. Each step represents movement from the current tick to the next initialized tick or the target price, whichever comes first.

Value

v1.StepComputations

newPool

func(poolInfo *v1.poolCreateConfig) *pool.Pool
Open
OID
0fe078…3476:135
newPool details

Inspect func

MAX_UINT64

string

Value

"18446744073709551615"

MAX_INT64

string

Value

"9223372036854775807"

MAX_INT128

string

Value

"170141183460469231731687303715884105727"

MAX_UINT128

string

Value

"340282366920938463463374607431768211455"

MAX_INT256

string

Value

"57896044618658097711785492504343953926634992332820282019728792003956564819967"

INT64_MIN

int64

Value

-9223372036854775808

INT64_MAX

int64

Value

9223372036854775807

Q96_RESOLUTION

uint

Value

96

Q128_RESOLUTION

uint

Value

128

Q64

string

// 2 \*\* 64

Value

"18446744073709551616"

Q96

string

// 2 \*\* 96

Value

"79228162514264337593543950336"

Q128

string

// 2 \*\* 128

Value

"340282366920938463463374607431768211456"

maxInt128FromDecimal

*int256.Int
Open
OID
0fe078…3476:137
maxInt128FromDecimal details

Inspect pointer

maxUint128FromDecimal

*uint256.Uint
Open
OID
0fe078…3476:140
maxUint128FromDecimal details

Inspect pointer

toUint128

func(value *uint256.Uint) *uint256.Uint

toUint128 ensures a \*u256.Uint value fits within the uint128 range. This function validates that the given \`value\` is properly initialized and checks whether it exceeds the maximum value of uint128. If the value exceeds the uint128 range, it applies a masking operation to truncate the value to fit within the uint128 limit. Parameters: - value: \*u256.Uint, the value to be checked and possibly truncated. Returns: - \*u256.Uint: A value guaranteed to fit within the uint128 range. Notes: - The function first checks if the value is not nil to avoid potential runtime errors. - The mask ensures that only the lower 128 bits of the value are retained. - If the input value is already within the uint128 range, it is returned unchanged. - If masking is required, a new instance is returned without modifying the input. - MAX\_UINT128 is a constant representing \`2^128 - 1\`.

Open
OID
0fe078…3476:148
toUint128 details

Inspect func

u256Min

func(num1 *uint256.Uint, num2 *uint256.Uint) *uint256.Uint

u256Min returns the smaller of two \*u256.Uint values. This function compares two unsigned 256-bit integers and returns the smaller of the two. If \`num1\` is less than \`num2\`, it returns \`num1\`; otherwise, it returns \`num2\`. Parameters: - num1 (\*u256.Uint): The first unsigned 256-bit integer. - num2 (\*u256.Uint): The second unsigned 256-bit integer. Returns: - \*u256.Uint: The smaller of \`num1\` and \`num2\`. Notes: - This function uses the \`Lt\` (less than) method of \`\*u256.Uint\` to perform the comparison. - The function assumes both input values are non-nil. If nil inputs are possible in the usage context, additional validation may be needed. Example: smaller := u256Min(u256.MustFromDecimal("10"), u256.MustFromDecimal("20")) // Returns 10 smaller := u256Min(u256.MustFromDecimal("30"), u256.MustFromDecimal("20")) // Returns 20

Open
OID
0fe078…3476:150
u256Min details

Inspect func

checkOverFlowInt128

func(value *int256.Int)

checkOverFlowInt128 checks if the value overflows the int128 range.

Open
OID
0fe078…3476:151
checkOverFlowInt128 details

Inspect func

checkTickSpacing

func(tick int32, tickSpacing int32)

checkTickSpacing checks if the tick is divisible by the tickSpacing.

Open
OID
0fe078…3476:152
checkTickSpacing details

Inspect func
assertIsNotUserCall : func(int, rlm .uverse.realm) Inspect
assertIsNotEqualsTokens : func(token0Path string, token1Path string) Inspect
assertIsSupportedFeeTier : func(fee uint32) Inspect
assertIsNotExistsPoolPath : func(instance *v1.poolV1, token0Path string, token1Path string, fee uint32) Inspect
assertIsValidTokenOrder : func(token0Path string, token1Path string) Inspect
errUnsupportedFeeTier : untyped string ="[GNOSWAP-POOL-001] unsupported fee tier"
errPoolAlreadyExists : untyped string ="[GNOSWAP-POOL-002] pool already created"
errOutOfRange : untyped string ="[GNOSWAP-POOL-003] out of range for numeric value"
errInvalidInput : untyped string ="[GNOSWAP-POOL-004] invalid input data"
errDataNotFound : untyped string ="[GNOSWAP-POOL-005] requested data not found"
errLiquidityCalculation : untyped string ="[GNOSWAP-POOL-006] invalid liquidity calculated"
errZeroLiquidity : untyped string ="[GNOSWAP-POOL-007] zero liquidity"
errDuplicateTokenInPool : untyped string ="[GNOSWAP-POOL-008] same token used in single pool"
errTickLowerInvalid : untyped string ="[GNOSWAP-POOL-009] tickLower is invalid"
errTickUpperInvalid : untyped string ="[GNOSWAP-POOL-010] tickUpper is invalid"
errInvalidSwapAmount : untyped string ="[GNOSWAP-POOL-011] invalid swap amount"
errInvalidProtocolFeePct : untyped string ="[GNOSWAP-POOL-012] invalid protocol fee percentage"
errInvalidWithdrawalFeePct : untyped string ="[GNOSWAP-POOL-013] invalid withdrawal fee percentage"
errLockedPool : untyped string ="[GNOSWAP-POOL-014] cannot modify pool while locked"
errPriceOutOfRange : untyped string ="[GNOSWAP-POOL-015] swap price out of range"
errTransferFailed : untyped string ="[GNOSWAP-POOL-016] token transfer failed"
errInvalidTickAndTickSpacing : untyped string ="[GNOSWAP-POOL-017] invalid tick and tick spacing requested"
errInvalidTickRange : untyped string ="[GNOSWAP-POOL-018] tickLower is greater than or equal to tickUpper"
errUnderflow : untyped string ="[GNOSWAP-POOL-019] underflow"
errOverflow : untyped string ="[GNOSWAP-POOL-020] overflow"
errBalanceUpdateFailed : untyped string ="[GNOSWAP-POOL-021] balance update failed"
errInvalidPayer : untyped string ="[GNOSWAP-POOL-022] invalid payer"
errNotAccessEOA : untyped string ="[GNOSWAP-POOL-023] not access EOA"
errInsufficientPayment : untyped string ="[GNOSWAP-POOL-024] insufficient payment"
errNotInitializedObservation : untyped string ="[GNOSWAP-POOL-025] not initialized observation"
errObservationTooOld : untyped string ="[GNOSWAP-POOL-026] target timestamp before oldest observation"
errSpoofedRealm : untyped string ="[GNOSWAP-POOL-027] rlm does not match the current crossing frame"
newErrorWithDetail : func(message string, detail string) string Inspect
makeErrorWithDetails : func(message string, details string) .uverse.error Inspect
tickEventInfo : type =v1.tickEventInfo
NewTickEventInfo : func(tickID int32, tickInfo pool.TickInfo) *v1.tickEventInfo Inspect
FeeTier100 : uint32 =100
FeeTier500 : uint32 =500
FeeTier3000 : uint32 =3000
FeeTier10000 : uint32 =10000
MIN_SQRT_RATIO : string ="4295128739"
MAX_SQRT_RATIO : string ="1461446703485210103287273052203988822378723970342"
poolCreateConfig : type =v1.poolCreateConfig
newPoolParams : func(token0Path string, token1Path string, fee uint32, sqrtPriceX96 string, tickSpacing int32, slot0FeeProtocol uint8) *v1.poolCreateConfig Inspect
validateSqrtPriceX96 : func(sqrtPriceX96 *uint256.Uint) .uverse.error Inspect
isValidFeeTier : func(feeTier uint32) bool Inspect
GetPoolPath : func(token0Path string, token1Path string, fee uint32) string Inspect
defaultSlot0FeeProtocol : uint8 =0
defaultPoolCreationFee : int64 =100000000
defaultWithdrawalFeeBPS : uint64 =100
defaultUnlocked : untyped bool =true
init.51 : func() Inspect
registerPoolV1 : func() Inspect
initStoreData : func(int, rlm .uverse.realm, poolStore pool.IPoolStore) .uverse.error Inspect
poolV1 : type =v1.poolV1
NewPoolV1 : func(store pool.IPoolStore) pool.IPool Inspect
GNS_TOKEN_KEY : string ="gno.land/r/gnoswap/gns.GNS"
validateFeeProtocol : func(feeProtocol0 uint8, feeProtocol1 uint8) .uverse.error Inspect
isValidFeeProtocolValue : func(value uint8) bool Inspect
maxObservationCardinality : uint16 =65535
getTWAP : func(p *pool.Pool, secondsAgo uint32) (int32, *uint256.Uint, .uverse.error) Inspect
writeObservationByPool : func(p *pool.Pool, currentTime int64, tick int32, liquidity *uint256.Uint) .uverse.error Inspect
increaseObservationCardinalityNextByPool : func(p *pool.Pool, observationCardinalityNext uint16) .uverse.error Inspect
transform : func(lastObservation *pool.Observation, currentTime int64, tick int32, liquidity *uint256.Uint) (*pool.Observation, .uverse.error) Inspect
grow : func(os *pool.ObservationState, currentCardinality uint16, nextCardinality uint16) (uint16, .uverse.error) Inspect
lte : func(time int64, a int64, b int64) bool Inspect
writeObservation : func(os *pool.ObservationState, currentTime int64, tick int32, liquidity *uint256.Uint) .uverse.error Inspect
lastObservation : func(os *pool.ObservationState) (*pool.Observation, .uverse.error) Inspect
observationAt : func(os *pool.ObservationState, index uint16) (*pool.Observation, .uverse.error) Inspect
observeSingle : func(os *pool.ObservationState, currentTime int64, secondsAgo uint32, tick int32, index uint16, liquidity *uint256.Uint, cardinality uint16) (int64, string, .uverse.error) Inspect
getSurroundingObservations : func(os *pool.ObservationState, target int64, currentTime int64, tick int32, index uint16, liquidity *uint256.Uint, cardinality uint16) (*pool.Observation, *pool.Observation, .uverse.error) Inspect
binarySearch : func(os *pool.ObservationState, currentTime int64, target int64, index uint16, cardinality uint16) (*pool.Observation, *pool.Observation, .uverse.error) Inspect
observe : func(os *pool.ObservationState, currentTime int64, secondsAgos []uint32, tick int32, index uint16, liquidity *uint256.Uint, cardinality uint16) ([]int64, []string, .uverse.error) Inspect
minRequestedAmount : func(request int64, available int64) int64 Inspect
getPositionKey : func(tickLower int32, tickUpper int32) string Inspect
positionUpdate : func(position pool.PositionInfo, liquidityDelta *int256.Int, feeGrowthInside0X128 *uint256.Uint, feeGrowthInside1X128 *uint256.Uint) (pool.PositionInfo, .uverse.error) Inspect
calculateToken0Amount : func(sqrtPriceLower *uint256.Uint, sqrtPriceUpper *uint256.Uint, liquidityDelta *int256.Int) *int256.Int Inspect
calculateToken1Amount : func(sqrtPriceLower *uint256.Uint, sqrtPriceUpper *uint256.Uint, liquidityDelta *int256.Int) *int256.Int Inspect
PositionLiquidity : func(p *pool.Pool, key string) string Inspect
PositionFeeGrowthInside0LastX128 : func(p *pool.Pool, key string) string Inspect
PositionFeeGrowthInside1LastX128 : func(p *pool.Pool, key string) string Inspect
PositionTokensOwed0 : func(p *pool.Pool, key string) int64 Inspect
PositionTokensOwed1 : func(p *pool.Pool, key string) int64 Inspect
GetPositionByPool : func(p *pool.Pool, key string) (pool.PositionInfo, bool) Inspect
positionUpdateWithKey : func(p *pool.Pool, positionKey string, liquidityDelta *int256.Int, feeGrowthInside0X128 *uint256.Uint, feeGrowthInside1X128 *uint256.Uint) (pool.PositionInfo, .uverse.error) Inspect
setPosition : func(p *pool.Pool, posKey string, positionInfo pool.PositionInfo) Inspect
mustGetPositionByPool : func(p *pool.Pool, positionKey string) *pool.PositionInfo Inspect
modifyPosition : func(p *pool.Pool, params v1.ModifyPositionParams) (pool.PositionInfo, *uint256.Uint, *uint256.Uint, .uverse.error) Inspect
updatePosition : func(p *pool.Pool, positionParams v1.ModifyPositionParams, tick int32) (pool.PositionInfo, .uverse.error) Inspect
MaxBpsValue : uint64 =1000
ZeroBps : uint64 =0
calculateAmountWithFee : func(amount *uint256.Uint, fee *uint256.Uint) (feeAmount *uint256.Uint, afterAmount *uint256.Uint) Inspect
zero : *uint256.Uint Inspect
zeroI256 : *int256.Int Inspect
fixedPointQ128 : *uint256.Uint Inspect
maxInt256 : *uint256.Uint Inspect
maxInt64 : *int256.Int Inspect
minInt64 : *int256.Int Inspect
SwapResult : type =v1.SwapResult
SwapComputation : type =v1.SwapComputation
tickCrossHookFn : type =v1.tickCrossHookFn
applySwapResult : func(pool *pool.Pool, result *v1.SwapResult) Inspect
validatePriceLimits : func(slot0 pool.Slot0, zeroForOne bool, sqrtPriceLimitX96 *uint256.Uint) Inspect
getFeeProtocol : func(slot0 pool.Slot0, zeroForOne bool) uint8 Inspect
getFeeGrowthGlobal : func(pool *pool.Pool, zeroForOne bool) *uint256.Uint Inspect
shouldContinueSwap : func(state v1.SwapState, sqrtPriceLimitX96 *uint256.Uint) bool Inspect
updateFeeProtocol : func(step v1.StepComputations, feeProtocol uint8, state v1.SwapState) (v1.SwapState, v1.StepComputations, .uverse.error) Inspect
computeSwapStepInit : func(state v1.SwapState, pool *pool.Pool, zeroForOne bool) v1.StepComputations Inspect
computeTargetSqrtRatio : func(step v1.StepComputations, sqrtPriceLimitX96 *uint256.Uint, zeroForOne bool) *uint256.Uint Inspect
shouldUsePriceLimit : func(sqrtPriceNext *uint256.Uint, sqrtPriceLimit *uint256.Uint, zeroForOne bool) bool Inspect
computeAmounts : func(state v1.SwapState, sqrtRatioTargetX96 *uint256.Uint, pool *pool.Pool, step v1.StepComputations) (v1.SwapState, v1.StepComputations) Inspect
updateAmounts : func(step v1.StepComputations, state v1.SwapState, exactInput bool) (v1.SwapState, .uverse.error) Inspect
MAX_LIQUIDITY_PER_TICK_SPACING_1 : untyped string ="191757530477355301479181766273477"
MAX_LIQUIDITY_PER_TICK_SPACING_10 : untyped string ="1917569901783203986719870431555990"
MAX_LIQUIDITY_PER_TICK_SPACING_60 : untyped string ="11505743598341114571880798222544994"
MAX_LIQUIDITY_PER_TICK_SPACING_200 : untyped string ="38350317471085141830651933667504588"
MIN_TICK : int32 =-887272
MAX_TICK : int32 =887272
maxLiquidityPerTickSpacing1FromDec : func() *uint256.Uint Inspect
maxLiquidityPerTickSpacing10FromDec : func() *uint256.Uint Inspect
maxLiquidityPerTickSpacing60FromDec : func() *uint256.Uint Inspect
maxLiquidityPerTickSpacing200FromDec : func() *uint256.Uint Inspect
GetTickLiquidityGross : func(p *pool.Pool, tick int32) string Inspect
GetTickLiquidityNet : func(p *pool.Pool, tick int32) string Inspect
GetTickFeeGrowthOutside0X128 : func(p *pool.Pool, tick int32) string Inspect
GetTickFeeGrowthOutside1X128 : func(p *pool.Pool, tick int32) string Inspect
GetTickCumulativeOutside : func(p *pool.Pool, tick int32) int64 Inspect
GetTickSecondsPerLiquidityOutsideX128 : func(p *pool.Pool, tick int32) string Inspect
GetTickSecondsOutside : func(p *pool.Pool, tick int32) uint32 Inspect
GetTickInitialized : func(p *pool.Pool, tick int32) bool Inspect
getFeeGrowthInside : func(p *pool.Pool, tickLower int32, tickUpper int32, tickCurrent int32, feeGrowthGlobal0X128 *uint256.Uint, feeGrowthGlobal1X128 *uint256.Uint) (*uint256.Uint, *uint256.Uint) Inspect
tickUpdate : func(p *pool.Pool, tick int32, tickCurrent int32, liquidityDelta *int256.Int, feeGrowthGlobal0X128 *uint256.Uint, feeGrowthGlobal1X128 *uint256.Uint, upper bool, maxLiquidity *uint256.Uint) flipped bool Inspect
tickCross : func(p *pool.Pool, tick int32, feeGrowthGlobal0X128 *uint256.Uint, feeGrowthGlobal1X128 *uint256.Uint, secondsPerLiquidityCumulativeX128 *uint256.Uint, tickCumulative int64, blockTimestamp int64) *int256.Int Inspect
setTick : func(p *pool.Pool, tick int32, newTickInfo pool.TickInfo) Inspect
deleteTick : func(p *pool.Pool, tick int32) Inspect
getTick : func(p *pool.Pool, tick int32) pool.TickInfo Inspect
mustGetTick : func(p *pool.Pool, tick int32) *pool.TickInfo Inspect
calculateMaxLiquidityPerTick : func(tickSpacing int32) *uint256.Uint Inspect
getFeeGrowthBelowX128 : func(tickLower int32, tickCurrent int32, feeGrowthGlobal0X128 *uint256.Uint, feeGrowthGlobal1X128 *uint256.Uint, lowerTick pool.TickInfo) (*uint256.Uint, *uint256.Uint) Inspect
getFeeGrowthAboveX128 : func(tickUpper int32, tickCurrent int32, feeGrowthGlobal0X128 *uint256.Uint, feeGrowthGlobal1X128 *uint256.Uint, upperTick pool.TickInfo) (*uint256.Uint, *uint256.Uint) Inspect
validateTicks : func(tickLower int32, tickUpper int32) .uverse.error Inspect
bitMask8 : untyped bigint =(255 <untyped> bigint)
tickBitmapFlipTick : func(p *pool.Pool, tick int32, tickSpacing int32) Inspect
tickBitmapNextInitializedTickWithInOneWord : func(p *pool.Pool, tick int32, tickSpacing int32, lte bool) (int32, bool) Inspect
getTickBitmap : func(p *pool.Pool, wordPos int16) *uint256.Uint Inspect
setTickBitmap : func(p *pool.Pool, wordPos int16, tickBitmap *uint256.Uint) Inspect
tickBitmapPosition : func(tick int32) (int16, uint8) Inspect
getWordAndBitPos : func(tick int32, lte bool) (int16, uint8) Inspect
getMaskBit : func(bitPos uint, lte bool) *uint256.Uint Inspect
getNextTick : func(lte bool, initialized bool, compress int32, bitPos uint8, tickSpacing int32, masked *uint256.Uint) int32 Inspect
getTickIfInitialized : func(compress int32, tickSpacing int32, bitPos uint8, masked *uint256.Uint, lte bool) int32 Inspect
getTickIfNotInitialized : func(compress int32, tickSpacing int32, bitPos uint8, lte bool) int32 Inspect
validatePoolBalance : func(token0 int64, token1 int64, amount int64, isToken0 bool) .uverse.error Inspect
updatePoolBalance : func(token0 int64, token1 int64, amount int64, isToken0 bool) (int64, .uverse.error) Inspect
ModifyPositionParams : type =v1.ModifyPositionParams
newModifyPositionParams : func(owner .uverse.address, tickLower int32, tickUpper int32, liquidityDelta *int256.Int) v1.ModifyPositionParams Inspect
SwapCache : type =v1.SwapCache
newSwapCache : func(feeProtocol uint8, liquidityStart *uint256.Uint, blockTimestamp int64) *v1.SwapCache Inspect
SwapState : type =v1.SwapState
newSwapState : func(amountSpecifiedRemaining *int256.Int, feeGrowthGlobalX128 *uint256.Uint, liquidity *uint256.Uint, slot0 pool.Slot0) v1.SwapState Inspect
StepComputations : type =v1.StepComputations
newPool : func(poolInfo *v1.poolCreateConfig) *pool.Pool Inspect
MAX_UINT64 : string ="18446744073709551615"
MAX_INT64 : string ="9223372036854775807"
MAX_INT128 : string ="170141183460469231731687303715884105727"
MAX_UINT128 : string ="340282366920938463463374607431768211455"
MAX_INT256 : string ="57896044618658097711785492504343953926634992332820282019728792003956564819967"
INT64_MIN : int64 =-9223372036854775808
INT64_MAX : int64 =9223372036854775807
Q96_RESOLUTION : uint =96
Q128_RESOLUTION : uint =128
Q64 : string ="18446744073709551616"
Q96 : string ="79228162514264337593543950336"
Q128 : string ="340282366920938463463374607431768211456"
maxInt128FromDecimal : *int256.Int Inspect
maxUint128FromDecimal : *uint256.Uint Inspect
q128FromDecimal : *uint256.Uint Inspect
uint128Mask : *uint256.Uint Inspect
toUint128 : func(value *uint256.Uint) *uint256.Uint Inspect
u256Min : func(num1 *uint256.Uint, num2 *uint256.Uint) *uint256.Uint Inspect
checkOverFlowInt128 : func(value *int256.Int) Inspect
checkTickSpacing : func(tick int32, tickSpacing int32) Inspect