keeper

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: MIT Imports: 26 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 Keeper

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

func NewKeeper

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

	bankKeeper types.BankKeeper,
	accountKeeper types.AccountKeeper,
	applicationKeeper types.ApplicationKeeper,
	supplierKeeper types.SupplierKeeper,
	proofKeeper types.ProofKeeper,
	sharedKeeper types.SharedKeeper,
	sessionKeeper types.SessionKeeper,
	serviceKeeper types.ServiceKeeper,

	tokenLogicModules []tlm.TokenLogicModule,
) Keeper

func (Keeper) ExecutePendingExpiredResults added in v0.0.11

func (k Keeper) ExecutePendingExpiredResults(ctx cosmostypes.Context, expiredResults tlm.ClaimSettlementResults) error

ExecutePendingExpiredResults executes all pending supplier slashing operations. IMPORTANT: If the execution of any such operation fails, the chain will halt. In this case, the state is left how it was immediately prior to the execution of the operation which failed.

func (Keeper) ExecutePendingSettledResults added in v0.0.11

func (k Keeper) ExecutePendingSettledResults(ctx cosmostypes.Context, settledResults tlm.ClaimSettlementResults) error

ExecutePendingSettledResults executes all pending mint, burn, and transfer operations. IMPORTANT: If the execution of any pending operation fails, the chain will halt. In this case, the state is left how it was immediately prior to the execution of the operation which failed. TODO_MAINNET(@bryanchriswhite): Make this more "atomic", such that it reverts the state back to just prior to settling the offending claim.

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the x/tokenomics module's authority.

func (Keeper) GetExpiringClaims added in v0.0.11

func (k Keeper) GetExpiringClaims(ctx cosmostypes.Context) (expiringClaims []prooftypes.Claim, _ error)

GetExpiringClaims returns all claims that are expiring at the current block height. This is the height at which the proof window closes. If the proof window closes and a proof IS NOT required -> settle the claim. If the proof window closes and a proof IS required -> only settle it if a proof is available. DEV_NOTE: It is exported for testing purposes.

func (Keeper) GetParams

func (k Keeper) GetParams(ctx context.Context) (params types.Params)

GetParams get all parameters as types.Params

func (Keeper) Logger

func (k Keeper) Logger() log.Logger

Logger returns a module-specific logger.

func (Keeper) Params

func (Keeper) ProcessTokenLogicModules added in v0.0.6

func (k Keeper) ProcessTokenLogicModules(
	ctx context.Context,
	pendingResult *tokenomicstypes.ClaimSettlementResult,
	applicationInitialStake cosmostypes.Coin,
) error

ProcessTokenLogicModules is the entrypoint for all TLM processing.

It is responsible for running all the independent TLMs necessary to limit, burn, mint or transfer tokens as a result of the amount of work (i.e. relays, compute units) done in proportion to the global governance parameters.

Prior to running the TLMs, it handles the business logic of converting the claimed amount to the actual settlement amount and handling the case for overserviced applications.

IMPORTANT: It is assumed that the proof for the claim has been validated BEFORE calling this function.

func (Keeper) SetParams

func (k Keeper) SetParams(ctx context.Context, params types.Params) error

SetParams set the params

func (Keeper) SettlePendingClaims

func (k Keeper) SettlePendingClaims(ctx cosmostypes.Context) (
	settledResults tlm.ClaimSettlementResults,
	expiredResults tlm.ClaimSettlementResults,
	err error,
)

SettlePendingClaims settles all pending (i.e. expiring) claims. If a claim is expired and requires a proof and a proof IS available -> it's settled. If a claim is expired and requires a proof and a proof IS NOT available -> it's deleted. If a claim is expired and does NOT require a proof -> it's settled. Events are emitted for each claim that is settled or removed. Onchain Claims & Proofs are deleted after they're settled or expired to free up space.

func (Keeper) UpdateRelayMiningDifficulty added in v0.0.3

func (k Keeper) UpdateRelayMiningDifficulty(
	ctx context.Context,
	relaysPerServiceMap map[string]uint64,
) (difficultyPerServiceMap map[string]types.RelayMiningDifficulty, err error)

UpdateRelayMiningDifficulty updates the onchain relay mining difficulty based on the amount of onchain relays for each service, given a map of serviceId->numRelays. This is a wrapper around the service keeper's UpdateRelayMiningDifficulty method to allow the tokenomics EndBlocker to update the relay mining difficulty after all claims have settled.

Jump to

Keyboard shortcuts

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