types

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: AGPL-3.0 Imports: 34 Imported by: 0

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	DefaultOpenInterest = 0
	// Clamp factor for 8-hour funding rate is by default 600%.
	DefaultFundingRateClampFactorPpm = 6 * lib.OneMillion
	// Clamp factor for premium vote is by default 6_000%.
	DefaultPremiumVoteClampFactorPpm = 60 * lib.OneMillion
	// Minimum number of votes per sample is by default 15.
	DefaultMinNumVotesPerSample = 15

	MaxDefaultFundingPpmAbs   = lib.OneMillion
	MaxInitialMarginPpm       = lib.OneMillion
	MaxMaintenanceFractionPpm = lib.OneMillion
)
View Source
const (
	// PerpetualKeyPrefix is the prefix to retrieve all Perpetual
	PerpetualKeyPrefix = "Perpetual/value/"
	// PerpetualKeyPrefix is the prefix to retrieve all funding premium samples
	FundingSamplesKeyPrefix = "Perpetual/funding/"
	// FundingRateClampFactorKey is the key to retrieve funding rate clamp factor
	// in parts-per-million
	// |R| <= clamp_factor * (initial margin - maintenance margin)
	FundingRateClampFactorPpmKey = "Perpetual/funding_rate_clamp_factor_ppm"
	// PremiumVoteClampFactorPpmKey is the key to retrieve premium vote clamp factor
	// in parts-per-million
	// |V| <= clamp_factor * (initial margin - maintenance margin)
	PremiumVoteClampFactorPpmKey = "Perpetual/premium_vote_clamp_factor_ppm"
	// PremiumVotesKey is the key to retrieve `PremiumStore` object
	// that represents existing premium sample votes during the current
	// `funding-sample` epoch.
	PremiumVotesKey = "Perpetual/premium_sample_votes"
	// PremiumSamplesKey is the key to retrieve `PremiumStore` object
	// that represents existing premium samples during the current
	// `funding-tick` epoch.
	PremiumSamplesKey = "Perpetual/premium_samples"
	// MinNumVotesPerSampleKey is the key to retrieve `min_num_votes_per_sample`,
	// the minimum number of votes needed to calculate a premium sample.
	MinNumVotesPerSampleKey = "Perpetual/min_num_votes_per_sample"
	// LiquidityTierKeyPrefix is the prefix to retrieve all `LiquidityTier`s.
	LiquidityTierKeyPrefix = "Perpetual/liquidity_tier/"
	// NumLiquidityTiersKey is the prefix to retrieve the cardinality of `LiquidityTier`s.
	NumLiquidityTiersKey = "Perpetual/liquidity_tier/num"
)
View Source
const (
	// ModuleName defines the module name
	ModuleName = "perpetuals"

	// StoreKey defines the primary module store key
	StoreKey = ModuleName
)
View Source
const (
	// RemovedTailSampleRatioPpm is the percentage (in ppm) of funding samples to be removed on each
	// end of the sorted funding samples collected during a funding-tick epoch.
	// For example, if 60 funding sample entries were collected during an epoch,
	// `RemovedTailSamplePctPpm` of the top and bottom funding sample values are removed before
	// taking the average.
	// TODO(DEC-1105): Move this constant to state so that it can be changed via governance.
	RemovedTailSampleRatioPpm uint32 = 0
)

Variables

View Source
var (
	ErrPerpetualDoesNotExist = sdkerrors.Register(
		ModuleName,
		1,
		"Perpetual does not exist",
	)
	ErrMarketDoesNotExist = sdkerrors.Register(
		ModuleName,
		2,
		"MarketId on perpetual does not exist",
	)
	ErrInitialMarginPpmExceedsMax = sdkerrors.Register(
		ModuleName,
		3,
		"InitialMarginPpm exceeds maximum value of 1e6",
	)
	ErrMaintenanceFractionPpmExceedsMax = sdkerrors.Register(
		ModuleName,
		4,
		"MaintenanceFractionPpm exceeds maximum value of 1e6",
	)
	ErrDefaultFundingPpmMagnitudeExceedsMax = sdkerrors.Register(
		ModuleName,
		5,
		"DefaultFundingPpm magnitude exceeds maximum value of 1e6",
	)
	ErrTickerEmptyString = sdkerrors.Register(
		ModuleName,
		6,
		"Ticker must be non-empty string",
	)
	ErrNoNewPremiumVotes = sdkerrors.Register(
		ModuleName,
		7,
		"No new premium votes were collected",
	)
	ErrMoreFundingSamplesThanExpected = sdkerrors.Register(
		ModuleName,
		8,
		"Recorded more than expected funding samples in the past funding-tick epoch",
	)
	ErrInvalidAddPremiumVotes = sdkerrors.Register(ModuleName, 9, "MsgAddPremiumVotes is invalid")
	ErrPremiumVoteNotClamped  = sdkerrors.Register(
		ModuleName,
		10,
		"Premium vote value is not clamped by MaxAbsPremiumVotePpm",
	)
	ErrFundingRateInt32Overflow = sdkerrors.Register(
		ModuleName,
		11,
		"Funding rate int32 overflow",
	)
	ErrLiquidityTierDoesNotExist = sdkerrors.Register(
		ModuleName,
		12,
		"Liquidity Tier does not exist",
	)
	ErrBasePositionNotionalIsZero = sdkerrors.Register(
		ModuleName,
		13,
		"Base position notional is zero",
	)
	ErrFundingRateClampFactorPpmIsZero = sdkerrors.Register(
		ModuleName,
		14,
		"Funding rate clamp factor ppm is zero",
	)
	ErrPremiumVoteClampFactorPpmIsZero = sdkerrors.Register(
		ModuleName,
		15,
		"Premium vote clamp factor ppm is zero",
	)
	ErrImpactNotionalIsZero = sdkerrors.Register(
		ModuleName,
		16,
		"Impact notional is zero",
	)
	ErrPerpetualAlreadyExists = sdkerrors.Register(
		ModuleName,
		17,
		"Perpetual already exists",
	)
	ErrPremiumVoteForNonActiveMarket = sdkerrors.Register(
		ModuleName,
		18,
		"Premium votes are disallowed for non active markets",
	)

	// Errors for Not Implemented
	ErrNotImplementedFunding      = sdkerrors.Register(ModuleName, 1001, "Not Implemented: Perpetuals Funding")
	ErrNotImplementedOpenInterest = sdkerrors.Register(ModuleName, 1002, "Not Implemented: Perpetuals Open Interest")
)

