Documentation
¶
Index ¶
- Constants
- Variables
- func EstimateBuy(args *EstimateBuyArgs) (uint64, uint64)
- func EstimateCurrentPrice(currentSupplyInQuarks uint64) *big.Float
- func EstimateSell(args *EstimateSellArgs) (uint64, uint64)
- func EstimateValueExchange(args *EstimateValueExchangeArgs) uint64
- func GetCurrencyAddress(args *GetCurrencyAddressArgs) (ed25519.PublicKey, uint8, error)
- func GetMetadataAddress(args *GetMetadataAddressArgs) (ed25519.PublicKey, uint8, error)
- func GetMintAddress(args *GetMintAddressArgs) (ed25519.PublicKey, uint8, error)
- func GetPoolAddress(args *GetPoolAddressArgs) (ed25519.PublicKey, uint8, error)
- func GetVaultAddress(args *GetVaultAddressArgs) (ed25519.PublicKey, uint8, error)
- func NewBuyAndDepositIntoVmInstruction(accounts *BuyAndDepositIntoVmInstructionAccounts, ...) solana.Instruction
- func NewBuyTokensInstruction(accounts *BuyTokensInstructionAccounts, args *BuyTokensInstructionArgs) solana.Instruction
- func NewInitializeCurrencyInstruction(accounts *InitializeCurrencyInstructionAccounts, ...) solana.Instruction
- func NewInitializeMetadataInstruction(accounts *InitializeMetadataInstructionAccounts, ...) solana.Instruction
- func NewInitializePoolInstruction(accounts *InitializePoolInstructionAccounts, ...) solana.Instruction
- func NewSellAndDepositIntoVmInstruction(accounts *SellAndDepositIntoVmInstructionAccounts, ...) solana.Instruction
- func NewSellTokensInstruction(accounts *SellTokensInstructionAccounts, args *SellTokensInstructionArgs) solana.Instruction
- func ToQuarks(amount uint64) uint64
- type AccountType
- type BuyAndDepositIntoVmInstructionAccounts
- type BuyAndDepositIntoVmInstructionArgs
- type BuyTokensInstructionAccounts
- type BuyTokensInstructionArgs
- type CurrencyConfigAccount
- type EstimateBuyArgs
- type EstimateSellArgs
- type EstimateValueExchangeArgs
- type ExponentialCurve
- func (curve *ExponentialCurve) CostToBuyTokens(currentSupply, tokensToBuy *big.Float) *big.Float
- func (curve *ExponentialCurve) SpotPriceAtSupply(currentSupply *big.Float) *big.Float
- func (curve *ExponentialCurve) TokensBoughtForValue(currentSupply, value *big.Float) *big.Float
- func (curve *ExponentialCurve) TokensForValueExchange(currentValue, value *big.Float) *big.Float
- func (curve *ExponentialCurve) ValueFromSellingTokens(currentValue, tokensToSell *big.Float) *big.Float
- type GetCurrencyAddressArgs
- type GetMetadataAddressArgs
- type GetMintAddressArgs
- type GetPoolAddressArgs
- type GetVaultAddressArgs
- type InitializeCurrencyInstructionAccounts
- type InitializeCurrencyInstructionArgs
- type InitializeMetadataInstructionAccounts
- type InitializeMetadataInstructionArgs
- type InitializePoolInstructionAccounts
- type InitializePoolInstructionArgs
- type InstructionType
- type LiquidityPoolAccount
- type SellAndDepositIntoVmInstructionAccounts
- type SellAndDepositIntoVmInstructionArgs
- type SellTokensInstructionAccounts
- type SellTokensInstructionArgs
Constants ¶
View Source
const ( DefaultMintMaxTokenSupply = 21_000_000 // 21mm tokens DefaultMintQuarksPerUnit = 10_000_000_000 DefaultMintMaxQuarkSupply = DefaultMintMaxTokenSupply * DefaultMintQuarksPerUnit // 21mm tokens with 10 decimals DefaultMintDecimals = 10 )
View Source
const ( MaxCurrencyConfigAccountNameLength = 32 MaxCurrencyConfigAccountSymbolLength = 8 )
View Source
const ( DefaultBuyFeeBps = 0 // 0% fee DefaultSellFeeBps = 100 // 1% fee )
View Source
const ( DefaultCurveDecimals = 18 DefaultCurveAString = "11400230149967394933471" // 11400.230149967394933471 DefaultCurveBString = "877175273521" // 0.000000877175273521 DefaultCurveScaleString = "1000000000000000000" // 10^18 )
View Source
const ( BuyAndDepositIntoVmInstructionArgsSize = (8 + 8 + 2) // account_index )
View Source
const ( BuyTokensInstructionArgsSize = (8 + 8) // min_amount_out )
View Source
const ( CurrencyConfigAccountSize = (8 + 32 + 32 + MaxCurrencyConfigAccountNameLength + MaxCurrencyConfigAccountSymbolLength + 32 + 1 + 1 + 6) // padding )
View Source
const ( InitializeCurrencyInstructionArgsSize = (MaxCurrencyConfigAccountNameLength + MaxCurrencyConfigAccountSymbolLength + 32 + 1 + 1 + 6) // padding )
View Source
const (
InitializeMetadataInstructionArgsSize = 0
)
View Source
const ( InitializePoolInstructionArgsSize = (2 + 2 + 1 + 1 + 1 + 1) // padding )
View Source
const ( LiquidityPoolAccountSize = (8 + 32 + 32 + 32 + 32 + 32 + 32 + 32 + 32 + 2 + 2 + 1 + 1 + 1 + 1) // padding )
View Source
const ( SellAndDepositIntoVmInstructionArgsSize = (8 + 8 + 2) // account_index )
View Source
const ( SellTokensInstructionArgsSize = (8 + 8) // min_amount_out )
Variables ¶
View Source
var ( MintPrefix = []byte("mint") CurrencyPrefix = []byte("currency") PoolPrefix = []byte("pool") TreasuryPrefix = []byte("treasury") MetadataPrefix = []byte("metadata") )
View Source
var ( ErrInvalidProgram = errors.New("invalid program id") ErrInvalidAccountData = errors.New("unexpected account data") ErrInvalidInstructionData = errors.New("unexpected instruction data") )
View Source
var ( PROGRAM_ADDRESS = mustBase58Decode("ccZLx5N31asHhCa7hFmvdC9EGYVam13L8WXPTjPEiJY") PROGRAM_ID = ed25519.PublicKey(PROGRAM_ADDRESS) )
View Source
var ( METADATA_PROGRAM_ID = ed25519.PublicKey(mustBase58Decode("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s")) SPL_TOKEN_PROGRAM_ID = ed25519.PublicKey(mustBase58Decode("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")) SYSTEM_PROGRAM_ID = ed25519.PublicKey(mustBase58Decode("11111111111111111111111111111111")) SYSVAR_RENT_PUBKEY = ed25519.PublicKey(mustBase58Decode("SysvarRent111111111111111111111111111111111")) )
View Source
var CurrencyConfigAccountDiscriminator = []byte{byte(AccountTypeCurrencyConfig), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
View Source
var LiquidityPoolAccountDiscriminator = []byte{byte(AccountTypeLiquidityPool), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Functions ¶
func EstimateBuy ¶
func EstimateBuy(args *EstimateBuyArgs) (uint64, uint64)
func EstimateCurrentPrice ¶
func EstimateSell ¶
func EstimateSell(args *EstimateSellArgs) (uint64, uint64)
func EstimateValueExchange ¶
func EstimateValueExchange(args *EstimateValueExchangeArgs) uint64
func GetCurrencyAddress ¶
func GetCurrencyAddress(args *GetCurrencyAddressArgs) (ed25519.PublicKey, uint8, error)
func GetMetadataAddress ¶
func GetMetadataAddress(args *GetMetadataAddressArgs) (ed25519.PublicKey, uint8, error)
func GetMintAddress ¶
func GetMintAddress(args *GetMintAddressArgs) (ed25519.PublicKey, uint8, error)
func GetPoolAddress ¶
func GetPoolAddress(args *GetPoolAddressArgs) (ed25519.PublicKey, uint8, error)
func GetVaultAddress ¶
func GetVaultAddress(args *GetVaultAddressArgs) (ed25519.PublicKey, uint8, error)
func NewBuyAndDepositIntoVmInstruction ¶
func NewBuyAndDepositIntoVmInstruction( accounts *BuyAndDepositIntoVmInstructionAccounts, args *BuyAndDepositIntoVmInstructionArgs, ) solana.Instruction
func NewBuyTokensInstruction ¶
func NewBuyTokensInstruction( accounts *BuyTokensInstructionAccounts, args *BuyTokensInstructionArgs, ) solana.Instruction
func NewInitializeCurrencyInstruction ¶
func NewInitializeCurrencyInstruction( accounts *InitializeCurrencyInstructionAccounts, args *InitializeCurrencyInstructionArgs, ) solana.Instruction
func NewInitializeMetadataInstruction ¶
func NewInitializeMetadataInstruction( accounts *InitializeMetadataInstructionAccounts, args *InitializeMetadataInstructionArgs, ) solana.Instruction
func NewInitializePoolInstruction ¶
func NewInitializePoolInstruction( accounts *InitializePoolInstructionAccounts, args *InitializePoolInstructionArgs, ) solana.Instruction
func NewSellAndDepositIntoVmInstruction ¶
func NewSellAndDepositIntoVmInstruction( accounts *SellAndDepositIntoVmInstructionAccounts, args *SellAndDepositIntoVmInstructionArgs, ) solana.Instruction
func NewSellTokensInstruction ¶
func NewSellTokensInstruction( accounts *SellTokensInstructionAccounts, args *SellTokensInstructionArgs, ) solana.Instruction
Types ¶
type AccountType ¶
type AccountType uint8
const ( AccountTypeUnknown AccountType = iota AccountTypeCurrencyConfig AccountTypeLiquidityPool )
type BuyAndDepositIntoVmInstructionAccounts ¶
type BuyAndDepositIntoVmInstructionAccounts struct {
Buyer ed25519.PublicKey
Pool ed25519.PublicKey
Currency ed25519.PublicKey
TargetMint ed25519.PublicKey
BaseMint ed25519.PublicKey
VaultTarget ed25519.PublicKey
VaultBase ed25519.PublicKey
BuyerBase ed25519.PublicKey
FeeTarget ed25519.PublicKey
FeeBase ed25519.PublicKey
VmAuthority ed25519.PublicKey
Vm ed25519.PublicKey
VmMemory ed25519.PublicKey
VmOmnibus ed25519.PublicKey
VtaOwner ed25519.PublicKey
}
type BuyTokensInstructionAccounts ¶
type BuyTokensInstructionAccounts struct {
Buyer ed25519.PublicKey
Pool ed25519.PublicKey
Currency ed25519.PublicKey
TargetMint ed25519.PublicKey
BaseMint ed25519.PublicKey
VaultTarget ed25519.PublicKey
VaultBase ed25519.PublicKey
BuyerTarget ed25519.PublicKey
BuyerBase ed25519.PublicKey
FeeTarget ed25519.PublicKey
FeeBase ed25519.PublicKey
}
type CurrencyConfigAccount ¶
type CurrencyConfigAccount struct {
Authority ed25519.PublicKey
Mint ed25519.PublicKey
Name string
Symbol string
Seed ed25519.PublicKey
Bump uint8
MintBump uint8
}
func (*CurrencyConfigAccount) String ¶
func (obj *CurrencyConfigAccount) String() string
func (*CurrencyConfigAccount) Unmarshal ¶
func (obj *CurrencyConfigAccount) Unmarshal(data []byte) error
type EstimateBuyArgs ¶
type EstimateSellArgs ¶
type ExponentialCurve ¶
type ExponentialCurve struct {
// contains filtered or unexported fields
}
func DefaultExponentialCurve ¶
func DefaultExponentialCurve() *ExponentialCurve
func (*ExponentialCurve) CostToBuyTokens ¶
func (curve *ExponentialCurve) CostToBuyTokens(currentSupply, tokensToBuy *big.Float) *big.Float
What is the cost to buy tokensToBuy given the currentSupply?
func (*ExponentialCurve) SpotPriceAtSupply ¶
func (curve *ExponentialCurve) SpotPriceAtSupply(currentSupply *big.Float) *big.Float
func (*ExponentialCurve) TokensBoughtForValue ¶
func (curve *ExponentialCurve) TokensBoughtForValue(currentSupply, value *big.Float) *big.Float
How many tokens will be bought for a value given the currentSupply?
func (*ExponentialCurve) TokensForValueExchange ¶
func (curve *ExponentialCurve) TokensForValueExchange(currentValue, value *big.Float) *big.Float
How many tokens should be exchanged for a value given the currentValue?
func (*ExponentialCurve) ValueFromSellingTokens ¶
func (curve *ExponentialCurve) ValueFromSellingTokens(currentValue, tokensToSell *big.Float) *big.Float
How much value is received when selling tokensToSell with currentValueLocked in the reserves?
type GetCurrencyAddressArgs ¶
type GetMetadataAddressArgs ¶
type GetMintAddressArgs ¶
type GetPoolAddressArgs ¶
type GetVaultAddressArgs ¶
type InitializeMetadataInstructionArgs ¶
type InitializeMetadataInstructionArgs struct {
}
type InstructionType ¶
type InstructionType uint8
const ( Unknown InstructionType = iota InstructionTypeInitializeCurrency InstructionTypeInitializePool InstructionTypeInitializeMetadata InstructionTypeBuyTokens InstructionTypeSellTokens InstructionTypeBuyAndDepositIntoVm InstructionTypeSellAndDepositIntoVm )
type LiquidityPoolAccount ¶
type LiquidityPoolAccount struct {
Authority ed25519.PublicKey
Currency ed25519.PublicKey
TargetMint ed25519.PublicKey
BaseMint ed25519.PublicKey
VaultTarget ed25519.PublicKey
VaultBase ed25519.PublicKey
FeeTarget ed25519.PublicKey
FeeBase ed25519.PublicKey
BuyFee uint16
SellFee uint16
Bump uint8
VaultTargetBump uint8
VaultBaseBump uint8
}
func (*LiquidityPoolAccount) String ¶
func (obj *LiquidityPoolAccount) String() string
func (*LiquidityPoolAccount) Unmarshal ¶
func (obj *LiquidityPoolAccount) Unmarshal(data []byte) error
type SellAndDepositIntoVmInstructionAccounts ¶
type SellAndDepositIntoVmInstructionAccounts struct {
Seller ed25519.PublicKey
Pool ed25519.PublicKey
Currency ed25519.PublicKey
TargetMint ed25519.PublicKey
BaseMint ed25519.PublicKey
VaultTarget ed25519.PublicKey
VaultBase ed25519.PublicKey
SellerTarget ed25519.PublicKey
FeeTarget ed25519.PublicKey
FeeBase ed25519.PublicKey
VmAuthority ed25519.PublicKey
Vm ed25519.PublicKey
VmMemory ed25519.PublicKey
VmOmnibus ed25519.PublicKey
VtaOwner ed25519.PublicKey
}
type SellTokensInstructionAccounts ¶
type SellTokensInstructionAccounts struct {
Seller ed25519.PublicKey
Pool ed25519.PublicKey
Currency ed25519.PublicKey
TargetMint ed25519.PublicKey
BaseMint ed25519.PublicKey
VaultTarget ed25519.PublicKey
VaultBase ed25519.PublicKey
SellerTarget ed25519.PublicKey
SellerBase ed25519.PublicKey
FeeTarget ed25519.PublicKey
FeeBase ed25519.PublicKey
}
Source Files
¶
- accounts_currency_config.go
- accounts_liquidity_pool.go
- address.go
- estimate.go
- exponential_curve.go
- instructions_buy_and_deposit_into_vm.go
- instructions_buy_tokens.go
- instructions_initialize_currency.go
- instructions_initialize_metadata.go
- instructions_initialize_pool.go
- instructions_sell_and_deposit_into_vm.go
- instructions_sell_tokens.go
- program.go
- types_account_type.go
- types_instruction_type.go
- utils.go
Click to show internal directories.
Click to hide internal directories.