common

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: Apache-2.0 Imports: 11 Imported by: 2

README

x/common

The x/common directory holds helper and utility functions to be utilized by other x/ cosmos-sdk modules.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DenomGov        = "unibi"
	DenomColl       = "uusdc"
	DenomStable     = "unusd"
	DenomStakeToken = "stake"
	DenomTestToken  = "test"
	DenomAxlBTC     = "axlwbtc"
	DenomAxlETH     = "axlweth"

	ModuleName = "common"

	TreasuryPoolModuleAccount = "treasury_pool"

	PairSeparator = ":"

	WhitelistedColl = []string{DenomColl}

	PairGovStable  = AssetPair{Token0: DenomGov, Token1: DenomStable}
	PairCollStable = AssetPair{Token0: DenomColl, Token1: DenomStable}
	PairTestStable = AssetPair{Token0: DenomTestToken, Token1: DenomStable}
	PairBTCStable  = AssetPair{Token0: DenomAxlBTC, Token1: DenomStable}
	PairETHStable  = AssetPair{Token0: DenomAxlETH, Token1: DenomStable}

	ErrInvalidTokenPair = sdkerrors.Register(ModuleName, 1, "invalid token pair")
)
View Source
var (
	ErrInvalidLengthCommon        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCommon          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCommon = fmt.Errorf("proto: unexpected end of group")
)

Functions

func AddrsToStrings added in v0.5.2

func AddrsToStrings(addrs ...sdk.AccAddress) []string

func DenomsFromPoolName

func DenomsFromPoolName(pool string) (denoms []string)

func PairNameFromDenoms added in v0.5.2

func PairNameFromDenoms(denoms []string) string

PairNameFromDenoms returns a string representing a pool of assets in the exact order the denoms were given as args

func SortedPairNameFromDenoms added in v0.5.2

func SortedPairNameFromDenoms(denoms []string) string

SortedPairNameFromDenoms returns a sorted string representing a pool of assets

func StringsToAddrs added in v0.5.2

func StringsToAddrs(strs ...string) []sdk.AccAddress

Types

type AssetPair

type AssetPair struct {
	Token0 string `protobuf:"bytes,1,opt,name=token0,proto3" json:"token0,omitempty"`
	Token1 string `protobuf:"bytes,2,opt,name=token1,proto3" json:"token1,omitempty"`
}

func MustNewAssetPair added in v0.5.2

func MustNewAssetPair(pair string) AssetPair

MustNewAssetPair returns a new asset pair. It will panic if 'pair' is invalid. The form, "token0:token1", is expected for 'pair'.

func NewAssetPair added in v0.5.2

func NewAssetPair(pair string) (AssetPair, error)

NewAssetPair returns a new asset pair instance if the pair is valid. The form, "token0:token1", is expected for 'pair'. Use this function to return an error instead of panicking.

func (*AssetPair) Descriptor added in v0.5.2

func (*AssetPair) Descriptor() ([]byte, []int)

func (*AssetPair) Equal added in v0.5.2

func (this *AssetPair) Equal(that interface{}) bool

func (AssetPair) GetBaseTokenDenom added in v0.4.17

func (pair AssetPair) GetBaseTokenDenom() string

func (AssetPair) GetQuoteTokenDenom added in v0.4.17

func (pair AssetPair) GetQuoteTokenDenom() string

func (AssetPair) Inverse

func (pair AssetPair) Inverse() AssetPair

func (AssetPair) IsSortedOrder added in v0.5.2

func (pair AssetPair) IsSortedOrder() bool

func (*AssetPair) Marshal added in v0.5.2

func (m *AssetPair) Marshal() (dAtA []byte, err error)

func (*AssetPair) MarshalTo added in v0.5.2

func (m *AssetPair) MarshalTo(dAtA []byte) (int, error)

func (*AssetPair) MarshalToSizedBuffer added in v0.5.2

func (m *AssetPair) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AssetPair) ProtoMessage added in v0.5.2

func (*AssetPair) ProtoMessage()

func (*AssetPair) Reset added in v0.5.2

func (m *AssetPair) Reset()

func (*AssetPair) Size added in v0.5.2

func (m *AssetPair) Size() (n int)

func (AssetPair) SortedName added in v0.5.2

func (pair AssetPair) SortedName() string

SortedName is the string representation of the pair with sorted assets.

func (AssetPair) String

func (pair AssetPair) String() string
String returns the string representation of the asset pair.

Note that this differs from the output of the proto-generated 'String' method.

func (*AssetPair) Unmarshal added in v0.5.2

func (m *AssetPair) Unmarshal(dAtA []byte) error

func (AssetPair) Validate added in v0.5.2

func (pair AssetPair) Validate() error

Validate performs a basic validation of the market params

func (*AssetPair) VerboseEqual added in v0.5.2

func (this *AssetPair) VerboseEqual(that interface{}) error

func (*AssetPair) XXX_DiscardUnknown added in v0.5.2

func (m *AssetPair) XXX_DiscardUnknown()

func (*AssetPair) XXX_Marshal added in v0.5.2

func (m *AssetPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AssetPair) XXX_Merge added in v0.5.2

func (m *AssetPair) XXX_Merge(src proto.Message)

func (*AssetPair) XXX_Size added in v0.5.2

func (m *AssetPair) XXX_Size() int

func (*AssetPair) XXX_Unmarshal added in v0.5.2

func (m *AssetPair) XXX_Unmarshal(b []byte) error

type AssetPairs added in v0.5.2

type AssetPairs []AssetPair

AssetPairs is a set of AssetPair, one per pair.

func NewAssetPairs added in v0.5.2

func NewAssetPairs(pairStrings ...string) (pairs AssetPairs)

NewAssetPairs constructs a new asset pair set. A panic will occur if one of the provided pair names is invalid.

func (AssetPairs) Contains added in v0.5.2

func (pairs AssetPairs) Contains(pair AssetPair) bool

Contains checks if a token pair is contained within 'Pairs'

func (AssetPairs) ContainsAtIndex added in v0.5.2

func (pairs AssetPairs) ContainsAtIndex(pair AssetPair) (bool, int)

ContainsAtIndex checks if a token pair is contained within 'Pairs' and a boolean for this condition alongside the corresponding index of 'pair' in the slice of pairs.

func (AssetPairs) MarshalJSON added in v0.5.2

func (pairs AssetPairs) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the AssetPairs type to allow nil AssetPairs to be encoded as empty

func (AssetPairs) Strings added in v0.5.2

func (pairs AssetPairs) Strings() []string

func (AssetPairs) Validate added in v0.5.2

func (pairs AssetPairs) Validate() error

Jump to

Keyboard shortcuts

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