x/perpetuals module sentinel errors

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 (
	ErrInvalidLengthParams        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowParams          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthPerpetual        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowPerpetual          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupPerpetual = 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 (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)

Functions

func KeyPrefix

func KeyPrefix(p string) []byte

func LiquidityTierKey

func LiquidityTierKey(
	id uint32,
) []byte

LiquidityTierKey returns the store key to retrieve a LiquidityTier by its id.

func PerpetualKey

func PerpetualKey(
	id uint32,
) []byte

PerpetualKey returns the store key to retrieve a Perpetual by its id.

func RegisterCodec

func RegisterCodec(cdc *codec.LegacyAmino)

func RegisterInterfaces

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

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

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

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

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 to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

func TempBigImpactNotionalAmount

func TempBigImpactNotionalAmount() *big.Int

TempBigImpactNotionalAmount is a temporary function that returns 5_000 USDC as the impact notional amount. TODO(DEC-1308): Remove this.

func ValidateFundingRateClampFactorPpm

func ValidateFundingRateClampFactorPpm(num uint32) error

ValidateFundingRateClampFactorPpm validates that `fundingRateClampFactorPpm` is not zero.

func ValidatePremiumVoteClampFactorPpm

func ValidatePremiumVoteClampFactorPpm(num uint32) error

ValidatePremiumVoteClampFactorPpm validates that `premiumVoteClampFactorPpm` is not zero.

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI
}

AccountKeeper defines the expected account keeper used for simulations.

type BankKeeper

type BankKeeper interface {
	SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
}

BankKeeper defines the expected bank keeper used for simulations.

type EpochsKeeper

type EpochsKeeper interface {
	NumBlocksSinceEpochStart(
		ctx sdk.Context,
		id epochstypes.EpochInfoName,
	) (uint32, error)
	MustGetFundingTickEpochInfo(
		ctx sdk.Context,
	) epochstypes.EpochInfo
	MustGetFundingSampleEpochInfo(
		ctx sdk.Context,
	) epochstypes.EpochInfo
}

EpochsKeeper defines the expected epochs keeper to get epoch info.

type FundingPremium

type FundingPremium struct {
	// The id of the perpetual market.
	PerpetualId uint32 `protobuf:"varint,1,opt,name=perpetual_id,json=perpetualId,proto3" json:"perpetual_id,omitempty"`
	// The sampled premium rate. In parts-per-million.
	PremiumPpm int32 `protobuf:"varint,2,opt,name=premium_ppm,json=premiumPpm,proto3" json:"premium_ppm,omitempty"`
}

FundingPremium represents a funding premium value for a perpetual market. Can be used to represent a premium vote or a premium sample.

func NewFundingPremium

func NewFundingPremium(id uint32, premiumPpm int32) *FundingPremium

func (*FundingPremium) Descriptor

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

func (*FundingPremium) GetPerpetualId

func (m *FundingPremium) GetPerpetualId() uint32

func (*FundingPremium) GetPremiumPpm

func (m *FundingPremium) GetPremiumPpm() int32

func (*FundingPremium) Marshal

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

func (*FundingPremium) MarshalTo

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

func (*FundingPremium) MarshalToSizedBuffer

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

func (*FundingPremium) ProtoMessage

func (*FundingPremium) ProtoMessage()

func (*FundingPremium) Reset

func (m *FundingPremium) Reset()

func (*FundingPremium) Size

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

func (*FundingPremium) String

func (m *FundingPremium) String() string

func (*FundingPremium) Unmarshal

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

func (*FundingPremium) XXX_DiscardUnknown

func (m *FundingPremium) XXX_DiscardUnknown()

func (*FundingPremium) XXX_Marshal

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

func (*FundingPremium) XXX_Merge

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

func (*FundingPremium) XXX_Size

func (m *FundingPremium) XXX_Size() int

func (*FundingPremium) XXX_Unmarshal

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

type GenesisState

type GenesisState struct {
	Perpetuals     []Perpetual     `protobuf:"bytes,1,rep,name=perpetuals,proto3" json:"perpetuals"`
	LiquidityTiers []LiquidityTier `protobuf:"bytes,2,rep,name=liquidity_tiers,json=liquidityTiers,proto3" json:"liquidity_tiers"`
	Params         Params          `protobuf:"bytes,3,opt,name=params,proto3" json:"params"`
}

GenesisState defines the perpetuals module's genesis state.

func DefaultGenesis

func DefaultGenesis() *GenesisState

DefaultGenesis returns the default Perpetual genesis state

func (*GenesisState) Descriptor

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

func (*GenesisState) GetLiquidityTiers

func (m *GenesisState) GetLiquidityTiers() []LiquidityTier

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) GetPerpetuals

func (m *GenesisState) GetPerpetuals() []Perpetual

func (*GenesisState) Marshal

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

func (*GenesisState) MarshalTo

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

func (*GenesisState) MarshalToSizedBuffer

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

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

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

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

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

