standard

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 Standard pool: PriceOf: token not in pool")
	ErrorWrongTypeCPMM = errors.New("raydium Standard pool: Not Raydium CPMM pool")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	Mint                 solana.PublicKey
	Owner                solana.PublicKey
	Amount               uint64
	DelegateOption       uint32
	Delegate             solana.PublicKey
	State                uint8
	IsNativeOption       uint32
	IsNative             uint64
	DelegatedAmount      uint64
	CloseAuthorityOption uint32
	CloseAuthority       solana.PublicKey
}

type CpmmPoolInfo

type CpmmPoolInfo struct {
	Blob               [8]uint8
	AmmConfig          solana.PublicKey
	PoolCreator        solana.PublicKey
	Token0Vault        solana.PublicKey
	Token1Vault        solana.PublicKey
	LpMint             solana.PublicKey
	Token0Mint         solana.PublicKey
	Token1Mint         solana.PublicKey
	Token0Program      solana.PublicKey
	Token1Program      solana.PublicKey
	ObservationKey     solana.PublicKey
	AuthBump           uint8
	Status             uint8
	LpMintDecimals     uint8
	Mint0Decimals      uint8
	Mint1Decimals      uint8
	LpSupply           uint64
	ProtocolFeesToken0 uint64
	ProtocolFeesToken1 uint64
	FundFeesToken0     uint64
	FundFeesToken1     uint64
	OpenTime           uint64
	Padding            [32]uint64
}

type Liquidity

type Liquidity struct {
	Name    string
	Address solana.PublicKey

	Immutables LiquidityOpts
	State      CpmmPoolInfo
	Extras     LiquidityExtras
	// contains filtered or unexported fields
}

func Decode

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

func NewPool

func NewPool(client *rpc.Client, name string, poolAddress string, immutables LiquidityOpts) (*Liquidity, error)

NewPool Just like Uniswap-V2, interesting

func (Liquidity) Encode

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

func (*Liquidity) PriceOf

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

func (*Liquidity) UpdateState

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

func (*Liquidity) UpdateVault

func (p *Liquidity) UpdateVault(ctx context.Context) error

type LiquidityExtras

type LiquidityExtras struct {
	BaseReserve  uint64
	QuoteReserve uint64
	MintAAmount  uint64
	MintBAmount  uint64
	PoolPrice    float64
}

type LiquidityOpts

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

Jump to

Keyboard shortcuts

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