common

package
v9.0.0-...-e599657 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyChain = Chain("")
	BNBChain   = Chain("BNB")
	BSCChain   = Chain("BSC")
	ETHChain   = Chain("ETH")
	BTCChain   = Chain("BTC")
	LTCChain   = Chain("LTC")
	BCHChain   = Chain("BCH")
	DOGEChain  = Chain("DOGE")
	THORChain  = Chain("THOR")
	TERRAChain = Chain("TERRA")
	GAIAChain  = Chain("GAIA")
	AVAXChain  = Chain("AVAX")
)

Variables

View Source
var (
	// EmptyAsset empty asset, not valid
	EmptyAsset = Asset{Chain: EmptyChain, Symbol: "", Ticker: "", Synth: false}
	// LUNAAsset LUNA
	LUNAAsset = Asset{Chain: TERRAChain, Symbol: "LUNA", Ticker: "LUNA", Synth: false}
	// ATOMAsset ATOM
	ATOMAsset = Asset{Chain: GAIAChain, Symbol: "ATOM", Ticker: "ATOM", Synth: false}
	// BNBAsset BNB
	BNBAsset = Asset{Chain: BNBChain, Symbol: "BNB", Ticker: "BNB", Synth: false}
	// BNBBEP20Asset BNB
	BNBBEP20Asset = Asset{Chain: BSCChain, Symbol: "BNB", Ticker: "BNB", Synth: false}
	// BTCAsset BTC
	BTCAsset = Asset{Chain: BTCChain, Symbol: "BTC", Ticker: "BTC", Synth: false}
	// LTCAsset BTC
	LTCAsset = Asset{Chain: LTCChain, Symbol: "LTC", Ticker: "LTC", Synth: false}
	// BCHAsset BCH
	BCHAsset = Asset{Chain: BCHChain, Symbol: "BCH", Ticker: "BCH", Synth: false}
	// DOGEAsset DOGE
	DOGEAsset = Asset{Chain: DOGEChain, Symbol: "DOGE", Ticker: "DOGE", Synth: false}
	// ETHAsset ETH
	ETHAsset = Asset{Chain: ETHChain, Symbol: "ETH", Ticker: "ETH", Synth: false}
	// AVAXAsset AVAX
	AVAXAsset = Asset{Chain: AVAXChain, Symbol: "AVAX", Ticker: "AVAX", Synth: false}
	// Rune67CAsset RUNE on Binance test net
	Rune67CAsset = Asset{Chain: BNBChain, Symbol: "RUNE-67C", Ticker: "RUNE", Synth: false} // mocknet asset on binance ganges
	// RuneB1AAsset RUNE on Binance main net
	RuneB1AAsset = Asset{Chain: BNBChain, Symbol: "RUNE-B1A", Ticker: "RUNE", Synth: false} // mainnet
	// RuneNative RUNE on thorchain
	RuneNative            = Asset{Chain: THORChain, Symbol: "RUNE", Ticker: "RUNE", Synth: false}
	RuneERC20Asset        = Asset{Chain: ETHChain, Symbol: "RUNE-0x3155ba85d5f96b2d030a4966af206230e46849cb", Ticker: "RUNE", Synth: false}
	RuneERC20MocknetAsset = Asset{Chain: ETHChain, Symbol: "RUNE-0xd601c6A3a36721320573885A8d8420746dA3d7A0", Ticker: "RUNE", Synth: false}
	TOR                   = Asset{Chain: THORChain, Symbol: "TOR", Ticker: "TOR", Synth: false}
	THORBTC               = Asset{Chain: THORChain, Symbol: "BTC", Ticker: "BTC", Synth: false}
)

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Chain  Chain  `json:"chain,omitempty"`
	Symbol string `json:"symbol,omitempty"`
	Ticker string `json:"ticker,omitempty"`
	Synth  bool   `json:"synth,omitempty"`
	Trade  bool   `json:"trade,omitempty"`
}

func NewAsset

func NewAsset(input string) (Asset, error)

NewAsset parse the given input into Asset object

func (Asset) GetDerivedAsset

func (a Asset) GetDerivedAsset() Asset

Get derived asset of asset

func (Asset) GetLayer1Asset

func (a Asset) GetLayer1Asset() Asset

Get layer1 asset version

func (Asset) GetSyntheticAsset

func (a Asset) GetSyntheticAsset() Asset

Get synthetic asset of asset

func (Asset) GetTradeAsset

func (a Asset) GetTradeAsset() Asset

Get trade asset of asset

func (Asset) IsSyntheticAsset

func (a Asset) IsSyntheticAsset() bool

Check if asset is a pegged asset

func (Asset) IsTradeAsset

func (a Asset) IsTradeAsset() bool

func (Asset) MimirString

func (a Asset) MimirString() string

Replace pool name "." with a "-" for Mimir key checking.

func (Asset) String

func (a Asset) String() string

String implement fmt.Stringer , return the string representation of Asset

type Chain

type Chain string

func NewChain

func NewChain(chainID string) (Chain, error)

NewChain create a new Chain and default the siging_algo to Secp256k1

func (Chain) GetGasAsset

func (c Chain) GetGasAsset() Asset

GetGasAsset chain's base asset

func (Chain) String

func (c Chain) String() string

String implement fmt.Stringer

func (Chain) Valid

func (c Chain) Valid() error

Valid validates chain format, should consist only of uppercase letters

type Chains

type Chains []Chain

Chains represent a slice of Chain

type Coin

type Coin struct {
	Asset    Asset                  `json:"asset"`
	Amount   cosmossdk_io_math.Uint `json:"amount"`
	Decimals int64                  `json:"decimals,omitempty"`
}

func NewCoin

func NewCoin(asset Asset, amount cosmossdk_io_math.Uint) Coin

NewCoin return a new instance of Coin

type Coins

type Coins []Coin

Jump to

Keyboard shortcuts

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