sla

package
v0.1.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.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 Keeper

type Keeper interface {
	// UpdatePriceFeeds will update all price feed incentives given the latest updates.
	UpdatePriceFeeds(ctx sdk.Context, updates slakeeper.PriceFeedUpdates) error
}

Keeper defines the interface that must be fulfilled by the SLA keeper.

type OracleKeeper

type OracleKeeper interface {
	// GetAllCurrencyPairs returns all CurrencyPairs that have currently been stored to state.
	GetAllCurrencyPairs(ctx sdk.Context) []oracletypes.CurrencyPair
}

OracleKeeper defines the interface that must be fulfilled by the oracle keeper.

type PreBlockHandler

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

PreBlockerHandler is responsible for aggregating information about oracle price feeds that each validator is including via their vote extensions. This handler is run before any transactions are executed/finalized for a given block. The handler check's the vote extensions included in each transaction and updates the price feed incentives for each validator.

func NewSLAPreBlockHandler

func NewSLAPreBlockHandler(
	oracleKeeper OracleKeeper,
	stakingKeeper StakingKeeper,
	slaKeeper Keeper,
	strategy currencypair.CurrencyPairStrategy,
	voteExtCodec compression.VoteExtensionCodec,
	extendedCommitCodec compression.ExtendedCommitCodec,
) *PreBlockHandler

NewSLAPreBlockerHandler returns a new PreBlockHandler.

func (*PreBlockHandler) GetUpdates

GetUpdates returns a mapping of every validator's price feed status updates. This function will iterate through the active set of validators, determine which currency pairs they included prices for via their vote extensions, and return a mapping of each validator's status updates.

func (*PreBlockHandler) PreBlocker

func (h *PreBlockHandler) PreBlocker() sdk.PreBlocker

PreBlocker is called by the base app before the block is finalized. Specifically, this function is called before any transactions are executed, but after oracle prices have been written to the oracle store. This function will retrieve all of the vote extensions that were included in the block, determine which currency pairs each validator included prices for, and update the price feed incentives for each validator. Enforcements of SLAs is done in the SLA BeginBlocker.

type StakingKeeper

type StakingKeeper interface {
	// GetBondedValidatorsByPower returns all bonded validators that have currently been stored to state.
	GetBondedValidatorsByPower(ctx context.Context) ([]stakingtypes.Validator, error)
}

StakingKeeper defines the interface that must be fulfilled by the staking keeper.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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