types

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ProposalTypeCreatePool         = "CreatePool"
	ProposalTypeEditPoolConfig     = "EditPoolConfig"
	ProposalTypeEditSwapInvariants = "EditSwapInvariants"
)
View Source
const (
	ModuleName   = "vpool"
	StoreKey     = "vpoolkey"
	RouterKey    = ModuleName
	QuerierRoute = ModuleName
)

Variables

View Source
var (
	ErrPairNotSupported     = sdkerrors.Register(ModuleName, 1, "pair not supported")
	ErrOverTradingLimit     = sdkerrors.Register(ModuleName, 2, "over trading limit")
	ErrQuoteReserveAtZero   = sdkerrors.Register(ModuleName, 3, "quote reserve after at zero")
	ErrBaseReserveAtZero    = sdkerrors.Register(ModuleName, 4, "base reserve after at zero")
	ErrNoLastSnapshotSaved  = sdkerrors.Register(ModuleName, 5, "There was no last snapshot, could be that you did not do snapshot on pool creation")
	ErrOverFluctuationLimit = sdkerrors.Register(ModuleName, 6, "price is over fluctuation limit")
	ErrAssetFailsUserLimit  = sdkerrors.Register(ModuleName, 7, "amount of assets traded does not meet user-defined limit")
	ErrNoValidPrice         = sdkerrors.Register(ModuleName, 8, "no valid prices available")
	ErrNoValidTWAP          = sdkerrors.Register(ModuleName, 9, "TWAP price not found")
	// Could replace ErrBaseReserveAtZero and ErrQUoteReserveAtZero if wrapped
	ErrNonPositiveReserves = sdkerrors.Register(ModuleName, 10, "base and quote reserves must always be positive")
)
View Source
var (
	ErrInvalidLengthEvent        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEvent          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEvent = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGov        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGov          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthState        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowState          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupState = fmt.Errorf("proto: unexpected end of group")
)
View Source
var Direction_name = map[int32]string{
	0: "DIRECTION_UNSPECIFIED",
	1: "ADD_TO_POOL",
	2: "REMOVE_FROM_POOL",
}
View Source
var Direction_value = map[string]int32{
	"DIRECTION_UNSPECIFIED": 0,
	"ADD_TO_POOL":           1,
	"REMOVE_FROM_POOL":      2,
}
View Source
var TwapCalcOption_name = map[int32]string{
	0: "TWAP_CALC_OPTION_UNSPECIFIED",
	1: "SPOT",
	2: "QUOTE_ASSET_SWAP",
	3: "BASE_ASSET_SWAP",
}
View Source
var TwapCalcOption_value = map[string]int32{
	"TWAP_CALC_OPTION_UNSPECIFIED": 0,
	"SPOT":                         1,
	"QUOTE_ASSET_SWAP":             2,
	"BASE_ASSET_SWAP":              3,
}

Functions

func RegisterCodec added in v0.2.9

func RegisterCodec(cdc *codec.LegacyAmino)

func RegisterInterfaces added in v0.2.9

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

func RegisterQueryHandler added in v0.3.0

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient added in v0.3.0

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint added in v0.3.0

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer added in v0.3.0

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer added in v0.3.0

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type CreatePoolProposal added in v0.11.0

type CreatePoolProposal struct {
	Title       string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	// pair represents the pair of the vpool.
	Pair github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,3,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"`
	// quote_asset_reserve is the amount of quote asset the pool will be initialized with.
	QuoteAssetReserve github_com_cosmos_cosmos_sdk_types.Dec `` /* 154-byte string literal not displayed */
	// base_asset_reserve is the amount of base asset the pool will be initialized with.
	BaseAssetReserve github_com_cosmos_cosmos_sdk_types.Dec `` /* 151-byte string literal not displayed */
	Config           VpoolConfig                            `protobuf:"bytes,7,opt,name=config,proto3" json:"config"`
}

func (*CreatePoolProposal) Descriptor added in v0.11.0

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

func (*CreatePoolProposal) GetConfig added in v0.16.1

func (m *CreatePoolProposal) GetConfig() VpoolConfig

func (*CreatePoolProposal) GetDescription added in v0.11.0

func (m *CreatePoolProposal) GetDescription() string

func (*CreatePoolProposal) GetTitle added in v0.11.0

func (m *CreatePoolProposal) GetTitle() string

func (*CreatePoolProposal) Marshal added in v0.11.0

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

func (*CreatePoolProposal) MarshalTo added in v0.11.0

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

func (*CreatePoolProposal) MarshalToSizedBuffer added in v0.11.0

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

func (*CreatePoolProposal) ProposalRoute added in v0.11.0

func (proposal *CreatePoolProposal) ProposalRoute() string

func (*CreatePoolProposal) ProposalType added in v0.11.0

func (proposal *CreatePoolProposal) ProposalType() string

func (*CreatePoolProposal) ProtoMessage added in v0.11.0

func (*CreatePoolProposal) ProtoMessage()

func (*CreatePoolProposal) Reset added in v0.11.0

func (m *CreatePoolProposal) Reset()

func (*CreatePoolProposal) Size added in v0.11.0

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

func (*CreatePoolProposal) String added in v0.11.0

func (m *CreatePoolProposal) String() string

func (*CreatePoolProposal) Unmarshal added in v0.11.0

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

func (*CreatePoolProposal) ValidateBasic added in v0.11.0

func (proposal *CreatePoolProposal) ValidateBasic() error

func (*CreatePoolProposal) XXX_DiscardUnknown added in v0.11.0

func (m *CreatePoolProposal) XXX_DiscardUnknown()

func (*CreatePoolProposal) XXX_Marshal added in v0.11.0

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

func (*CreatePoolProposal) XXX_Merge added in v0.11.0

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

func (*CreatePoolProposal) XXX_Size added in v0.11.0

func (m *CreatePoolProposal) XXX_Size() int

func (*CreatePoolProposal) XXX_Unmarshal added in v0.11.0

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

type CurrentTWAP added in v0.5.1

type CurrentTWAP struct {
	PairID      string                                 `protobuf:"bytes,1,opt,name=pair_id,json=pairId,proto3" json:"pair_id,omitempty"`
	Numerator   github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=numerator,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"numerator"`
	Denominator github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=denominator,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"denominator"`
	Price       github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"`
}

CurrentTWAP states defines the numerator and denominator for the TWAP calculation

func (*CurrentTWAP) Descriptor added in v0.5.1

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

func (*CurrentTWAP) GetPairID added in v0.5.1

func (m *CurrentTWAP) GetPairID() string

func (*CurrentTWAP) Marshal added in v0.5.1

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

