keeper

package
v3.0.0-...-c5b601e Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateSignalTotalPowersFromVotes

func CalculateSignalTotalPowersFromVotes(votes []types.Vote) []types.Signal

CalculateSignalTotalPowersFromVotes calculates the new signal-total-powers from the given votes using on init genesis process.

func CheckMissReport

func CheckMissReport(
	feed types.Feed,
	lastUpdateTimestamp int64,
	lastUpdateBlock int64,
	valPrice types.ValidatorPrice,
	valInfo types.ValidatorInfo,
	blockTime time.Time,
	blockHeight int64,
	gracePeriod int64,
) bool

CheckMissReport checks if a validator has missed a report based on the given parameters. And returns a boolean indication whether the validator has price feed.

func NewMsgServerImpl

func NewMsgServerImpl(k Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the x/feeds MsgServer interface.

func NewQueryServer

func NewQueryServer(k Keeper) types.QueryServer

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,
	oracleKeeper types.OracleKeeper,
	stakingKeeper types.StakingKeeper,
	restakeKeeper types.RestakeKeeper,
	authzKeeper types.AuthzKeeper,
	authority string,
) Keeper

NewKeeper creates a new feeds Keeper instance.

func (Keeper) CalculateNewCurrentFeeds

func (k Keeper) CalculateNewCurrentFeeds(ctx sdk.Context) []types.Feed

CalculateNewCurrentFeeds calculates new supported feeds from current signal-total-powers.

func (Keeper) CalculatePrice

func (k Keeper) CalculatePrice(
	ctx sdk.Context,
	feed types.Feed,
	validatorPriceInfos []types.ValidatorPriceInfo,
	powerQuorum sdkmath.Int,
) (types.Price, error)

CalculatePrice calculates the final price from validator prices and punishes validators who did not report.

func (Keeper) CalculatePrices

func (k Keeper) CalculatePrices(ctx sdk.Context) error

CalculatePrices calculates final prices for all supported feeds.

func (Keeper) DeleteAllPrices

func (k Keeper) DeleteAllPrices(ctx sdk.Context)

DeleteAllPrices deletes all prices.

func (Keeper) DeleteVote

func (k Keeper) DeleteVote(ctx sdk.Context, voter sdk.AccAddress)

DeleteVote deletes all signals voted by a voter.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the module's exported genesis

func (Keeper) GetAllPrices

func (k Keeper) GetAllPrices(ctx sdk.Context) (prices []types.Price)

GetAllPrices returns a list of all prices.

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the x/feeds module's authority.

func (Keeper) GetCurrentFeeds

func (k Keeper) GetCurrentFeeds(ctx sdk.Context) (sp types.CurrentFeeds)

GetCurrentFeeds gets the current supported feeds.

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (p types.Params)

GetParams returns the current x/feeds module parameters.

func (Keeper) GetPrice

func (k Keeper) GetPrice(ctx sdk.Context, signalID string) types.Price

GetPrice returns a price by signal id.

func (Keeper) GetPrices

func (k Keeper) GetPrices(ctx sdk.Context, signalIDs []string) []types.Price

GetPrices returns a list of prices by signal ids.

func (Keeper) GetPricesIterator

func (k Keeper) GetPricesIterator(ctx sdk.Context) dbm.Iterator

GetPricesIterator returns an iterator for prices store.

func (Keeper) GetReferenceSourceConfig

func (k Keeper) GetReferenceSourceConfig(ctx sdk.Context) (rs types.ReferenceSourceConfig)

GetReferenceSourceConfig gets the current reference source config.

func (Keeper) GetSignalTotalPower

func (k Keeper) GetSignalTotalPower(ctx sdk.Context, signalID string) (types.Signal, error)

GetSignalTotalPower gets a signal-total-power from specified signal id.

func (Keeper) GetSignalTotalPowersByPower

func (k Keeper) GetSignalTotalPowersByPower(ctx sdk.Context, limit uint64) []types.Signal

GetSignalTotalPowersByPower gets the current signal-total-power sorted by power-rank.

func (Keeper) GetValidatorPriceList

func (k Keeper) GetValidatorPriceList(ctx sdk.Context, val sdk.ValAddress) (types.ValidatorPriceList, error)

