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")
	ErrorWrongTypeAMMV4 = errors.New("raydium Standard pool: Not Raydium AMM_V4 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 Liquidity

type Liquidity struct {
	Name    string
	Address solana.PublicKey

	Immutables LiquidityOpts
	State      LiquidityV4State
	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

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
}

type LiquidityV4State

type LiquidityV4State struct {
	Status                 uint64
	Nonce                  uint64
	MaxOrder               uint64
	Depth                  uint64
	BaseDecimal            uint64
	QuoteDecimal           uint64
	State                  uint64
	ResetFlag              uint64
	MinSize                uint64
	VolMaxCutRatio         uint64
	AmountWaveRatio        uint64
	BaseLotSize            uint64
	QuoteLotSize           uint64
	MinPriceMultiplier     uint64
	MaxPriceMultiplier     uint64
	SystemDecimalValue     uint64
	MinSeparateNumerator   uint64
	MinSeparateDenominator uint64
	TradeFeeNumerator      uint64
	TradeFeeDenominator    uint64
	PnlNumerator           uint64
	PnlDenominator         uint64
	SwapFeeNumerator       uint64
	SwapFeeDenominator     uint64
	BaseNeedTakePnl        uint64
	QuoteNeedTakePnl       uint64
	QuoteTotalPnl          uint64
	BaseTotalPnl           uint64
	PoolOpenTime           uint64
	PunishPcAmount         uint64
	PunishCoinAmount       uint64
	OrderbookToInitTime    uint64
	// u128('poolTotalDepositPc'),
	// u128('poolTotalDepositCoin'),
	SwapBaseInAmount   bin.Uint128
	SwapQuoteOutAmount bin.Uint128
	SwapBase2QuoteFee  uint64
	SwapQuoteInAmount  bin.Uint128
	SwapBaseOutAmount  bin.Uint128
	SwapQuote2BaseFee  uint64
	// amm vault
	BaseVault  solana.PublicKey
	QuoteVault solana.PublicKey
	// mint
	BaseMint  solana.PublicKey
	QuoteMint solana.PublicKey
	LpMint    solana.PublicKey
	// market
	OpenOrders      solana.PublicKey
	MarketId        solana.PublicKey
	MarketProgramId solana.PublicKey
	TargetOrders    solana.PublicKey
	WithdrawQueue   solana.PublicKey
	LpVault         solana.PublicKey
	Owner           solana.PublicKey
	// true circulating supply without lock up
	LpReserve uint64
	Padding   [3]uint64
}

Jump to

Keyboard shortcuts

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