func (*CurrentTWAP) MarshalTo added in v0.5.1

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

func (*CurrentTWAP) MarshalToSizedBuffer added in v0.5.1

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

func (*CurrentTWAP) ProtoMessage added in v0.5.1

func (*CurrentTWAP) ProtoMessage()

func (*CurrentTWAP) Reset added in v0.5.1

func (m *CurrentTWAP) Reset()

func (*CurrentTWAP) Size added in v0.5.1

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

func (*CurrentTWAP) String added in v0.5.1

func (m *CurrentTWAP) String() string

func (*CurrentTWAP) Unmarshal added in v0.5.1

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

func (*CurrentTWAP) XXX_DiscardUnknown added in v0.5.1

func (m *CurrentTWAP) XXX_DiscardUnknown()

func (*CurrentTWAP) XXX_Marshal added in v0.5.1

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

func (*CurrentTWAP) XXX_Merge added in v0.5.1

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

func (*CurrentTWAP) XXX_Size added in v0.5.1

func (m *CurrentTWAP) XXX_Size() int

func (*CurrentTWAP) XXX_Unmarshal added in v0.5.1

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

type Direction

type Direction int32
const (
	Direction_DIRECTION_UNSPECIFIED Direction = 0
	Direction_ADD_TO_POOL           Direction = 1
	Direction_REMOVE_FROM_POOL      Direction = 2
)

func (Direction) EnumDescriptor

func (Direction) EnumDescriptor() ([]byte, []int)

func (Direction) String

func (x Direction) String() string

func (Direction) ToMultiplier added in v0.16.1

func (dir Direction) ToMultiplier() int64

type EditPoolConfigProposal added in v0.16.1

type EditPoolConfigProposal struct {
	Title       string                                            `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Description string                                            `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	Pair        github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,3,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"`
	Config      VpoolConfig                                       `protobuf:"bytes,4,opt,name=config,proto3" json:"config"`
}

func (*EditPoolConfigProposal) Descriptor added in v0.16.1

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

func (*EditPoolConfigProposal) GetConfig added in v0.16.1

func (m *EditPoolConfigProposal) GetConfig() VpoolConfig

func (*EditPoolConfigProposal) GetDescription added in v0.16.1

func (m *EditPoolConfigProposal) GetDescription() string

func (*EditPoolConfigProposal) GetTitle added in v0.16.1

func (m *EditPoolConfigProposal) GetTitle() string

func (*EditPoolConfigProposal) Marshal added in v0.16.1

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

func (*EditPoolConfigProposal) MarshalTo added in v0.16.1

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

func (*EditPoolConfigProposal) MarshalToSizedBuffer added in v0.16.1

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

func (*EditPoolConfigProposal) ProposalRoute added in v0.16.1

func (proposal *EditPoolConfigProposal) ProposalRoute() string

func (*EditPoolConfigProposal) ProposalType added in v0.16.1

func (proposal *EditPoolConfigProposal) ProposalType() string

func (*EditPoolConfigProposal) ProtoMessage added in v0.16.1

func (*EditPoolConfigProposal) ProtoMessage()

func (*EditPoolConfigProposal) Reset added in v0.16.1

func (m *EditPoolConfigProposal) Reset()

func (*EditPoolConfigProposal) Size added in v0.16.1

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

func (*EditPoolConfigProposal) String added in v0.16.1

func (m *EditPoolConfigProposal) String() string

func (*EditPoolConfigProposal) Unmarshal added in v0.16.1

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

func (*EditPoolConfigProposal) ValidateBasic added in v0.16.1

func (proposal *EditPoolConfigProposal) ValidateBasic() error

func (*EditPoolConfigProposal) XXX_DiscardUnknown added in v0.16.1

func (m *EditPoolConfigProposal) XXX_DiscardUnknown()

func (*EditPoolConfigProposal) XXX_Marshal added in v0.16.1

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

func (*EditPoolConfigProposal) XXX_Merge added in v0.16.1

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

func (*EditPoolConfigProposal) XXX_Size added in v0.16.1

func (m *EditPoolConfigProposal) XXX_Size() int

func (*EditPoolConfigProposal) XXX_Unmarshal added in v0.16.1

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

type EditSwapInvariantsProposal added in v0.16.1

type EditSwapInvariantsProposal struct {
	Title       string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	// Map from pair ID to a multiple on the swap invariant. For example, a proposal containing
	// "swap_invariant_maps": [{ "uatom:unusd": "5" }, { "uosmo:unusd": "0.9" }]
	// would mutliply the swap invariant of the ATOM and OSMO trading pairs by
	// 5 and 0.9 respectively. The price at which k changes is the instantaneous
	// mark price at the time of the proposal's execution.
	SwapInvariantMaps []EditSwapInvariantsProposal_SwapInvariantMultiple `protobuf:"bytes,5,rep,name=swap_invariant_maps,json=swapInvariantMaps,proto3" json:"swap_invariant_maps"`
}

EditSwapInvariantsProposal is a governance proposal to change the swap invariant of the virtual pool for one or more trading pairs.

func (*EditSwapInvariantsProposal) Descriptor added in v0.16.1

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

func (*EditSwapInvariantsProposal) GetDescription added in v0.16.1

func (m *EditSwapInvariantsProposal) GetDescription() string

func (*EditSwapInvariantsProposal) GetSwapInvariantMaps added in v0.16.1

func (*EditSwapInvariantsProposal) GetTitle added in v0.16.1

func (m *EditSwapInvariantsProposal) GetTitle() string

func (*EditSwapInvariantsProposal) Marshal added in v0.16.1

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

func (*EditSwapInvariantsProposal) MarshalTo added in v0.16.1

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

func (*EditSwapInvariantsProposal) MarshalToSizedBuffer added in v0.16.1

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

func (*EditSwapInvariantsProposal) ProposalRoute added in v0.16.1

func (proposal *EditSwapInvariantsProposal) ProposalRoute() string

func (*EditSwapInvariantsProposal) ProposalType added in v0.16.1

func (proposal *EditSwapInvariantsProposal) ProposalType() string

func (*EditSwapInvariantsProposal) ProtoMessage added in v0.16.1

func (*EditSwapInvariantsProposal) ProtoMessage()

func (*EditSwapInvariantsProposal) Reset added in v0.16.1

func (m *EditSwapInvariantsProposal) Reset()

func (*EditSwapInvariantsProposal) Size added in v0.16.1

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

func (*EditSwapInvariantsProposal) String added in v0.16.1

func (m *EditSwapInvariantsProposal) String() string

func (*EditSwapInvariantsProposal) Unmarshal added in v0.16.1

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

