keeper

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

Types

type Hooks

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

Hooks wrapper struct for reporter keeper

func (Hooks) AfterConsensusPubKeyUpdate

func (h Hooks) AfterConsensusPubKeyUpdate(_ context.Context, _, _ cryptotypes.PubKey, _ sdk.Coin) error

func (Hooks) AfterDelegationModified

func (h Hooks) AfterDelegationModified(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error

func (Hooks) AfterUnbondingInitiated

func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error

func (Hooks) AfterValidatorBeginUnbonding

func (h Hooks) AfterValidatorBeginUnbonding(ctx context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error

func (Hooks) AfterValidatorBonded

func (h Hooks) AfterValidatorBonded(ctx context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error

func (Hooks) AfterValidatorCreated

func (h Hooks) AfterValidatorCreated(_ context.Context, _ sdk.ValAddress) error

func (Hooks) AfterValidatorRemoved

func (h Hooks) AfterValidatorRemoved(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error

func (Hooks) BeforeDelegationCreated

func (h Hooks) BeforeDelegationCreated(ctx context.Context, delAddr sdk.AccAddress, _ sdk.ValAddress) error

func (Hooks) BeforeDelegationRemoved

func (h Hooks) BeforeDelegationRemoved(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

func (Hooks) BeforeDelegationSharesModified

func (h Hooks) BeforeDelegationSharesModified(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error

func (Hooks) BeforeValidatorModified

func (h Hooks) BeforeValidatorModified(_ context.Context, _ sdk.ValAddress) error

func (Hooks) BeforeValidatorSlashed

func (h Hooks) BeforeValidatorSlashed(_ context.Context, _ sdk.ValAddress, _ sdkmath.LegacyDec) error

type Keeper

type Keeper struct {
	Params                    collections.Item[types.Params]
	Tracker                   collections.Item[types.StakeTracker]
	Reporters                 collections.Map[[]byte, types.OracleReporter]
	SelectorTips              collections.Map[[]byte, types.BigUint]
	Selectors                 *collections.IndexedMap[[]byte, types.Selection, ReporterSelectorsIndex]
	DisputedDelegationAmounts collections.Map[[]byte, types.DelegationsAmounts]
	FeePaidFromStake          collections.Map[[]byte, types.DelegationsAmounts]
	Report                    collections.Map[collections.Pair[[]byte, uint64], types.DelegationsAmounts]

	Schema collections.Schema
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeService store.KVStoreService,
	logger log.Logger,
	authority string,

	stakingKeeper types.StakingKeeper,
	bankKeeper types.BankKeeper,
	registryKeeper types.RegistryKeeper,
) Keeper

func (Keeper) AddAmountToStake

func (k Keeper) AddAmountToStake(ctx context.Context, acc sdk.AccAddress, amt math.Int) error

func (Keeper) CheckSelectorsDelegations

func (k Keeper) CheckSelectorsDelegations(ctx context.Context, addr sdk.AccAddress) (math.Int, int64, error)

function that iterates through a selector's delegations and checks if they meet the min requirement plus counts how many delegations they have

func (Keeper) Delegation

func (k Keeper) Delegation(ctx context.Context, delegator sdk.AccAddress) (types.Selection, error)

alias

func (Keeper) DivvyingTips

func (k Keeper) DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward types.BigUint, height uint64) error

distributes tips paid in oracle module to delegators that were part of reporting the tip's report

func (Keeper) EscrowReporterStake

func (k Keeper) EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, power, height uint64, amt math.Int, hashId []byte) error

func (Keeper) FeeRefund

func (k Keeper) FeeRefund(ctx context.Context, hashId []byte, amt math.Int) error

called in dispute module after dispute is resolved returns the fee to the delegators that paid minus burn amount

func (Keeper) FeefromReporterStake

func (k Keeper) FeefromReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, amt math.Int, hashId []byte) error

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the module's authority.

func (Keeper) GetBondedValidators

func (k Keeper) GetBondedValidators(ctx context.Context, max uint32) ([]stakingtypes.Validator, error)

func (Keeper) GetDelegatorTokensAtBlock

func (k Keeper) GetDelegatorTokensAtBlock(ctx context.Context, delegator []byte, blockNumber uint64) (math.Int, error)

func (Keeper) GetNumOfSelectors

func (k Keeper) GetNumOfSelectors(ctx context.Context, repAddr sdk.AccAddress) (int, error)

func (Keeper) GetReporterTokensAtBlock

func (k Keeper) GetReporterTokensAtBlock(ctx context.Context, reporter []byte, blockNumber uint64) (math.Int, error)

func (Keeper) HasMin

func (k Keeper) HasMin(ctx context.Context, addr sdk.AccAddress, minRequired math.Int) (bool, error)

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the reporter hooks

func (Keeper) JailReporter

func (k Keeper) JailReporter(ctx context.Context, reporterAddr sdk.AccAddress, jailDuration uint64) error

send a reporter to jail

func (Keeper) LegacyDecFromMathUint

func (k Keeper) LegacyDecFromMathUint(value math.Uint) math.LegacyDec

Converts a math.Uint to a legacy decimal

func (Keeper) Logger

func (k Keeper) Logger() log.Logger

Logger returns a module-specific logger.

func (Keeper) MoveTokensFromValidator

func (k Keeper) MoveTokensFromValidator(ctx context.Context, validator stakingtypes.Validator, amount math.Int) error

func (Keeper) Reporter

func (k Keeper) Reporter(ctx context.Context, reporter sdk.AccAddress) (types.OracleReporter, error)

func (Keeper) ReporterStake

func (k Keeper) ReporterStake(ctx context.Context, repAddr sdk.AccAddress) (math.Int, error)

Reporter returns the total power of a reporter that is bonded at time of the call Store the set of delegations for the reporter at the current block height for dispute purposes to be referenced by block height

func (Keeper) ReturnSlashedTokens

func (k Keeper) ReturnSlashedTokens(ctx context.Context, amt math.Int, hashId []byte) error

ReturnSlashedTokens returns the slashed tokens to the delegators, called in dispute module after dispute is resolved with result invalid or reporter wins

func (Keeper) TotalReporterPower

func (k Keeper) TotalReporterPower(ctx context.Context) (math.Int, error)

func (Keeper) TrackStakeChange

func (k Keeper) TrackStakeChange(ctx context.Context) error

func (Keeper) TruncateUint

func (k Keeper) TruncateUint(value math.LegacyDec) math.Uint

Truncates a legacy decimal to a math.Uint

func (Keeper) UnjailReporter

func (k Keeper) UnjailReporter(ctx context.Context, reporterAddr sdk.AccAddress, reporter types.OracleReporter) error

remove a reporter from jail

type Querier

type Querier struct {
	Keeper
}

func NewQuerier

func NewQuerier(keeper Keeper) Querier

func (Querier) AllowedAmount

get the current staking/unstaking amount allowed w/out triggering 5% change

func (Querier) NumOfSelectorsByReporter

query for num of selectors in reporter

func (Querier) Params

func (Querier) Reporters

Reporters queries all the reporters

func (Querier) SelectorReporter

SelectorReporter queries the reporter of a selector

func (Querier) SpaceAvailableByReporter

query for num of space available in reporter

type ReporterSelectorsIndex

type ReporterSelectorsIndex struct {
	Reporter *indexes.Multi[[]byte, []byte, types.Selection]
}

func (ReporterSelectorsIndex) IndexesList

Jump to

Keyboard shortcuts

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