func (GenesisState) Validate

func (gs GenesisState) Validate() error

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

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

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

func (*GenesisState) XXX_Merge

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

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

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

type GetPricePremiumParams

type GetPricePremiumParams struct {
	MarketPrice                 pricestypes.MarketPrice
	BaseAtomicResolution        int32
	QuoteAtomicResolution       int32
	ImpactNotionalQuoteQuantums *big.Int
	MaxAbsPremiumVotePpm        *big.Int
}

GetPricePremiumParams includes the parameters used by `ClobKeeper.GetPricePremiumForPerpetual` and `MemClob.GetPricePremium` to get the price premium.

type LiquidityTier

type LiquidityTier struct {
	// Unique id.
	Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// The name of the tier purely for mnemonic purposes, e.g. "Gold".
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// The margin fraction needed to open a position.
	// In parts-per-million.
	InitialMarginPpm uint32 `protobuf:"varint,3,opt,name=initial_margin_ppm,json=initialMarginPpm,proto3" json:"initial_margin_ppm,omitempty"`
	// The fraction of the initial-margin that the maintenance-margin is,
	// e.g. 50%. In parts-per-million.
	MaintenanceFractionPpm uint32 `` /* 130-byte string literal not displayed */
	// The maximum position size at which the margin requirements are
	// not increased over the default values. Above this position size,
	// the margin requirements increase at a rate of sqrt(size).
	BasePositionNotional uint64 `protobuf:"varint,5,opt,name=base_position_notional,json=basePositionNotional,proto3" json:"base_position_notional,omitempty"`
	// The impact notional amount (in quote quantums) is used to determine impact
	// bid/ask prices and its recommended value is 500 USDC / initial margin
	// fraction.
	// - Impact bid price = average execution price for a market sell of the
	// impact notional value.
	// - Impact ask price = average execution price for a market buy of the
	// impact notional value.
	ImpactNotional uint64 `protobuf:"varint,6,opt,name=impact_notional,json=impactNotional,proto3" json:"impact_notional,omitempty"`
}

LiquidityTier stores margin information.

func (*LiquidityTier) Descriptor

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

func (LiquidityTier) GetAdjustedInitialMarginQuoteQuantums

func (liquidityTier LiquidityTier) GetAdjustedInitialMarginQuoteQuantums(bigQuoteQuantums *big.Int) *big.Int

GetAdjustedInitialMarginQuoteQuantums returns adjusted initial margin in quote quantums (capped at 100% of notional).

marginQuoteQuantums = adjustedMarginPpm * quoteQuantums / 1_000_000 = min(1_000_000, marginAdjustmentPpm * marginPpm / 1_000_000) * quoteQuantums / 1_000_000 = min(quoteQuantums, marginPpm * quoteQuantums * marginAdjustmentPpm / 1_000_000 / 1_000_000)

note: divisions are delayed for precision purposes.

func (*LiquidityTier) GetBasePositionNotional

func (m *LiquidityTier) GetBasePositionNotional() uint64

func (*LiquidityTier) GetId

func (m *LiquidityTier) GetId() uint32

func (*LiquidityTier) GetImpactNotional

func (m *LiquidityTier) GetImpactNotional() uint64

func (*LiquidityTier) GetInitialMarginPpm

func (m *LiquidityTier) GetInitialMarginPpm() uint32

func (*LiquidityTier) GetMaintenanceFractionPpm

func (m *LiquidityTier) GetMaintenanceFractionPpm() uint32

func (LiquidityTier) GetMaintenanceMarginPpm

func (liquidityTier LiquidityTier) GetMaintenanceMarginPpm() uint32

`GetMaintenanceMarginPpm` calculates maintenance margin ppm based on initial margin ppm and maintenance fraction ppm.

func (LiquidityTier) GetMarginAdjustmentPpm

func (liquidityTier LiquidityTier) GetMarginAdjustmentPpm(bigQuoteQuantums *big.Int) *big.Int

GetMarginAdjustmentPpm calculates margin adjustment (in ppm) given quote quantums and `liquidityTier`'s base position notional.

The idea is to have margin requirement increase as amount of notional increases. Adjustment is `1` for any position smaller than `basePositionNotional` and sqrt of position size for larger positions. Formula for marginAdjustmentPpm is:

marginAdjustmentPpm = max(

oneMillion,
sqrt(
	quoteQuantums * (oneMillion * oneMillion) / basePositionNotional
)

)

func (LiquidityTier) GetMaxAbsFundingClampPpm

func (liquidityTier LiquidityTier) GetMaxAbsFundingClampPpm(clampFactorPpm uint32) *big.Int

`GetMaxAbsFundingClampPpm` returns the maximum absolute value according to the funding clamp function: `|S| ≤ Clamp Factor * (Initial Margin - Maintenance Margin)`, which can be applied to both funding rate clamping and premium vote clamping, each having their own clamp factor.

func (*LiquidityTier) GetName

func (m *LiquidityTier) GetName() string

func (*LiquidityTier) Marshal

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

func (*LiquidityTier) MarshalTo

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

func (*LiquidityTier) MarshalToSizedBuffer

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

func (*LiquidityTier) ProtoMessage

func (*LiquidityTier) ProtoMessage()

func (*LiquidityTier) Reset

func (m *LiquidityTier) Reset()

func (*LiquidityTier) Size

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

func (*LiquidityTier) String

func (m *LiquidityTier) String() string

func (*LiquidityTier) Unmarshal

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

func (LiquidityTier) Validate

func (liquidityTier LiquidityTier) Validate() error

- Initial margin is less than or equal to 1. - Maintenance fraction is less than or equal to 1. - Base position notional is not 0.

func (*LiquidityTier) XXX_DiscardUnknown