func (*EditSwapInvariantsProposal) ValidateBasic added in v0.16.1

func (proposal *EditSwapInvariantsProposal) ValidateBasic() error

func (*EditSwapInvariantsProposal) XXX_DiscardUnknown added in v0.16.1

func (m *EditSwapInvariantsProposal) XXX_DiscardUnknown()

func (*EditSwapInvariantsProposal) XXX_Marshal added in v0.16.1

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

func (*EditSwapInvariantsProposal) XXX_Merge added in v0.16.1

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

func (*EditSwapInvariantsProposal) XXX_Size added in v0.16.1

func (m *EditSwapInvariantsProposal) XXX_Size() int

func (*EditSwapInvariantsProposal) XXX_Unmarshal added in v0.16.1

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

type EditSwapInvariantsProposal_SwapInvariantMultiple added in v0.16.1

type EditSwapInvariantsProposal_SwapInvariantMultiple struct {
	// Pair is a string identifier for an asset pair.
	Pair github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,3,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"`
	// Multiplier is a number representing the desired percentage change to the
	// swap invariant of the AMM pool underlying 'pair'
	Multiplier github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=multiplier,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"multiplier"`
}

A map between a trading pair and a desired multiplier for its swap invariant.

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) Descriptor added in v0.16.1

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) Marshal added in v0.16.1

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

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) MarshalTo added in v0.16.1

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) MarshalToSizedBuffer added in v0.16.1

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

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) ProtoMessage added in v0.16.1

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) Reset added in v0.16.1

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) Size added in v0.16.1

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) String added in v0.16.1

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) Unmarshal added in v0.16.1

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) Validate added in v0.16.1

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) XXX_DiscardUnknown added in v0.16.1

func (m *EditSwapInvariantsProposal_SwapInvariantMultiple) XXX_DiscardUnknown()

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) XXX_Marshal added in v0.16.1

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

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) XXX_Merge added in v0.16.1

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) XXX_Size added in v0.16.1

func (*EditSwapInvariantsProposal_SwapInvariantMultiple) XXX_Unmarshal added in v0.16.1

type GenesisState added in v0.2.9

type GenesisState struct {
	Vpools []Vpool `protobuf:"bytes,1,rep,name=vpools,proto3" json:"vpools"`
}

GenesisState defines the vpool module's genesis state.

func DefaultGenesis added in v0.2.9

func DefaultGenesis() *GenesisState

DefaultGenesis returns the default Capability genesis state

func GetGenesisStateFromAppState added in v0.14.0

func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *GenesisState

func (*GenesisState) Descriptor added in v0.2.9

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

func (*GenesisState) GetVpools added in v0.2.10

func (m *GenesisState) GetVpools() []Vpool

func (*GenesisState) Marshal added in v0.2.9

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

func (*GenesisState) MarshalTo added in v0.2.9

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

func (*GenesisState) MarshalToSizedBuffer added in v0.2.9

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

func (*GenesisState) ProtoMessage added in v0.2.9

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset added in v0.2.9

func (m *GenesisState) Reset()

func (*GenesisState) Size added in v0.2.9

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

func (*GenesisState) String added in v0.2.9

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal added in v0.2.9

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

func (GenesisState) Validate added in v0.2.9

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown added in v0.2.9

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal added in v0.2.9

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

func (*GenesisState) XXX_Merge added in v0.2.9

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

func (*GenesisState) XXX_Size added in v0.2.9

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal added in v0.2.9

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

type MarkPriceChangedEvent added in v0.15.0

type MarkPriceChangedEvent struct {
	Pair           github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,1,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"`
	Price          github_com_cosmos_cosmos_sdk_types.Dec            `protobuf:"bytes,2,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"`
	BlockTimestamp time.Time                                         `protobuf:"bytes,3,opt,name=block_timestamp,json=blockTimestamp,proto3,stdtime" json:"block_timestamp"`
}

func (*MarkPriceChangedEvent) Descriptor added in v0.15.0

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

func (*MarkPriceChangedEvent) GetBlockTimestamp added in v0.15.0

func (m *MarkPriceChangedEvent) GetBlockTimestamp() time.Time

func (*MarkPriceChangedEvent) Marshal added in v0.15.0

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

func (*MarkPriceChangedEvent) MarshalTo added in v0.15.0

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

func (*MarkPriceChangedEvent) MarshalToSizedBuffer added in v0.15.0

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

func (*MarkPriceChangedEvent) ProtoMessage added in v0.15.0

func (*MarkPriceChangedEvent) ProtoMessage()

func (*MarkPriceChangedEvent) Reset added in v0.15.0

func (m *MarkPriceChangedEvent) Reset()

func (*MarkPriceChangedEvent) Size added in v0.15.0

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

func (*MarkPriceChangedEvent) String added in v0.15.0

func (m *MarkPriceChangedEvent) String() string

func (*MarkPriceChangedEvent) Unmarshal added in v0.15.0

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

func (*MarkPriceChangedEvent) XXX_DiscardUnknown added in v0.15.0

func (m *MarkPriceChangedEvent) XXX_DiscardUnknown()

func (*MarkPriceChangedEvent) XXX_Marshal added in v0.15.0

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

func (*MarkPriceChangedEvent) XXX_Merge added in v0.15.0

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

func (*MarkPriceChangedEvent) XXX_Size added in v0.15.0

func (m *MarkPriceChangedEvent) XXX_Size() int

func (*MarkPriceChangedEvent) XXX_Unmarshal added in v0.15.0

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

type OracleKeeper added in v0.17.0

type OracleKeeper interface {
	GetExchangeRate(ctx sdk.Context, pair asset.Pair) (sdk.Dec, error)
	SetPrice(ctx sdk.Context, pair asset.Pair, price sdk.Dec)
}

type PoolPrices added in v0.13.0

type PoolPrices struct {
	// Pair identifier for the two assets. Always in format 'base:quote'
	Pair github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,9,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"`
	// MarkPrice is the instantaneous price of the perp.
	// Equivalent to quoteAssetReserve / baseAssetReserve.
	MarkPrice github_com_cosmos_cosmos_sdk_types.Dec `` /* 129-byte string literal not displayed */
	// IndexPrice is the price of the "underlying" for the perp
	IndexPrice string `protobuf:"bytes,11,opt,name=index_price,json=indexPrice,proto3" json:"index_price,omitempty"`
	// TwapMark is the time-weighted average (mark) price.
	TwapMark string `protobuf:"bytes,12,opt,name=twap_mark,json=twapMark,proto3" json:"twap_mark,omitempty"`
	// SwapInvariant is the product of the reserves, commonly referred to as "k".
	SwapInvariant github_com_cosmos_cosmos_sdk_types.Int `` /* 163-byte string literal not displayed */
	// The block number corresponding to each price
	BlockNumber int64 `protobuf:"varint,14,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"`
}

