aggregator

package
v0.0.0-...-a9c8dba Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MedianAggregator

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

func (*MedianAggregator) AggregateDaemonVEIntoFinalPrices

func (ma *MedianAggregator) AggregateDaemonVEIntoFinalPrices(
	ctx sdk.Context,
	votes []Vote,
) (map[string]veaggregator.AggregatorPricePair, error)

func (*MedianAggregator) GetPriceForValidator

func (ma *MedianAggregator) GetPriceForValidator(validator sdk.ConsAddress) map[string]veaggregator.AggregatorPricePair

type Vote

type Vote struct {
	// ConsAddress is the validator that submitted the vote extension.
	ConsAddress sdk.ConsAddress
	// OracleVoteExtension
	DaemonVoteExtension vetypes.DaemonVoteExtension
}

Vote encapsulates the validator and oracle data contained within a vote extension.

func GetDaemonVotesFromBlock

func GetDaemonVotesFromBlock(
	proposal [][]byte,
	veCodec codec.VoteExtensionCodec,
	extCommitCodec codec.ExtendedCommitCodec,
) ([]Vote, error)

type VoteAggregator

type VoteAggregator interface {

	// In order for a currency pair to be included in the final oracle price, the currency
	// pair must be provided by a super-majority (2/3+) of validators. This is enforced by the
	// price aggregator but can be replaced by the application.
	AggregateDaemonVEIntoFinalPrices(ctx sdk.Context, votes []Vote) (map[string]veaggregator.AggregatorPricePair, error)

	// GetPriceForValidator gets the prices reported by a given validator. This method depends
	// on the prices from the latest set of aggregated votes.
	GetPriceForValidator(validator sdk.ConsAddress) map[string]veaggregator.AggregatorPricePair
}

VoteAggregator is an interface that defines the methods for aggregating oracle votes into a set of prices. This object holds both the aggregated price resulting from a given set of votes, and the prices reported by each validator.

func NewVeAggregator

func NewVeAggregator(
	logger log.Logger,
	indexPriceCache *pricefeedtypes.MarketToExchangePrices,
	pricekeeper pk.Keeper,
	aggregateFn veaggregator.AggregateFn,
) VoteAggregator

Jump to

Keyboard shortcuts

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