func (m *LiquidityTier) XXX_DiscardUnknown()

func (*LiquidityTier) XXX_Marshal

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

func (*LiquidityTier) XXX_Merge

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

func (*LiquidityTier) XXX_Size

func (m *LiquidityTier) XXX_Size() int

func (*LiquidityTier) XXX_Unmarshal

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

type MarketPremiums

type MarketPremiums struct {
	// perpetual_id is the Id of the perpetual market.
	PerpetualId uint32 `protobuf:"varint,1,opt,name=perpetual_id,json=perpetualId,proto3" json:"perpetual_id,omitempty"`
	// premiums is a list of premium values for a perpetual market. Since most
	// premiums are zeros under "stable" market conditions, only non-zero values
	// are stored in this list.
	Premiums []int32 `protobuf:"zigzag32,2,rep,packed,name=premiums,proto3" json:"premiums,omitempty"`
}

MarketPremiums stores a list of premiums for a single perpetual market.

func (*MarketPremiums) Descriptor

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

func (*MarketPremiums) GetPerpetualId

func (m *MarketPremiums) GetPerpetualId() uint32

func (*MarketPremiums) GetPremiums

func (m *MarketPremiums) GetPremiums() []int32

func (*MarketPremiums) Marshal

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

func (*MarketPremiums) MarshalTo

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

func (*MarketPremiums) MarshalToSizedBuffer

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

func (*MarketPremiums) ProtoMessage

func (*MarketPremiums) ProtoMessage()

func (*MarketPremiums) Reset

func (m *MarketPremiums) Reset()

func (*MarketPremiums) Size

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

func (*MarketPremiums) String

func (m *MarketPremiums) String() string

func (*MarketPremiums) Unmarshal

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

func (*MarketPremiums) XXX_DiscardUnknown

func (m *MarketPremiums) XXX_DiscardUnknown()

func (*MarketPremiums) XXX_Marshal

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

func (*MarketPremiums) XXX_Merge

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

func (*MarketPremiums) XXX_Size

func (m *MarketPremiums) XXX_Size() int

func (*MarketPremiums) XXX_Unmarshal

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

type MsgAddPremiumVotes

type MsgAddPremiumVotes struct {
	Votes []FundingPremium `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes"`
}

MsgAddPremiumVotes is a request type for the AddPremiumVotes method.

func NewMsgAddPremiumVotes

func NewMsgAddPremiumVotes(votes []FundingPremium) *MsgAddPremiumVotes

func (*MsgAddPremiumVotes) Descriptor

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

func (*MsgAddPremiumVotes) GetSigners

func (msg *MsgAddPremiumVotes) GetSigners() []sdk.AccAddress

func (*MsgAddPremiumVotes) GetVotes

func (m *MsgAddPremiumVotes) GetVotes() []FundingPremium

func (*MsgAddPremiumVotes) Marshal

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

func (*MsgAddPremiumVotes) MarshalTo

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

func (*MsgAddPremiumVotes) MarshalToSizedBuffer

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

func (*MsgAddPremiumVotes) ProtoMessage

func (*MsgAddPremiumVotes) ProtoMessage()

func (*MsgAddPremiumVotes) Reset

func (m *MsgAddPremiumVotes) Reset()

func (*MsgAddPremiumVotes) Size

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

func (*MsgAddPremiumVotes) String

func (m *MsgAddPremiumVotes) String() string

func (*MsgAddPremiumVotes) Unmarshal

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

func (*MsgAddPremiumVotes) ValidateBasic

func (msg *MsgAddPremiumVotes) ValidateBasic() error

func (*MsgAddPremiumVotes) XXX_DiscardUnknown

func (m *MsgAddPremiumVotes) XXX_DiscardUnknown()

func (*MsgAddPremiumVotes) XXX_Marshal

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

func (*MsgAddPremiumVotes) XXX_Merge

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

func (*MsgAddPremiumVotes) XXX_Size

func (m *MsgAddPremiumVotes) XXX_Size() int

func (*MsgAddPremiumVotes) XXX_Unmarshal

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

type MsgAddPremiumVotesResponse

type MsgAddPremiumVotesResponse struct {
}

MsgAddPremiumVotesResponse defines the AddPremiumVotes response type.

func (*MsgAddPremiumVotesResponse) Descriptor

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

func (*MsgAddPremiumVotesResponse) Marshal

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

func (*MsgAddPremiumVotesResponse) MarshalTo

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

func (*MsgAddPremiumVotesResponse) MarshalToSizedBuffer

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

func (*MsgAddPremiumVotesResponse) ProtoMessage

func (*MsgAddPremiumVotesResponse) ProtoMessage()

func (*MsgAddPremiumVotesResponse) Reset

func (m *MsgAddPremiumVotesResponse) Reset()

func (*MsgAddPremiumVotesResponse) Size

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

func (*MsgAddPremiumVotesResponse) String

func (m *MsgAddPremiumVotesResponse) String() string

func (*MsgAddPremiumVotesResponse) Unmarshal

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

func (*MsgAddPremiumVotesResponse) XXX_DiscardUnknown

func (m *MsgAddPremiumVotesResponse) XXX_DiscardUnknown()

func (*MsgAddPremiumVotesResponse) XXX_Marshal

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

func (*MsgAddPremiumVotesResponse) XXX_Merge

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

func (*MsgAddPremiumVotesResponse) XXX_Size

func (m *MsgAddPremiumVotesResponse) XXX_Size() int

func (*MsgAddPremiumVotesResponse) XXX_Unmarshal

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

type MsgClient

