src

package
v0.0.0-...-1091e8e Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BTCDenom  = "factory/osmo1z0qrq605sjgcqpylfl4aa6s90x738j7m58wyatt0tdzflg2ha26q67k743/wbtc"
	USDCDenom = "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4"
	BidDenom  = "stake"
)
View Source
const (
	CHAIN_ID  = "osmosis-1"
	FEE_DENOM = "uosmo"
)

Variables

This section is empty.

Functions

func BuyBinanceBTC

func BuyBinanceBTC(amount float64) (boughtAmount, boughtPrice float64, err error)

func BuyOsmosisBTC

func BuyOsmosisBTC(seedConfig SeedConfig, route []poolmanagertypes.SwapAmountInSplitRoute, binanceBTCPrice float64) error

func CheckArbitrage

func CheckArbitrage(seedConfig SeedConfig) error

func CreateGRPCConnection

func CreateGRPCConnection(addr string) (*grpc.ClientConn, error)

CreateGRPCConnection createa a grpc connection to a given url

func GetBinanceBTCToUSDTPrice

func GetBinanceBTCToUSDTPrice() (float64, error)

func GetBinanceBTCUSDTBalance

func GetBinanceBTCUSDTBalance() (btcBalance float64, usdtBalance float64, err error)

func GetBinanceUSDCToBTCPrice

func GetBinanceUSDCToBTCPrice() (float64, error)

func GetOsmosisBTCToUSDCPriceAndRoute

func GetOsmosisBTCToUSDCPriceAndRoute(tokenInAmount float64) (float64, []poolmanagertypes.SwapAmountInSplitRoute, error)

Note that the amount here should be in human readable exponent E.g) getting usdc price of 1 bitcoin would be GetOsmosisBTCToUSDCPrice(1)

func GetOsmosisBTCUSDTBalance

func GetOsmosisBTCUSDTBalance(SeedConfig) (float64, float64, error)

GetOsmosisBTCUSDTalance returns the balances in human readable exponents

func GetOsmosisUSDCToBTCPriceAndRoute

func GetOsmosisUSDCToBTCPriceAndRoute(tokenInAmount float64) (float64, []poolmanagertypes.SwapAmountInSplitRoute, error)

func GetTotalBalance

func GetTotalBalance(seedConfig SeedConfig) (float64, float64, error)

func SellBinanceBTC

func SellBinanceBTC(amount float64) (soldAmount, soldPrice float64, err error)

func SellOsmosisBTC

func SellOsmosisBTC(seedConfig SeedConfig, route []poolmanagertypes.SwapAmountInSplitRoute, binanceBTCPrice float64) error

func SignAndBroadcastAuthenticatorMsgMultiSignersWithBlock

func SignAndBroadcastAuthenticatorMsgMultiSignersWithBlock(
	senderPrivKeys []cryptotypes.PrivKey,
	signerPrivKeys []cryptotypes.PrivKey,
	cosignerPrivKeys map[int][]cryptotypes.PrivKey,
	encCfg params.EncodingConfig,
	tm tmservice.ServiceClient,
	ac authtypes.QueryClient,
	txClient txtypes.ServiceClient,
	chainID string,
	msgs []sdk.Msg,
	selectedAuthenticators []uint64,
) error

func SignAuthenticatorMsgMultiSignersBytes

func SignAuthenticatorMsgMultiSignersBytes(
	senderPrivKeys []cryptotypes.PrivKey,
	signerPrivKeys []cryptotypes.PrivKey,
	cosignerPrivKeys map[int][]cryptotypes.PrivKey,
	encCfg params.EncodingConfig,
	tm tmservice.ServiceClient,
	ac authtypes.QueryClient,
	txClient txtypes.ServiceClient,
	chainID string,
	msgs []sdk.Msg,
	selectedAuthenticators []uint64,
	sequenceOffset uint64,
) ([]byte, error)

func SignAuthenticatorMsgWithHeight

func SignAuthenticatorMsgWithHeight(
	gen client.TxConfig,
	msgs []sdk.Msg,
	feeAmt sdk.Coins,
	gas uint64,
	chainID string,
	accNums, accSeqs []uint64,
	signers, signatures []cryptotypes.PrivKey,
	cosigners map[int][]cryptotypes.PrivKey,
	selectedAuthenticators []uint64,
	timeoutHeight uint64,
) ([]byte, error)

GenTx generates a signed mock transaction.

func SwapWithTopOfBlockAuction

func SwapWithTopOfBlockAuction(seedConfig SeedConfig,
	route []poolmanagertypes.SwapAmountInSplitRoute,
	tokenInDenom string,
	tokenOutMinAmount uint64,
) error

Types

type BinanceResponse

type BinanceResponse struct {
	Symbol string `json:"symbol"`
	Price  string `json:"price"`
}

type Pool

type Pool struct {
	PoolId        uint64 `json:"id"`
	TokenOutdenom string `json:"token_out_denom"`
}

type QuoteResponse

type QuoteResponse struct {
	AmountOut string  `json:"amount_out"`
	Route     []Route `json:"route"`
}

type Route

type Route struct {
	Pools    []Pool `json:"pools"`
	InAmount string `json:"in_amount"`
}

type SeedConfig

type SeedConfig struct {
	ChainID        string
	GRPCConnection *grpc.ClientConn
	EncodingConfig params.EncodingConfig
	Key            *secp256k1.PrivKey
	DenomMap       map[string]string
}

func OsmosisInit

func OsmosisInit() (SeedConfig, error)

Jump to

Keyboard shortcuts

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