mirror of
https://github.com/luxfi/precompile.git
synced 2026-09-24 00:26:21 +00:00
LP-9010 LXPool v4 PoolManager (singleton pool state) LP-9011 LXOracle Price aggregation LP-9012 LXRouter v4 SwapRouter (external swap entry) LP-9013 LXHooks v4 hook registry LP-9014 LXFlash Flash accounting LP-9020 LXBook CLOB orderbook engine LP-9030 LXVault Custody + margin LP-9040 LXFeed Derived/computed pricing LP-9050 LXLend Lending pool LP-9060 LXAutoRepay Self-repaying loans LP-9070 LXLiquidator Liquidation engine LP-9080 LXTransmuter Debt → collateral conversion LP-9090 LXFillAttest Settlement attestation Removed all backward-compat aliases. One name per address.
43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
// Copyright (C) 2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package dex
|
|
|
|
import (
|
|
"math/big"
|
|
)
|
|
|
|
// TickInfo stores per-tick state matching Uniswap V4 Pool.TickInfo.
|
|
// This is a thin state struct for PoolState — all math that operates
|
|
// on ticks lives in the DEX engine (~/work/lux/dex/pkg/lx/).
|
|
type TickInfo struct {
|
|
LiquidityGross *big.Int // Total liquidity referencing this tick
|
|
LiquidityNet *big.Int // Net liquidity change when tick is crossed
|
|
FeeGrowthOutside0X128 *big.Int // Fee growth per unit of liquidity on the other side
|
|
FeeGrowthOutside1X128 *big.Int
|
|
}
|
|
|
|
// NewTickInfo creates a zero-initialized TickInfo.
|
|
func NewTickInfo() *TickInfo {
|
|
return &TickInfo{
|
|
LiquidityGross: big.NewInt(0),
|
|
LiquidityNet: big.NewInt(0),
|
|
FeeGrowthOutside0X128: big.NewInt(0),
|
|
FeeGrowthOutside1X128: big.NewInt(0),
|
|
}
|
|
}
|
|
|
|
// TickBitmap tracks initialized tick state.
|
|
// This is a thin state container for PoolState — all bitmap traversal
|
|
// math lives in the DEX engine (~/work/lux/dex/pkg/lx/).
|
|
type TickBitmap struct {
|
|
Words map[int16]*big.Int
|
|
}
|
|
|
|
// NewTickBitmap creates an empty tick bitmap.
|
|
func NewTickBitmap() *TickBitmap {
|
|
return &TickBitmap{
|
|
Words: make(map[int16]*big.Int),
|
|
}
|
|
}
|