type MsgClient interface {
	// AddPremiumVotes add new samples of the funding premiums to the
	// application.
	AddPremiumVotes(ctx context.Context, in *MsgAddPremiumVotes, opts ...grpc.CallOption) (*MsgAddPremiumVotesResponse, error)
	// CreatePerpetual creates a new perpetual object.
	CreatePerpetual(ctx context.Context, in *MsgCreatePerpetual, opts ...grpc.CallOption) (*MsgCreatePerpetualResponse, error)
}

MsgClient is the client API for Msg service.

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

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgCreatePerpetual

type MsgCreatePerpetual struct {
	// The address that controls the module.
	Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
	// `params` defines parameters for the new perpetual market.
	Params PerpetualParams `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
}

MsgCreatePerpetual is a message used by x/gov to create a new perpetual.

func (*MsgCreatePerpetual) Descriptor

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

func (*MsgCreatePerpetual) GetAuthority

func (m *MsgCreatePerpetual) GetAuthority() string

func (*MsgCreatePerpetual) GetParams

func (m *MsgCreatePerpetual) GetParams() PerpetualParams

func (*MsgCreatePerpetual) GetSigners

func (msg *MsgCreatePerpetual) GetSigners() []sdk.AccAddress

func (*MsgCreatePerpetual) Marshal

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

func (*MsgCreatePerpetual) MarshalTo

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

func (*MsgCreatePerpetual) MarshalToSizedBuffer

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

func (*MsgCreatePerpetual) ProtoMessage

func (*MsgCreatePerpetual) ProtoMessage()

func (*MsgCreatePerpetual) Reset

func (m *MsgCreatePerpetual) Reset()

func (*MsgCreatePerpetual) Size

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

func (*MsgCreatePerpetual) String

func (m *MsgCreatePerpetual) String() string

func (*MsgCreatePerpetual) Unmarshal

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

func (*MsgCreatePerpetual) ValidateBasic

func (msg *MsgCreatePerpetual) ValidateBasic() error

func (*MsgCreatePerpetual) XXX_DiscardUnknown

func (m *MsgCreatePerpetual) XXX_DiscardUnknown()

func (*MsgCreatePerpetual) XXX_Marshal

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

func (*MsgCreatePerpetual) XXX_Merge

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

func (*MsgCreatePerpetual) XXX_Size

func (m *MsgCreatePerpetual) XXX_Size() int

func (*MsgCreatePerpetual) XXX_Unmarshal

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

type MsgCreatePerpetualResponse

type MsgCreatePerpetualResponse struct {
}

MsgCreatePerpetualResponse defines the CreatePerpetual response type.

func (*MsgCreatePerpetualResponse) Descriptor

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

func (*MsgCreatePerpetualResponse) Marshal

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

func (*MsgCreatePerpetualResponse) MarshalTo

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

func (*MsgCreatePerpetualResponse) MarshalToSizedBuffer

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

func (*MsgCreatePerpetualResponse) ProtoMessage

func (*MsgCreatePerpetualResponse) ProtoMessage()

func (*MsgCreatePerpetualResponse) Reset

func (m *MsgCreatePerpetualResponse) Reset()

func (*MsgCreatePerpetualResponse) Size

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

func (*MsgCreatePerpetualResponse) String

func (m *MsgCreatePerpetualResponse) String() string

func (*MsgCreatePerpetualResponse) Unmarshal

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

func (*MsgCreatePerpetualResponse) XXX_DiscardUnknown

func (m *MsgCreatePerpetualResponse) XXX_DiscardUnknown()

func (*MsgCreatePerpetualResponse) XXX_Marshal

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

func (*MsgCreatePerpetualResponse) XXX_Merge

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

func (*MsgCreatePerpetualResponse) XXX_Size

func (m *MsgCreatePerpetualResponse) XXX_Size() int

func (*MsgCreatePerpetualResponse) XXX_Unmarshal

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

type MsgServer

type MsgServer interface {
	// AddPremiumVotes add new samples of the funding premiums to the
	// application.
	AddPremiumVotes(context.Context, *MsgAddPremiumVotes) (*MsgAddPremiumVotesResponse, error)
	// CreatePerpetual creates a new perpetual object.
	CreatePerpetual(context.Context, *MsgCreatePerpetual) (*MsgCreatePerpetualResponse, error)
}

MsgServer is the server API for Msg service.

type Params

type Params struct {
	// Funding rate clamp factor in parts-per-million, used for clamping 8-hour
	// funding rates according to equation: |R| <= funding_rate_clamp_factor *
	// (initial margin - maintenance margin).
	FundingRateClampFactorPpm uint32 `` /* 143-byte string literal not displayed */
	// Premium vote clamp factor in parts-per-million, used for clamping premium
	// votes according to equation: |V| <= premium_vote_clamp_factor *
	// (initial margin - maintenance margin).
	PremiumVoteClampFactorPpm uint32 `` /* 143-byte string literal not displayed */
	// Minimum number of premium votes per premium sample. If number of premium
	// votes is smaller than this number, pad with zeros up to this number.
	MinNumVotesPerSample uint32 `` /* 128-byte string literal not displayed */
}

Params defines the parameters for x/perpetuals module.

func (*Params) Descriptor

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

func (*Params) GetFundingRateClampFactorPpm

func (m *Params) GetFundingRateClampFactorPpm() uint32

func (*Params) GetMinNumVotesPerSample

func (m *Params) GetMinNumVotesPerSample() uint32

func (*Params) GetPremiumVoteClampFactorPpm

func (m *Params) GetPremiumVoteClampFactorPpm() uint32

func (*Params) Marshal

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

func (*Params) MarshalTo

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

func (*Params) MarshalToSizedBuffer

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

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

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

func (*Params) String

func (m *Params) String() string

func (*Params) Unmarshal

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

func (Params) Validate

func (params Params) Validate() error

Validate validates perpetual module's parameters.

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

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

func (*Params) XXX_Merge

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

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

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

type Perpetual

type Perpetual struct {
	// PerpetualParams is the parameters of the perpetual.
	Params PerpetualParams `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
	// The current index determined by the cumulative all-time
	// history of the funding mechanism. Starts at zero.
	FundingIndex github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `` /* 163-byte string literal not displayed */
	// The total open-interest of the perpetual used for
	// bookkeeping purposes. In base quantums.
	OpenInterest uint64 `protobuf:"varint,3,opt,name=open_interest,json=openInterest,proto3" json:"open_interest,omitempty"`
}