PoolPrices is a simple structure that displays a snapshot of the mark and index prices for an asset. Empty strings for the indexPrice or twapMark fields indicate that the price is currently unavailable.

func (*PoolPrices) Descriptor added in v0.13.0

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

func (*PoolPrices) GetBlockNumber added in v0.13.0

func (m *PoolPrices) GetBlockNumber() int64

func (*PoolPrices) GetIndexPrice added in v0.14.0

func (m *PoolPrices) GetIndexPrice() string

func (*PoolPrices) GetTwapMark added in v0.14.0

func (m *PoolPrices) GetTwapMark() string

func (*PoolPrices) Marshal added in v0.13.0

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

func (*PoolPrices) MarshalTo added in v0.13.0

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

func (*PoolPrices) MarshalToSizedBuffer added in v0.13.0

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

func (*PoolPrices) ProtoMessage added in v0.13.0

func (*PoolPrices) ProtoMessage()

func (*PoolPrices) Reset added in v0.13.0

func (m *PoolPrices) Reset()

func (*PoolPrices) Size added in v0.13.0

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

func (*PoolPrices) String added in v0.13.0

func (m *PoolPrices) String() string

func (*PoolPrices) Unmarshal added in v0.13.0

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

func (*PoolPrices) XXX_DiscardUnknown added in v0.13.0

func (m *PoolPrices) XXX_DiscardUnknown()

func (*PoolPrices) XXX_Marshal added in v0.13.0

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

func (*PoolPrices) XXX_Merge added in v0.13.0

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

func (*PoolPrices) XXX_Size added in v0.13.0

func (m *PoolPrices) XXX_Size() int

func (*PoolPrices) XXX_Unmarshal added in v0.13.0

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

type QueryAllPoolsRequest added in v0.5.0

type QueryAllPoolsRequest struct {
}

func (*QueryAllPoolsRequest) Descriptor added in v0.5.0

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

func (*QueryAllPoolsRequest) Marshal added in v0.5.0

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

func (*QueryAllPoolsRequest) MarshalTo added in v0.5.0

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

func (*QueryAllPoolsRequest) MarshalToSizedBuffer added in v0.5.0

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

func (*QueryAllPoolsRequest) ProtoMessage added in v0.5.0

func (*QueryAllPoolsRequest) ProtoMessage()

func (*QueryAllPoolsRequest) Reset added in v0.5.0

func (m *QueryAllPoolsRequest) Reset()

func (*QueryAllPoolsRequest) Size added in v0.5.0

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

func (*QueryAllPoolsRequest) String added in v0.5.0

func (m *QueryAllPoolsRequest) String() string

func (*QueryAllPoolsRequest) Unmarshal added in v0.5.0

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

func (*QueryAllPoolsRequest) XXX_DiscardUnknown added in v0.5.0

func (m *QueryAllPoolsRequest) XXX_DiscardUnknown()

func (*QueryAllPoolsRequest) XXX_Marshal added in v0.5.0

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

func (*QueryAllPoolsRequest) XXX_Merge added in v0.5.0

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

func (*QueryAllPoolsRequest) XXX_Size added in v0.5.0

func (m *QueryAllPoolsRequest) XXX_Size() int

func (*QueryAllPoolsRequest) XXX_Unmarshal added in v0.5.0

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

type QueryAllPoolsResponse added in v0.4.9

type QueryAllPoolsResponse struct {
	Pools  []Vpool      `protobuf:"bytes,1,rep,name=pools,proto3" json:"pools"`
	Prices []PoolPrices `protobuf:"bytes,2,rep,name=prices,proto3" json:"prices"`
}

func (*QueryAllPoolsResponse) Descriptor added in v0.4.9

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

func (*QueryAllPoolsResponse) GetPools added in v0.4.9

func (m *QueryAllPoolsResponse) GetPools() []Vpool

func (*QueryAllPoolsResponse) GetPrices added in v0.13.0

func (m *QueryAllPoolsResponse) GetPrices() []PoolPrices

func (*QueryAllPoolsResponse) Marshal added in v0.4.9

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

func (*QueryAllPoolsResponse) MarshalTo added in v0.4.9

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

func (*QueryAllPoolsResponse) MarshalToSizedBuffer added in v0.4.9

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

func (*QueryAllPoolsResponse) ProtoMessage added in v0.4.9

func (*QueryAllPoolsResponse) ProtoMessage()

func (*QueryAllPoolsResponse) Reset added in v0.4.9

func (m *QueryAllPoolsResponse) Reset()

func (*QueryAllPoolsResponse) Size added in v0.4.9

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

func (*QueryAllPoolsResponse) String added in v0.4.9

func (m *QueryAllPoolsResponse) String() string

func (*QueryAllPoolsResponse) Unmarshal added in v0.4.9

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

func (*QueryAllPoolsResponse) XXX_DiscardUnknown added in v0.4.9

func (m *QueryAllPoolsResponse) XXX_DiscardUnknown()

func (*QueryAllPoolsResponse) XXX_Marshal added in v0.4.9

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

func (*QueryAllPoolsResponse) XXX_Merge added in v0.4.9

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

func (*QueryAllPoolsResponse) XXX_Size added in v0.4.9

func (m *QueryAllPoolsResponse) XXX_Size() int

func (*QueryAllPoolsResponse) XXX_Unmarshal added in v0.4.9

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

type QueryBaseAssetPriceRequest added in v0.5.0

type QueryBaseAssetPriceRequest struct {
	Pair      github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,1,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"`
	Direction Direction                                         `protobuf:"varint,2,opt,name=direction,proto3,enum=nibiru.vpool.v1.Direction" json:"direction,omitempty"`
	// base asset is the crypto asset, e.g. BTC or ETH
	BaseAssetAmount github_com_cosmos_cosmos_sdk_types.Dec `` /* 148-byte string literal not displayed */
}

func (*QueryBaseAssetPriceRequest) Descriptor added in v0.5.0

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

func (*QueryBaseAssetPriceRequest) GetDirection added in v0.5.0

func (m *QueryBaseAssetPriceRequest) GetDirection() Direction

func (*QueryBaseAssetPriceRequest) Marshal added in v0.5.0

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

func (*QueryBaseAssetPriceRequest) MarshalTo added in v0.5.0

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

func (*QueryBaseAssetPriceRequest) MarshalToSizedBuffer added in v0.5.0

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

