Documentation ¶
Index ¶
- Variables
- func ComputeMedian(prices []PricePerValidator, totalWeight math.Int) *big.Int
- func GetPowerFromBondedTokens(tokens math.Int) int64
- type AggregatorPricePair
- type ConversionRateAggregateFn
- type ConverstionRateInfo
- type PriceInfo
- type PricePerValidator
- type PricesAggregateFn
- type ValidatorStore
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultPowerThreshold = big.NewRat(2, 3)
DefaultPowerThreshold defines the total voting power % that must be submitted in order for a currency pair to be considered for the final oracle price. We provide a default supermajority threshold of 2/3+.
Functions ¶
func ComputeMedian ¶
func ComputeMedian(prices []PricePerValidator, totalWeight math.Int) *big.Int
Types ¶
type ConversionRateAggregateFn ¶
type ConversionRateAggregateFn func(ctx sdk.Context, veConversionRates map[string]*big.Int) (*big.Int, error)
func MedianConversionRate ¶
func MedianConversionRate( logger log.Logger, validatorStore ValidatorStore, threshold *big.Rat, ) ConversionRateAggregateFn
type ConverstionRateInfo ¶
type ConverstionRateInfo struct { ConversionRates []PricePerValidator TotalWeight math.Int }
type PriceInfo ¶
type PriceInfo struct { SpotPrices []PricePerValidator PnlPrices []PricePerValidator TotalWeight math.Int }
VoteWeightPriceInfo tracks the stake weight(s) + price(s) for a given currency pair.
type PricePerValidator ¶
VoteWeightPrice defines a price update that includes the stake weight of the validator.
type PricesAggregateFn ¶
type PricesAggregateFn func(ctx sdk.Context, vePrices map[string]map[string]AggregatorPricePair) (map[string]AggregatorPricePair, error)
func MedianPrices ¶
func MedianPrices( logger log.Logger, validatorStore ValidatorStore, threshold *big.Rat, ) PricesAggregateFn
type ValidatorStore ¶
type ValidatorStore interface { ValidatorByConsAddr(ctx context.Context, addr sdk.ConsAddress) (stakingtypes.ValidatorI, error) TotalBondedTokens(ctx context.Context) (math.Int, error) GetPubKeyByConsAddr(context.Context, sdk.ConsAddress) (cmtprotocrypto.PublicKey, error) GetValidator(ctx context.Context, valAddr sdk.ValAddress) (stakingtypes.Validator, error) GetAllValidators(ctx context.Context) ([]stakingtypes.Validator, error) }
Click to show internal directories.
Click to hide internal directories.