prices

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultPriceUpdateGenerator

type DefaultPriceUpdateGenerator struct {
	// contains filtered or unexported fields
}

DefaultPriceUpdateGenerator is the default implementation of the PriceUpdateGenerator interface. This implementation retrieves the `MsgUpdateMarketPrices` from the `PricesKeeper`, i.e the default behavior for dydx v4's PrepareProposalHandler.

func NewDefaultPriceUpdateGenerator

func NewDefaultPriceUpdateGenerator(keeper PricesKeeper) *DefaultPriceUpdateGenerator

NewDefaultPriceUpdateGenerator returns a new DefaultPriceUpdateGenerator.

func (*DefaultPriceUpdateGenerator) GetValidMarketPriceUpdates

func (pug *DefaultPriceUpdateGenerator) GetValidMarketPriceUpdates(
	ctx sdk.Context, _ []byte) (*pricestypes.MsgUpdateMarketPrices, error)

type InvalidPriceError

type InvalidPriceError struct {
	MarketID uint64
	Reason   string
}

InvalidPriceError represents an error thrown when a price retrieved from a vote-extension is invalid. - MarketID: the market-id of the market with the invalid price - Reason: the reason the price is invalid

func (*InvalidPriceError) Error

func (e *InvalidPriceError) Error() string

type PriceUpdateGenerator

type PriceUpdateGenerator interface {
	GetValidMarketPriceUpdates(ctx sdk.Context, extCommitBz []byte) (*pricestypes.MsgUpdateMarketPrices, error)
}

PriceUpdateGenerator is an interface to abstract the logic of retrieving a `MsgUpdateMarketPrices` for any block.

type PricesKeeper

type PricesKeeper interface {
	GetValidMarketPriceUpdates(ctx sdk.Context) *pricestypes.MsgUpdateMarketPrices
}

PricesKeeper defines the expected Prices keeper used for `PrepareProposal`.

type SlinkyPriceUpdateGenerator

type SlinkyPriceUpdateGenerator struct {
	// contains filtered or unexported fields
}

SlinkyPriceUpdateGenerator is an implementation of the PriceUpdateGenerator interface. This implementation retrieves the MsgUpdateMarketPricesTx by aggregating over all VoteExtensions from set of PreCommits on the last block (these commits are local to the proposer).

func NewSlinkyPriceUpdateGenerator

func NewSlinkyPriceUpdateGenerator(
	agg aggregator.VoteAggregator,
	extCommitCodec codec.ExtendedCommitCodec,
	veCodec codec.VoteExtensionCodec,
	currencyPairStrategy currencypair.CurrencyPairStrategy,
) *SlinkyPriceUpdateGenerator

NewSlinkyPriceUpdateGenerator returns a new SlinkyPriceUpdateGenerator

func (*SlinkyPriceUpdateGenerator) GetValidMarketPriceUpdates

func (pug *SlinkyPriceUpdateGenerator) GetValidMarketPriceUpdates(
	ctx sdk.Context, extCommitBz []byte) (*pricestypes.MsgUpdateMarketPrices, error)

Jump to

Keyboard shortcuts

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