func (*QueryBaseAssetPriceRequest) ProtoMessage added in v0.5.0

func (*QueryBaseAssetPriceRequest) ProtoMessage()

func (*QueryBaseAssetPriceRequest) Reset added in v0.5.0

func (m *QueryBaseAssetPriceRequest) Reset()

func (*QueryBaseAssetPriceRequest) Size added in v0.5.0

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

func (*QueryBaseAssetPriceRequest) String added in v0.5.0

func (m *QueryBaseAssetPriceRequest) String() string

func (*QueryBaseAssetPriceRequest) Unmarshal added in v0.5.0

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

func (*QueryBaseAssetPriceRequest) XXX_DiscardUnknown added in v0.5.0

func (m *QueryBaseAssetPriceRequest) XXX_DiscardUnknown()

func (*QueryBaseAssetPriceRequest) XXX_Marshal added in v0.5.0

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

func (*QueryBaseAssetPriceRequest) XXX_Merge added in v0.5.0

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

func (*QueryBaseAssetPriceRequest) XXX_Size added in v0.5.0

func (m *QueryBaseAssetPriceRequest) XXX_Size() int

func (*QueryBaseAssetPriceRequest) XXX_Unmarshal added in v0.5.0

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

type QueryBaseAssetPriceResponse added in v0.5.0

type QueryBaseAssetPriceResponse struct {
	PriceInQuoteDenom github_com_cosmos_cosmos_sdk_types.Dec `` /* 156-byte string literal not displayed */
}

func (*QueryBaseAssetPriceResponse) Descriptor added in v0.5.0

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

func (*QueryBaseAssetPriceResponse) Marshal added in v0.5.0

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

func (*QueryBaseAssetPriceResponse) MarshalTo added in v0.5.0

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

func (*QueryBaseAssetPriceResponse) MarshalToSizedBuffer added in v0.5.0

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

func (*QueryBaseAssetPriceResponse) ProtoMessage added in v0.5.0

func (*QueryBaseAssetPriceResponse) ProtoMessage()

func (*QueryBaseAssetPriceResponse) Reset added in v0.5.0

func (m *QueryBaseAssetPriceResponse) Reset()

func (*QueryBaseAssetPriceResponse) Size added in v0.5.0

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

func (*QueryBaseAssetPriceResponse) String added in v0.5.0

func (m *QueryBaseAssetPriceResponse) String() string

func (*QueryBaseAssetPriceResponse) Unmarshal added in v0.5.0

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

func (*QueryBaseAssetPriceResponse) XXX_DiscardUnknown added in v0.5.0

func (m *QueryBaseAssetPriceResponse) XXX_DiscardUnknown()

func (*QueryBaseAssetPriceResponse) XXX_Marshal added in v0.5.0

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

func (*QueryBaseAssetPriceResponse) XXX_Merge added in v0.5.0

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

func (*QueryBaseAssetPriceResponse) XXX_Size added in v0.5.0

func (m *QueryBaseAssetPriceResponse) XXX_Size() int

func (*QueryBaseAssetPriceResponse) XXX_Unmarshal added in v0.5.0

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

type QueryClient added in v0.3.0

