concentrated

package
v0.0.0-...-19dd61d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWrongToken      = errors.New("raydium Concentrated pool: PriceOf: token not in pool")
	ErrorWrongTypeCLMM = errors.New("raydium Concentrated pool: Not Raydium CLMM pool")
)

Functions

This section is empty.

Types

type Pool

type Pool struct {
	Name    string
	Address solana.PublicKey

	Immutables PoolOpts
	State      PoolState
	// contains filtered or unexported fields
}

func Decode

func Decode(poolBytes []byte) (*Pool, error)

func NewPool

func NewPool(client *rpc.Client, name string, poolAddress string, immutables PoolOpts) (*Pool, error)

NewPool Just like Uniswap-V3

func (Pool) Encode

func (p Pool) Encode() ([]byte, error)

func (*Pool) PriceOf

func (p *Pool) PriceOf(token string) (float64, error)

func (*Pool) UpdateState

func (p *Pool) UpdateState(ctx context.Context) error

type PoolOpts

type PoolOpts struct {
	Token0 token.Token
	Token1 token.Token
}

type PoolState

type PoolState struct {
	Blob                      [8]uint8
	Bump                      [1]uint8
	AmmConfig                 solana.PublicKey
	Owner                     solana.PublicKey
	TokenMint0                solana.PublicKey
	TokenMint1                solana.PublicKey
	TokenVault0               solana.PublicKey
	TokenVault1               solana.PublicKey
	ObservationKey            solana.PublicKey
	MintDecimals0             uint8
	MintDecimals1             uint8
	TickSpacing               uint16
	Liquidity                 bin.Uint128
	SqrtPriceX64              bin.Uint128
	TickCurrent               int32
	ObservationIndex          uint16
	ObservationUpdateDuration uint16
	FeeGrowthGlobal0X64       bin.Uint128
	FeeGrowthGlobal1X64       bin.Uint128
	ProtocolFeesToken0        uint64
	ProtocolFeesToken1        uint64
	SwapInAmountToken0        bin.Uint128
	SwapOutAmountToken1       bin.Uint128
	SwapInAmountToken1        bin.Uint128
	SwapOutAmountToken0       bin.Uint128
	Status                    uint8
	Padding                   [7]uint8
	RewardInfos               [3]RewardInfo
	TickArrayBitmap           [16]uint64
	TotalFeesToken0           uint64
	TotalFeesClaimedToken0    uint64
	TotalFeesToken1           uint64
	TotalFeesClaimedToken1    uint64
	FundFeesToken0            uint64
	FundFeesToken1            uint64
	OpenTime                  uint64
	Padding1                  [25]uint64
	Padding2                  [32]uint64
}

type RewardInfo

type RewardInfo struct {
	RewardState           uint8
	OpenTime              uint64
	EndTime               uint64
	LastUpdateTime        uint64
	EmissionsPerSecondX64 bin.Uint128
	RewardTotalEmissioned uint64
	RewardClaimed         uint64
	TokenMint             solana.PublicKey
	TokenVault            solana.PublicKey
	Authority             solana.PublicKey
	RewardGrowthGlobalX64 bin.Uint128
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL