Versions in this module Expand all Collapse all v0 v0.0.6 Jun 24, 2022 Changes in this version type PoolState + LiquidityGross *big.Int + LiquidityNet *big.Int v0.0.5 Jun 8, 2022 Changes in this version + var ErrPoolNotFound = errors.New("uniswap v3 factory: pool not found") + var ErrWrongToken = errors.New("uniswap v3 pool: PriceOf: token not in pool") + func GetAmountsOut(price, lpValue, lowerPrice, upperPrice float64) (float64, float64) + func GetInitializedTickAtPrice(price float64, tickSpace int) int64 + func GetPriceAtTick(tick int64) float64 + func GetTickAtPrice(price float64) int64 + type Pool struct + Address common.Address + Immutables PoolOpts + Name string + State PoolState + func Decode(poolBytes []byte) (*Pool, error) + func NewPool(client *ethclient.Client, name string, poolAddress common.Address, ...) (*Pool, error) + func (p *Pool) PriceOf(token common.Address) (float64, error) + func (p *Pool) UpdateState(ctx context.Context, client *ethclient.Client) error + func (p Pool) Encode() ([]byte, error) + type PoolManager interface + GetPool func(token0, token1 common.Address, fee int64) (Pool, error) + GetPoolAddress func(token0, token1 common.Address, fee int64) (common.Address, error) + type PoolOpts struct + Fee int64 + Token0 token.Token + Token1 token.Token + type PoolState struct + Liquidity *big.Int + SqrtPriceX96 *big.Int + Tick *big.Int + type UniswapV3 struct + Client *ethclient.Client + Factory *univ3factory.Univ3factoryCaller + Opts db.Opts + PoolAddressCache db.Cacher + PoolCache db.Cacher + func New(client *ethclient.Client, tokenManager token.TokenManager, ...) *UniswapV3 + func (v3 *UniswapV3) GetPool(ctx context.Context, token0, token1 common.Address, fee int64) (*Pool, error) + func (v3 *UniswapV3) GetPoolAddress(ctx context.Context, token0, token1 common.Address, fee int64) (common.Address, error) + func (v3 *UniswapV3) GetPrice(ctx context.Context, token0, token1 common.Address, fee int64) (float64, error) + func (v3 *UniswapV3) UpdateCachedPoolStates(ctx context.Context) error