type QueryClient interface {
	// Queries the reserve assets in a given pool, identified by a token pair.
	ReserveAssets(ctx context.Context, in *QueryReserveAssetsRequest, opts ...grpc.CallOption) (*QueryReserveAssetsResponse, error)
	// Queries all virtual pools.
	AllPools(ctx context.Context, in *QueryAllPoolsRequest, opts ...grpc.CallOption) (*QueryAllPoolsResponse, error)
	// Queries prices
	BaseAssetPrice(ctx context.Context, in *QueryBaseAssetPriceRequest, opts ...grpc.CallOption) (*QueryBaseAssetPriceResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient added in v0.3.0

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryReserveAssetsRequest added in v0.5.0

type QueryReserveAssetsRequest struct {
	// always BASE:QUOTE, e.g. BTC:NUSD or ETH:NUSD
	Pair github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,1,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"`
}

func (*QueryReserveAssetsRequest) Descriptor added in v0.5.0

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

func (*QueryReserveAssetsRequest) Marshal added in v0.5.0

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

func (*QueryReserveAssetsRequest) MarshalTo added in v0.5.0

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

func (*QueryReserveAssetsRequest) MarshalToSizedBuffer added in v0.5.0

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

func (*QueryReserveAssetsRequest) ProtoMessage added in v0.5.0

func (*QueryReserveAssetsRequest) ProtoMessage()

func (*QueryReserveAssetsRequest) Reset added in v0.5.0

func (m *QueryReserveAssetsRequest) Reset()

func (*QueryReserveAssetsRequest) Size added in v0.5.0

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

func (*QueryReserveAssetsRequest) String added in v0.5.0

func (m *QueryReserveAssetsRequest) String() string

func (*QueryReserveAssetsRequest) Unmarshal added in v0.5.0

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

func (*QueryReserveAssetsRequest) XXX_DiscardUnknown added in v0.5.0

func (m *QueryReserveAssetsRequest) XXX_DiscardUnknown()

func (*QueryReserveAssetsRequest) XXX_Marshal added in v0.5.0

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

func (*QueryReserveAssetsRequest) XXX_Merge added in v0.5.0

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

func (*QueryReserveAssetsRequest) XXX_Size added in v0.5.0

func (m *QueryReserveAssetsRequest) XXX_Size() int

func (*QueryReserveAssetsRequest) XXX_Unmarshal added in v0.5.0

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

type QueryReserveAssetsResponse added in v0.3.0

type QueryReserveAssetsResponse struct {
	// base asset is the crypto asset, e.g. BTC or ETH
	BaseAssetReserve github_com_cosmos_cosmos_sdk_types.Dec `` /* 151-byte string literal not displayed */
	// quote asset is usually stablecoin, in our case NUSD
	QuoteAssetReserve github_com_cosmos_cosmos_sdk_types.Dec `` /* 154-byte string literal not displayed */
}

func (*QueryReserveAssetsResponse) Descriptor added in v0.3.0

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

func (*QueryReserveAssetsResponse) Marshal added in v0.3.0

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

func (*QueryReserveAssetsResponse) MarshalTo added in v0.3.0

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

func (*QueryReserveAssetsResponse) MarshalToSizedBuffer added in v0.3.0

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

func (*QueryReserveAssetsResponse) ProtoMessage added in v0.3.0

func (*QueryReserveAssetsResponse) ProtoMessage()

func (*QueryReserveAssetsResponse) Reset added in v0.3.0

func (m *QueryReserveAssetsResponse) Reset()

func (*QueryReserveAssetsResponse) Size added in v0.3.0

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

func (*QueryReserveAssetsResponse) String added in v0.3.0

func (m *QueryReserveAssetsResponse) String() string

func (*QueryReserveAssetsResponse) Unmarshal added in v0.3.0

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

func (*QueryReserveAssetsResponse) XXX_DiscardUnknown added in v0.3.0

func (m *QueryReserveAssetsResponse) XXX_DiscardUnknown()

func (*QueryReserveAssetsResponse) XXX_Marshal added in v0.3.0

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

func (*QueryReserveAssetsResponse) XXX_Merge added in v0.3.0

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

func (*QueryReserveAssetsResponse) XXX_Size added in v0.3.0

func (m *QueryReserveAssetsResponse) XXX_Size() int

func (*QueryReserveAssetsResponse) XXX_Unmarshal added in v0.3.0

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

type QueryServer added in v0.3.0

type QueryServer interface {
	// Queries the reserve assets in a given pool, identified by a token pair.
	ReserveAssets(context.Context, *QueryReserveAssetsRequest) (*QueryReserveAssetsResponse, error)
	// Queries all virtual pools.
	AllPools(context.Context, *QueryAllPoolsRequest) (*QueryAllPoolsResponse, error)
	// Queries prices
	BaseAssetPrice(context.Context, *QueryBaseAssetPriceRequest) (*QueryBaseAssetPriceResponse, error)
}

QueryServer is the server API for Query service.

type ReserveSnapshot

type ReserveSnapshot struct {
	Pair             github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,5,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"`
	BaseAssetReserve github_com_cosmos_cosmos_sdk_types.Dec            `` /* 151-byte string literal not displayed */
	// quote asset is usually the margin asset, e.g. NUSD
	QuoteAssetReserve github_com_cosmos_cosmos_sdk_types.Dec `` /* 154-byte string literal not displayed */
	// milliseconds since unix epoch
	TimestampMs int64 `protobuf:"varint,3,opt,name=timestamp_ms,json=timestampMs,proto3" json:"timestamp_ms,omitempty"`
}

a snapshot of the vpool's reserves at a given point in time

func NewReserveSnapshot added in v0.15.0

func NewReserveSnapshot(
	pair asset.Pair,
	baseAssetReserve, quoteAssetReserve sdk.Dec,
	blockTime time.Time,
) ReserveSnapshot

func (*ReserveSnapshot) Descriptor

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

func (ReserveSnapshot) GetLowerMarkPriceFluctuationLimit added in v0.15.0

func (s ReserveSnapshot) GetLowerMarkPriceFluctuationLimit(fluctuationLimitRatio sdk.Dec) sdk.Dec

GetLowerMarkPriceFluctuationLimit returns the minimum limit price based on the fluctuationLimitRatio

func (*ReserveSnapshot) GetTimestampMs

func (m *ReserveSnapshot) GetTimestampMs() int64

func (ReserveSnapshot) GetUpperMarkPriceFluctuationLimit added in v0.15.0

func (s ReserveSnapshot) GetUpperMarkPriceFluctuationLimit(fluctuationLimitRatio sdk.Dec) sdk.Dec

GetUpperMarkPriceFluctuationLimit returns the maximum limit price based on the fluctuationLimitRatio

func (*ReserveSnapshot) Marshal

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

func (*ReserveSnapshot) MarshalTo

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

func (*ReserveSnapshot) MarshalToSizedBuffer

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

func (*ReserveSnapshot) ProtoMessage

func (*ReserveSnapshot) ProtoMessage()

func (*ReserveSnapshot) Reset

func (m *ReserveSnapshot) Reset()

func (*ReserveSnapshot) Size

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

func (*ReserveSnapshot) String

func (m *ReserveSnapshot) String() string

func (*ReserveSnapshot) Unmarshal

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

func (ReserveSnapshot) Validate added in v0.15.0

func (s ReserveSnapshot) Validate() error

func (*ReserveSnapshot) XXX_DiscardUnknown

func (m *ReserveSnapshot) XXX_DiscardUnknown()

func (*ReserveSnapshot) XXX_Marshal

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

func (*ReserveSnapshot) XXX_Merge

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

func (*ReserveSnapshot) XXX_Size

func (m *ReserveSnapshot) XXX_Size() int

func (*ReserveSnapshot) XXX_Unmarshal

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

type ReserveSnapshotSavedEvent added in v0.5.0

type ReserveSnapshotSavedEvent struct {
	Pair         github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,1,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"`
	QuoteReserve github_com_cosmos_cosmos_sdk_types.Dec            `` /* 137-byte string literal not displayed */
	BaseReserve  github_com_cosmos_cosmos_sdk_types.Dec            `` /* 134-byte string literal not displayed */
	// MarkPrice at the end of the block.
	// (instantaneous) markPrice := quoteReserve / baseReserve
	MarkPrice      github_com_cosmos_cosmos_sdk_types.Dec `` /* 128-byte string literal not displayed */
	BlockHeight    int64                                  `protobuf:"varint,5,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"`
	BlockTimestamp time.Time                              `protobuf:"bytes,6,opt,name=block_timestamp,json=blockTimestamp,proto3,stdtime" json:"block_timestamp"`
}

func (*ReserveSnapshotSavedEvent) Descriptor added in v0.5.0

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

func (*ReserveSnapshotSavedEvent) GetBlockHeight added in v0.15.0

func (m *ReserveSnapshotSavedEvent) GetBlockHeight() int64

func (*ReserveSnapshotSavedEvent) GetBlockTimestamp added in v0.15.0

func (m *ReserveSnapshotSavedEvent) GetBlockTimestamp() time.Time

func (*ReserveSnapshotSavedEvent) Marshal added in v0.5.0

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

func (*ReserveSnapshotSavedEvent) MarshalTo added in v0.5.0

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

func (*ReserveSnapshotSavedEvent) MarshalToSizedBuffer added in v0.5.0

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

func (*ReserveSnapshotSavedEvent) ProtoMessage added in v0.5.0

func (*ReserveSnapshotSavedEvent) ProtoMessage()

func (*ReserveSnapshotSavedEvent) Reset added in v0.5.0

func (m *ReserveSnapshotSavedEvent) Reset()

func (*ReserveSnapshotSavedEvent) Size added in v0.5.0

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

func (*ReserveSnapshotSavedEvent) String added in v0.5.0

func (m *ReserveSnapshotSavedEvent) String() string

func (*ReserveSnapshotSavedEvent) Unmarshal added in v0.5.0

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

func (*ReserveSnapshotSavedEvent) XXX_DiscardUnknown added in v0.5.0

func (m *ReserveSnapshotSavedEvent) XXX_DiscardUnknown()

func (*ReserveSnapshotSavedEvent) XXX_Marshal added in v0.5.0

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

func (*ReserveSnapshotSavedEvent) XXX_Merge added in v0.5.0

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

func (*ReserveSnapshotSavedEvent) XXX_Size added in v0.5.0

func (m *ReserveSnapshotSavedEvent) XXX_Size() int

func (*ReserveSnapshotSavedEvent) XXX_Unmarshal added in v0.5.0

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

type SwapOnVpoolEvent added in v0.16.1

type SwapOnVpoolEvent struct {
	Pair github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,1,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"`
	// delta in the quote reserves of the vpool
	QuoteAmount github_com_cosmos_cosmos_sdk_types.Dec `` /* 134-byte string literal not displayed */
	// delta in the base reserves of the vpool
	BaseAmount github_com_cosmos_cosmos_sdk_types.Dec `` /* 131-byte string literal not displayed */
}

A swap on the vpool represented by 'pair'. Amounts are negative or positive base on the perspective of the pool, i.e. a negative quote means the trader has gained quote and the vpool lost quote.

func (*SwapOnVpoolEvent) Descriptor added in v0.16.1

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

func (*SwapOnVpoolEvent) Marshal added in v0.16.1

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

func (*SwapOnVpoolEvent) MarshalTo added in v0.16.1

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

func (*SwapOnVpoolEvent) MarshalToSizedBuffer added in v0.16.1

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

func (*SwapOnVpoolEvent) ProtoMessage added in v0.16.1

func (*SwapOnVpoolEvent) ProtoMessage()

func (*SwapOnVpoolEvent) Reset added in v0.16.1

func (m *SwapOnVpoolEvent) Reset()

func (*SwapOnVpoolEvent) Size added in v0.16.1

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

func (*SwapOnVpoolEvent) String added in v0.16.1

func (m *SwapOnVpoolEvent) String() string

func (*SwapOnVpoolEvent) Unmarshal added in v0.16.1

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

func (*SwapOnVpoolEvent) XXX_DiscardUnknown added in v0.16.1

func (m *SwapOnVpoolEvent) XXX_DiscardUnknown()

func (*SwapOnVpoolEvent) XXX_Marshal added in v0.16.1

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

func (*SwapOnVpoolEvent) XXX_Merge added in v0.16.1

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

func (*SwapOnVpoolEvent) XXX_Size added in v0.16.1

func (m *SwapOnVpoolEvent) XXX_Size() int

func (*SwapOnVpoolEvent) XXX_Unmarshal added in v0.16.1

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

type TwapCalcOption

type TwapCalcOption int32

Enumerates different options of calculating twap.

const (
	TwapCalcOption_TWAP_CALC_OPTION_UNSPECIFIED TwapCalcOption = 0
	// Spot price from quote asset reserve / base asset reserve
	TwapCalcOption_SPOT TwapCalcOption = 1
	// Swapping with quote assets, output denominated in base assets
	TwapCalcOption_QUOTE_ASSET_SWAP TwapCalcOption = 2
	// Swapping with base assets, output denominated in quote assets
	TwapCalcOption_BASE_ASSET_SWAP TwapCalcOption = 3
)

func (TwapCalcOption) EnumDescriptor

func (TwapCalcOption) EnumDescriptor() ([]byte, []int)

func (TwapCalcOption) String

func (x TwapCalcOption) String() string

type UnimplementedQueryServer added in v0.3.0

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) AllPools added in v0.4.9

func (*UnimplementedQueryServer) BaseAssetPrice added in v0.5.0

func (*UnimplementedQueryServer) ReserveAssets added in v0.3.0

type Vpool added in v0.16.1

type Vpool struct {
	// always BASE:QUOTE, e.g. BTC:NUSD or ETH:NUSD
	Pair github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,1,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"`
	// base asset is the crypto asset, e.g. BTC or ETH
	BaseAssetReserve github_com_cosmos_cosmos_sdk_types.Dec `` /* 151-byte string literal not displayed */
	// quote asset is usually stablecoin, in our case NUSD
	QuoteAssetReserve github_com_cosmos_cosmos_sdk_types.Dec `` /* 154-byte string literal not displayed */
	Config            VpoolConfig                            `protobuf:"bytes,4,opt,name=config,proto3" json:"config"`
}

A virtual pool used only for price discovery of perpetual futures contracts. No real liquidity exists in this pool.

func (*Vpool) AddToBaseAssetReserve added in v0.16.1

func (vpool *Vpool) AddToBaseAssetReserve(amount sdk.Dec)

AddToBaseAssetReserve adds 'amount' to the base asset reserves The 'amount' is not assumed to be positive.

func (*Vpool) AddToQuoteAssetReserve added in v0.16.1

func (vpool *Vpool) AddToQuoteAssetReserve(amount sdk.Dec)

AddToQuoteAssetReserve adds 'amount' to the quote asset reserves The 'amount' is not assumed to be positive.

func (*Vpool) Descriptor added in v0.16.1

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

func (*Vpool) GetBaseAmountByQuoteAmount added in v0.16.1

func (vpool *Vpool) GetBaseAmountByQuoteAmount(
	quoteDelta sdk.Dec,
) (baseOutAbs sdk.Dec, err error)

GetBaseAmountByQuoteAmount returns the amount of base asset you will get out by giving a specified amount of quote asset

args:

  • quoteDelta: the amount of quote asset to add to/remove from the pool. Adding to the quote reserves is synonymous with positive 'quoteDelta'.

ret:

  • baseOutAbs: the amount of base assets required to make this hypothetical swap always an absolute value
  • err: error

func (*Vpool) GetConfig added in v0.16.1

func (m *Vpool) GetConfig() VpoolConfig

func (Vpool) GetMarkPrice added in v0.16.1

func (vpool Vpool) GetMarkPrice() sdk.Dec

GetMarkPrice returns the price of the asset.

func (*Vpool) GetQuoteAmountByBaseAmount added in v0.16.1

func (vpool *Vpool) GetQuoteAmountByBaseAmount(
	baseDelta sdk.Dec,
) (quoteOutAbs sdk.Dec, err error)

GetQuoteAmountByBaseAmount returns the amount of quote asset you will get out by giving a specified amount of base asset

args:

  • dir: add to pool or remove from pool
  • baseAmount: the amount of base asset to add to/remove from the pool

ret:

  • quoteOutAbs: the amount of quote assets required to make this hypothetical swap always an absolute value
  • err: error

func (*Vpool) HasEnoughBaseReserve added in v0.16.1

func (vpool *Vpool) HasEnoughBaseReserve(baseAmount sdk.Dec) bool

HasEnoughBaseReserve returns true if there is enough base reserve based on baseReserve * tradeLimitRatio

func (*Vpool) HasEnoughQuoteReserve added in v0.16.1

func (vpool *Vpool) HasEnoughQuoteReserve(quoteAmount sdk.Dec) bool

HasEnoughQuoteReserve returns true if there is enough quote reserve based on quoteReserve * tradeLimitRatio

func (*Vpool) HasEnoughReservesForTrade added in v0.16.1

func (vpool *Vpool) HasEnoughReservesForTrade(
	quoteAmtAbs sdk.Dec, baseAmtAbs sdk.Dec,
) (err error)

func (Vpool) IsOverFluctuationLimitInRelationWithSnapshot added in v0.16.1

func (vpool Vpool) IsOverFluctuationLimitInRelationWithSnapshot(snapshot ReserveSnapshot) bool

IsOverFluctuationLimitInRelationWithSnapshot compares the updated pool's spot price with the current spot price.

If the fluctuation limit ratio is zero, then the fluctuation limit check is skipped.

args:

  • pool: the updated vpool
  • snapshot: the snapshot to compare against

ret:

  • bool: true if the fluctuation limit is violated. false otherwise

func (Vpool) IsOverSpreadLimit added in v0.16.1

func (vpool Vpool) IsOverSpreadLimit(indexPrice sdk.Dec) bool

IsOverSpreadLimit compares the current mark price of the vpool to the underlying's index price. It panics if you provide it with a pair that doesn't exist in the state.

args:

  • indexPrice: the index price we want to compare.

ret:

  • bool: whether or not the price has deviated from the oracle price beyond a spread ratio

func (*Vpool) Marshal added in v0.16.1

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

func (*Vpool) MarshalTo added in v0.16.1

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

func (*Vpool) MarshalToSizedBuffer added in v0.16.1

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

func (*Vpool) ProtoMessage added in v0.16.1

func (*Vpool) ProtoMessage()

func (*Vpool) Reset added in v0.16.1

func (m *Vpool) Reset()

func (*Vpool) Size added in v0.16.1

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

func (*Vpool) String added in v0.16.1

func (m *Vpool) String() string

func (Vpool) ToSnapshot added in v0.16.1

func (vpool Vpool) ToSnapshot(ctx sdk.Context) ReserveSnapshot

func (*Vpool) Unmarshal added in v0.16.1

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

func (*Vpool) Validate added in v0.16.1

func (vpool *Vpool) Validate() error

func (*Vpool) ValidateReserves added in v0.16.1

func (vpool *Vpool) ValidateReserves() error

ValidateReserves checks that reserves are positive.

func (*Vpool) XXX_DiscardUnknown added in v0.16.1

func (m *Vpool) XXX_DiscardUnknown()

func (*Vpool) XXX_Marshal added in v0.16.1

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

func (*Vpool) XXX_Merge added in v0.16.1

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

func (*Vpool) XXX_Size added in v0.16.1

func (m *Vpool) XXX_Size() int

func (*Vpool) XXX_Unmarshal added in v0.16.1

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

type VpoolConfig added in v0.16.1

type VpoolConfig struct {
	// ratio applied to reserves in order not to over trade
	TradeLimitRatio github_com_cosmos_cosmos_sdk_types.Dec `` /* 148-byte string literal not displayed */
	// percentage that a single open or close position can alter the reserve amounts
	FluctuationLimitRatio github_com_cosmos_cosmos_sdk_types.Dec `` /* 166-byte string literal not displayed */
	// max_oracle_spread_ratio
	MaxOracleSpreadRatio github_com_cosmos_cosmos_sdk_types.Dec `` /* 165-byte string literal not displayed */
	// maintenance_margin_ratio
	MaintenanceMarginRatio github_com_cosmos_cosmos_sdk_types.Dec `` /* 169-byte string literal not displayed */
	// max_leverage
	MaxLeverage github_com_cosmos_cosmos_sdk_types.Dec `` /* 134-byte string literal not displayed */
}

func DefaultVpoolConfig added in v0.19.0

func DefaultVpoolConfig() VpoolConfig

func (*VpoolConfig) Descriptor added in v0.16.1

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

func (*VpoolConfig) Marshal added in v0.16.1

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

func (*VpoolConfig) MarshalTo added in v0.16.1

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

func (*VpoolConfig) MarshalToSizedBuffer added in v0.16.1

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

func (*VpoolConfig) ProtoMessage added in v0.16.1

func (*VpoolConfig) ProtoMessage()

func (*VpoolConfig) Reset added in v0.16.1

func (m *VpoolConfig) Reset()

func (*VpoolConfig) Size added in v0.16.1

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

func (*VpoolConfig) String added in v0.16.1

func (m *VpoolConfig) String() string

func (*VpoolConfig) Unmarshal added in v0.16.1

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

func (*VpoolConfig) Validate added in v0.16.1

func (cfg *VpoolConfig) Validate() error

func (VpoolConfig) WithFluctuationLimitRatio added in v0.19.0

func (poolCfg VpoolConfig) WithFluctuationLimitRatio(value sdk.Dec) VpoolConfig

func (VpoolConfig) WithMaintenanceMarginRatio added in v0.19.0

func (poolCfg VpoolConfig) WithMaintenanceMarginRatio(value sdk.Dec) VpoolConfig

func (VpoolConfig) WithMaxLeverage added in v0.19.0

func (poolCfg VpoolConfig) WithMaxLeverage(value sdk.Dec) VpoolConfig

func (VpoolConfig) WithMaxOracleSpreadRatio added in v0.19.0

func (poolCfg VpoolConfig) WithMaxOracleSpreadRatio(value sdk.Dec) VpoolConfig

func (VpoolConfig) WithTradeLimitRatio added in v0.19.0

func (poolCfg VpoolConfig) WithTradeLimitRatio(value sdk.Dec) VpoolConfig

func (*VpoolConfig) XXX_DiscardUnknown added in v0.16.1

func (m *VpoolConfig) XXX_DiscardUnknown()

func (*VpoolConfig) XXX_Marshal added in v0.16.1

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

func (*VpoolConfig) XXX_Merge added in v0.16.1

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

func (*VpoolConfig) XXX_Size added in v0.16.1

func (m *VpoolConfig) XXX_Size() int

func (*VpoolConfig) XXX_Unmarshal added in v0.16.1

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

Jump to

Keyboard shortcuts

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