GetValidatorPriceList gets a validator price by validator address.

func (Keeper) GetVote

func (k Keeper) GetVote(ctx sdk.Context, voter sdk.AccAddress) []types.Signal

GetVote returns all signals voted by a voter.

func (Keeper) GetVoteIterator

func (k Keeper) GetVoteIterator(ctx sdk.Context) dbm.Iterator

GetVoteIterator returns an iterator of the vote store.

func (Keeper) GetVotes

func (k Keeper) GetVotes(ctx sdk.Context) (votes []types.Vote)

GetVotes returns all votes.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)

InitGenesis initializes the module's state from a provided genesis state.

func (Keeper) IsBondedValidator

func (k Keeper) IsBondedValidator(ctx sdk.Context, addr sdk.ValAddress) bool

IsBondedValidator checks is the validator is in the bonded validators.

func (Keeper) IsFeeder

func (k Keeper) IsFeeder(ctx sdk.Context, validator sdk.ValAddress, feeder sdk.AccAddress) bool

IsFeeder checks if the given address has been granted as a feeder by the given validator

func (Keeper) LockVoterPower

func (k Keeper) LockVoterPower(
	ctx sdk.Context,
	voter sdk.AccAddress,
	signals []types.Signal,
) error

LockVoterPower locks the voter's power equal to the sum of the signal powers. It returns an error if the voter does not have enough power to lock.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) SetCurrentFeeds

func (k Keeper) SetCurrentFeeds(ctx sdk.Context, feeds []types.Feed)

SetCurrentFeeds sets new supported feeds to the store.

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error

SetParams sets the x/feeds module parameters.

func (Keeper) SetPrice

func (k Keeper) SetPrice(ctx sdk.Context, price types.Price)

SetPRice sets a new price to the prices store or replace if price with the same signal id existed.

func (Keeper) SetPrices

func (k Keeper) SetPrices(ctx sdk.Context, prices []types.Price)

SetPrice sets multiple prices.

func (Keeper) SetReferenceSourceConfig

func (k Keeper) SetReferenceSourceConfig(ctx sdk.Context, rs types.ReferenceSourceConfig) error

SetReferenceSourceConfig sets new reference source config to the store.

func (Keeper) SetSignalTotalPower

func (k Keeper) SetSignalTotalPower(ctx sdk.Context, signal types.Signal)

SetSignalTotalPower sets signal-total-power to the store.

func (Keeper) SetSignalTotalPowers

func (k Keeper) SetSignalTotalPowers(ctx sdk.Context, signalTotalPowersList []types.Signal)

SetSignalTotalPowers sets multiple signal-total-powers.

func (Keeper) SetValidatorPriceList

func (k Keeper) SetValidatorPriceList(
	ctx sdk.Context,
	valAddress sdk.ValAddress,
	valPrices []types.ValidatorPrice,
) error

SetValidatorPrices sets validator prices list.

func (Keeper) SetVote

func (k Keeper) SetVote(ctx sdk.Context, vote types.Vote)

SetVote sets signals voted by a voter.

func (Keeper) SetVotes

func (k Keeper) SetVotes(ctx sdk.Context, votes []types.Vote)

SetVotes sets multiple votes.

func (Keeper) SignalTotalPowersByPowerStoreIterator

func (k Keeper) SignalTotalPowersByPowerStoreIterator(ctx sdk.Context) dbm.Iterator

SignalTotalPowersByPowerStoreIterator returns an iterator for signal-total-powers by power index store.

func (Keeper) UpdateVoteAndReturnPowerDiff

func (k Keeper) UpdateVoteAndReturnPowerDiff(
	ctx sdk.Context,
	voter sdk.AccAddress,
	signals []types.Signal,
) map[string]int64

UpdateVoteAndReturnPowerDiff delete previous signals and add new signals. It also calculates feed power differences from voter's previous signals and new signals.

func (Keeper) ValidateValidatorRequiredToSend

func (k Keeper) ValidateValidatorRequiredToSend(
	ctx sdk.Context,
	val sdk.ValAddress,
) error

ValidateValidatorRequiredToSend validates validator is required for price submission.

Jump to

Keyboard shortcuts

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