Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtendVoteHandler ¶
type ExtendVoteHandler struct {
SlinkyExtendVoteHandler sdk.ExtendVoteHandler
PricesTxDecoder process.UpdateMarketPriceTxDecoder
PricesKeeper PricesKeeper
}
ExtendVoteHandler is a wrapper around the Slinky ExtendVoteHandler. This wrapper is responsible for applying the newest MarketPriceUpdates in a block so that the prices to be submitted in a vote extension are determined on the latest available information.
func (*ExtendVoteHandler) ExtendVoteHandler ¶
func (e *ExtendVoteHandler) ExtendVoteHandler() sdk.ExtendVoteHandler
ExtendVoteHandler returns a sdk.ExtendVoteHandler, responsible for the following:
- Decoding the x/prices MsgUpdateMarketPrices in the current block - fail on errors
- Validating the proposed MsgUpdateMarketPrices in accordance with the ProcessProposal check
- Updating the market prices in the PricesKeeper so that the GetValidMarketPriceUpdates function returns the latest available market prices
- Calling the Slinky ExtendVoteHandler to handle the rest of ExtendVote
See: https://github.com/dydxprotocol/slinky/blob/a5b1d3d3a2723e4746b5d588c512d7cc052dc0ff/abci/ve/vote_extension.go#L77 for the Slinky ExtendVoteHandler logic.
type NoopPriceApplier ¶
type NoopPriceApplier struct{}
func (NoopPriceApplier) ApplyPricesFromVoteExtensions ¶
func (n NoopPriceApplier) ApplyPricesFromVoteExtensions( _ sdk.Context, _ *cometabci.RequestFinalizeBlock) (map[slinkytypes.CurrencyPair]*big.Int, error)
func (NoopPriceApplier) GetPricesForValidator ¶
func (n NoopPriceApplier) GetPricesForValidator(_ sdk.ConsAddress) map[slinkytypes.CurrencyPair]*big.Int
type OraclePrices ¶
type OraclePrices struct {
PricesKeeper PricesKeeper
}
OraclePrices is an implementation of the Slinky OracleClient interface. This object is responsible for requesting prices from the x/prices module, and injecting those prices into the vote-extension. The
func NewOraclePrices ¶
func NewOraclePrices(pricesKeeper PricesKeeper) *OraclePrices
NewOraclePrices returns a new OracleClient object.
func (*OraclePrices) Prices ¶
func (o *OraclePrices) Prices(ctx context.Context, _ *oracleservicetypes.QueryPricesRequest, _ ...grpc.CallOption) (*oracleservicetypes.QueryPricesResponse, error)
Prices is called in ExtendVoteHandler to determine which Prices are put into the extended commit. This method is responsible for doing the following:
- Get the latest prices from the x/prices module's indexPriceCache via GetValidMarketPriceUpdates
- Translate the response from x/prices into a QueryPricesResponse, and return it.
This method fails if:
- The passed in context is not an sdk.Context
type PricesKeeper ¶
type PricesKeeper interface {
GetCurrencyPairFromID(ctx sdk.Context, id uint64) (cp oracletypes.CurrencyPair, found bool)
GetValidMarketPriceUpdates(ctx sdk.Context) *pricestypes.MsgUpdateMarketPrices
UpdateMarketPrices(
ctx sdk.Context,
updates []*pricestypes.MsgUpdateMarketPrices_MarketPrice,
) (err error)
}
PricesKeeper is the expected interface for the x/price keeper used by the vote extension handlers