Perpetual represents a perpetual on the dYdX exchange.

func (*Perpetual) Descriptor

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

func (*Perpetual) GetId

func (m *Perpetual) GetId() uint32

func (*Perpetual) GetOpenInterest

func (m *Perpetual) GetOpenInterest() uint64

func (*Perpetual) GetParams

func (m *Perpetual) GetParams() PerpetualParams

func (*Perpetual) Marshal

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

func (*Perpetual) MarshalTo

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

func (*Perpetual) MarshalToSizedBuffer

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

func (*Perpetual) ProtoMessage

func (*Perpetual) ProtoMessage()

func (*Perpetual) Reset

func (m *Perpetual) Reset()

func (*Perpetual) Size

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

func (*Perpetual) String

func (m *Perpetual) String() string

func (*Perpetual) Unmarshal

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

func (*Perpetual) XXX_DiscardUnknown

func (m *Perpetual) XXX_DiscardUnknown()

func (*Perpetual) XXX_Marshal

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

func (*Perpetual) XXX_Merge

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

func (*Perpetual) XXX_Size

func (m *Perpetual) XXX_Size() int

func (*Perpetual) XXX_Unmarshal

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

type PerpetualParams

type PerpetualParams struct {
	// Unique, sequentially-generated.
	Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// The name of the `Perpetual` (e.g. `BTC-USD`).
	Ticker string `protobuf:"bytes,2,opt,name=ticker,proto3" json:"ticker,omitempty"`
	// The market associated with this `Perpetual`. It
	// acts as the oracle price for the purposes of calculating
	// collateral, margin requirements, and funding rates.
	MarketId uint32 `protobuf:"varint,3,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"`
	// The exponent for converting an atomic amount (`size = 1`)
	// to a full coin. For example, if `AtomicResolution = -8`
	// then a `PerpetualPosition` with `size = 1e8` is equivalent to
	// a position size of one full coin.
	AtomicResolution int32 `protobuf:"zigzag32,4,opt,name=atomic_resolution,json=atomicResolution,proto3" json:"atomic_resolution,omitempty"`
	// The default funding payment if there is no price premium. In
	// parts-per-million.
	DefaultFundingPpm int32 `protobuf:"zigzag32,5,opt,name=default_funding_ppm,json=defaultFundingPpm,proto3" json:"default_funding_ppm,omitempty"`
	// The liquidity_tier that this perpetual is associated with.
	LiquidityTier uint32 `protobuf:"varint,6,opt,name=liquidity_tier,json=liquidityTier,proto3" json:"liquidity_tier,omitempty"`
}

PerpetualParams represents the parameters of a perpetual on the dYdX exchange.

func (*PerpetualParams) Descriptor

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

func (*PerpetualParams) GetAtomicResolution

func (m *PerpetualParams) GetAtomicResolution() int32

func (*PerpetualParams) GetDefaultFundingPpm

func (m *PerpetualParams) GetDefaultFundingPpm() int32

func (*PerpetualParams) GetId

func (m *PerpetualParams) GetId() uint32

func (*PerpetualParams) GetLiquidityTier

func (m *PerpetualParams) GetLiquidityTier() uint32

func (*PerpetualParams) GetMarketId

func (m *PerpetualParams) GetMarketId() uint32

func (*PerpetualParams) GetTicker

func (m *PerpetualParams) GetTicker() string

func (*PerpetualParams) Marshal

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

func (*PerpetualParams) MarshalTo

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

func (*PerpetualParams) MarshalToSizedBuffer

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

func (*PerpetualParams) ProtoMessage

func (*PerpetualParams) ProtoMessage()

func (*PerpetualParams) Reset

func (m *PerpetualParams) Reset()

func (*PerpetualParams) Size

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

func (*PerpetualParams) String

func (m *PerpetualParams) String() string

func (*PerpetualParams) Unmarshal

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

func (*PerpetualParams) XXX_DiscardUnknown

func (m *PerpetualParams) XXX_DiscardUnknown()

func (*PerpetualParams) XXX_Marshal

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

func (*PerpetualParams) XXX_Merge

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

func (*PerpetualParams) XXX_Size

func (m *PerpetualParams) XXX_Size() int

func (*PerpetualParams) XXX_Unmarshal

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

type PerpetualsClobKeeper

type PerpetualsClobKeeper interface {
	GetPricePremiumForPerpetual(
		ctx sdk.Context,
		perpetualId uint32,
		params GetPricePremiumParams,
	) (
		premiumPpm int32,
		err error,
	)
	IsPerpetualClobPairActive(
		ctx sdk.Context,
		perpetualId uint32,
	) (
		isActive bool,
		err error,
	)
}

PerpetualsClobKeeper defines the expected interface for the clob keeper.

type PerpetualsKeeper

type PerpetualsKeeper interface {
	MaybeProcessNewFundingTickEpoch(ctx sdk.Context)
	MaybeProcessNewFundingSampleEpoch(ctx sdk.Context)
	AddPremiumVotes(ctx sdk.Context, votes []FundingPremium) error
	GetNetNotional(
		ctx sdk.Context,
		id uint32,
		bigQuantums *big.Int,
	) (
		bigNetNotionalQuoteQuantums *big.Int,
		err error,
	)
	GetNotionalInBaseQuantums(
		ctx sdk.Context,
		id uint32,
		bigQuoteQuantums *big.Int,
	) (
		bigBaseQuantums *big.Int,
		err error,
	)
	GetNetCollateral(
		ctx sdk.Context,
		id uint32,
		bigQuantums *big.Int,
	) (
		bigNetCollateralQuoteQuantums *big.Int,
		err error,
	)
	GetMarginRequirements(
		ctx sdk.Context,
		id uint32,
		bigQuantums *big.Int,
	) (
		bigInitialMarginQuoteQuantums *big.Int,
		bigMaintenanceMarginQuoteQuantums *big.Int,
		err error,
	)
	GetAddPremiumVotes(
		ctx sdk.Context,
	) (
		msgAddPremiumVotes *MsgAddPremiumVotes,
	)
	PerformStatefulPremiumVotesValidation(
		ctx sdk.Context,
		msg *MsgAddPremiumVotes,
	) (
		err error,
	)
}

Interface used by ABCI calls to access the perpetuals keeper.

type PremiumStore

type PremiumStore struct {
	// all_market_premiums a list of `MarketPremiums`, each corresponding to
	// a perpetual market.
	AllMarketPremiums []MarketPremiums `protobuf:"bytes,1,rep,name=all_market_premiums,json=allMarketPremiums,proto3" json:"all_market_premiums"`
	// number of rounds where premium values were added. This value indicates
	// the total number of premiums (zeros and non-zeros) for each
	// `MarketPremiums` struct. Note that in the edge case a perpetual market was
	// added in the middle of a epoch, we don't keep a seperate count for that
	// market. This means we treat this market as having zero premiums before it
	// was added.
	NumPremiums uint32 `protobuf:"varint,2,opt,name=num_premiums,json=numPremiums,proto3" json:"num_premiums,omitempty"`
}

PremiumStore is a struct to store a perpetual premiums for all perpetual markets. It stores a list of `MarketPremiums`, each of which corresponds to a perpetual market and stores a list of non-zero premium values for that market. This struct can either be used to store `PremiumVotes` or `PremiumSamples`.

func NewPremiumStoreFromMarketPremiumMap

func NewPremiumStoreFromMarketPremiumMap(
	m map[uint32]MarketPremiums,
	numPremiums uint32,
) *PremiumStore

NewPremiumStoreFromMarketPremiumMap returns a new `PremiumStore` struct from a MarketPremiumMap.

func (*PremiumStore) Descriptor

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

func (*PremiumStore) GetAllMarketPremiums

func (m *PremiumStore) GetAllMarketPremiums() []MarketPremiums

func (*PremiumStore) GetMarketPremiumsMap

func (ps *PremiumStore) GetMarketPremiumsMap() map[uint32]MarketPremiums

GetMarketPremiumsMap converts the `MarketPremiums` list stored in `PremiumStore` to a map form `perpetualId` to `MarketPremiums`.

func (*PremiumStore) GetNumPremiums

func (m *PremiumStore) GetNumPremiums() uint32

func (*PremiumStore) Marshal

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

func (*PremiumStore) MarshalTo

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

func (*PremiumStore) MarshalToSizedBuffer

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

func (*PremiumStore) ProtoMessage

func (*PremiumStore) ProtoMessage()

func (*PremiumStore) Reset

func (m *PremiumStore) Reset()

func (*PremiumStore) Size

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

func (*PremiumStore) String

func (m *PremiumStore) String() string

func (*PremiumStore) Unmarshal

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

func (*PremiumStore) XXX_DiscardUnknown

func (m *PremiumStore) XXX_DiscardUnknown()

func (*PremiumStore) XXX_Marshal

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

func (*PremiumStore) XXX_Merge

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

func (*PremiumStore) XXX_Size

func (m *PremiumStore) XXX_Size() int

func (*PremiumStore) XXX_Unmarshal

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

type PricesKeeper

type PricesKeeper interface {
	GetMarketPrice(
		ctx sdk.Context,
		id uint32,
	) (marketPrice pricestypes.MarketPrice, err error)
}

type QueryAllPerpetualsRequest

type QueryAllPerpetualsRequest struct {
	Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

Queries a list of Perpetual items.

func (*QueryAllPerpetualsRequest) Descriptor

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

func (*QueryAllPerpetualsRequest) GetPagination

func (m *QueryAllPerpetualsRequest) GetPagination() *query.PageRequest

func (*QueryAllPerpetualsRequest) Marshal

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

func (*QueryAllPerpetualsRequest) MarshalTo

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

func (*QueryAllPerpetualsRequest) MarshalToSizedBuffer

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

func (*QueryAllPerpetualsRequest) ProtoMessage

func (*QueryAllPerpetualsRequest) ProtoMessage()

func (*QueryAllPerpetualsRequest) Reset

func (m *QueryAllPerpetualsRequest) Reset()

func (*QueryAllPerpetualsRequest) Size

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

func (*QueryAllPerpetualsRequest) String

func (m *QueryAllPerpetualsRequest) String() string

func (*QueryAllPerpetualsRequest) Unmarshal

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

func (*QueryAllPerpetualsRequest) XXX_DiscardUnknown

func (m *QueryAllPerpetualsRequest) XXX_DiscardUnknown()

func (*QueryAllPerpetualsRequest) XXX_Marshal

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

func (*QueryAllPerpetualsRequest) XXX_Merge

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

func (*QueryAllPerpetualsRequest) XXX_Size

func (m *QueryAllPerpetualsRequest) XXX_Size() int

func (*QueryAllPerpetualsRequest) XXX_Unmarshal

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

type QueryAllPerpetualsResponse

type QueryAllPerpetualsResponse struct {
	Perpetual  []Perpetual         `protobuf:"bytes,1,rep,name=perpetual,proto3" json:"perpetual"`
	Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

QueryAllPerpetualsResponse is response type for the AllPerpetuals RPC method.

func (*QueryAllPerpetualsResponse) Descriptor

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

func (*QueryAllPerpetualsResponse) GetPagination

func (m *QueryAllPerpetualsResponse) GetPagination() *query.PageResponse

func (*QueryAllPerpetualsResponse) GetPerpetual

func (m *QueryAllPerpetualsResponse) GetPerpetual() []Perpetual

func (*QueryAllPerpetualsResponse) Marshal

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

func (*QueryAllPerpetualsResponse) MarshalTo

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

func (*QueryAllPerpetualsResponse) MarshalToSizedBuffer

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

func (*QueryAllPerpetualsResponse) ProtoMessage

func (*QueryAllPerpetualsResponse) ProtoMessage()

func (*QueryAllPerpetualsResponse) Reset

func (m *QueryAllPerpetualsResponse) Reset()

func (*QueryAllPerpetualsResponse) Size

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

func (*QueryAllPerpetualsResponse) String

func (m *QueryAllPerpetualsResponse) String() string

func (*QueryAllPerpetualsResponse) Unmarshal

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

func (*QueryAllPerpetualsResponse) XXX_DiscardUnknown

func (m *QueryAllPerpetualsResponse) XXX_DiscardUnknown()

func (*QueryAllPerpetualsResponse) XXX_Marshal

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

func (*QueryAllPerpetualsResponse) XXX_Merge

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

func (*QueryAllPerpetualsResponse) XXX_Size

func (m *QueryAllPerpetualsResponse) XXX_Size() int

func (*QueryAllPerpetualsResponse) XXX_Unmarshal

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

type QueryClient

type QueryClient interface {
	// Queries a Perpetual by id.
	Perpetual(ctx context.Context, in *QueryPerpetualRequest, opts ...grpc.CallOption) (*QueryPerpetualResponse, error)
	// Queries a list of Perpetual items.
	AllPerpetuals(ctx context.Context, in *QueryAllPerpetualsRequest, opts ...grpc.CallOption) (*QueryAllPerpetualsResponse, 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

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryPerpetualRequest

type QueryPerpetualRequest struct {
	Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
}

Queries a Perpetual by id.

func (*QueryPerpetualRequest) Descriptor

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

func (*QueryPerpetualRequest) GetId

func (m *QueryPerpetualRequest) GetId() uint32

func (*QueryPerpetualRequest) Marshal

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

func (*QueryPerpetualRequest) MarshalTo

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

func (*QueryPerpetualRequest) MarshalToSizedBuffer

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

func (*QueryPerpetualRequest) ProtoMessage

func (*QueryPerpetualRequest) ProtoMessage()

func (*QueryPerpetualRequest) Reset

func (m *QueryPerpetualRequest) Reset()

func (*QueryPerpetualRequest) Size

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

func (*QueryPerpetualRequest) String

func (m *QueryPerpetualRequest) String() string

func (*QueryPerpetualRequest) Unmarshal

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

func (*QueryPerpetualRequest) XXX_DiscardUnknown

func (m *QueryPerpetualRequest) XXX_DiscardUnknown()

func (*QueryPerpetualRequest) XXX_Marshal

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

func (*QueryPerpetualRequest) XXX_Merge

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

func (*QueryPerpetualRequest) XXX_Size

func (m *QueryPerpetualRequest) XXX_Size() int

func (*QueryPerpetualRequest) XXX_Unmarshal

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

type QueryPerpetualResponse

type QueryPerpetualResponse struct {
	Perpetual Perpetual `protobuf:"bytes,1,opt,name=perpetual,proto3" json:"perpetual"`
}

QueryPerpetualResponse is response type for the Perpetual RPC method.

func (*QueryPerpetualResponse) Descriptor

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

func (*QueryPerpetualResponse) GetPerpetual

func (m *QueryPerpetualResponse) GetPerpetual() Perpetual

func (*QueryPerpetualResponse) Marshal

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

func (*QueryPerpetualResponse) MarshalTo

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

func (*QueryPerpetualResponse) MarshalToSizedBuffer

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

func (*QueryPerpetualResponse) ProtoMessage

func (*QueryPerpetualResponse) ProtoMessage()

func (*QueryPerpetualResponse) Reset

func (m *QueryPerpetualResponse) Reset()

func (*QueryPerpetualResponse) Size

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

func (*QueryPerpetualResponse) String

func (m *QueryPerpetualResponse) String() string

func (*QueryPerpetualResponse) Unmarshal

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

func (*QueryPerpetualResponse) XXX_DiscardUnknown

func (m *QueryPerpetualResponse) XXX_DiscardUnknown()

func (*QueryPerpetualResponse) XXX_Marshal

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

func (*QueryPerpetualResponse) XXX_Merge

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

func (*QueryPerpetualResponse) XXX_Size

func (m *QueryPerpetualResponse) XXX_Size() int

func (*QueryPerpetualResponse) XXX_Unmarshal

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

type QueryServer

type QueryServer interface {
	// Queries a Perpetual by id.
	Perpetual(context.Context, *QueryPerpetualRequest) (*QueryPerpetualResponse, error)
	// Queries a list of Perpetual items.
	AllPerpetuals(context.Context, *QueryAllPerpetualsRequest) (*QueryAllPerpetualsResponse, error)
}

QueryServer is the server API for Query service.

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) AddPremiumVotes

func (*UnimplementedMsgServer) CreatePerpetual

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) AllPerpetuals

func (*UnimplementedQueryServer) Perpetual

Jump to

Keyboard shortcuts

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