keeper

package
v4.0.0-...-67e6beb Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hooks

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

Hooks wrapper struct for incentives keeper

func (Hooks) AfterEpochEnd

func (h Hooks) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64)

AfterEpochEnd implements EpochHooks

func (Hooks) BeforeEpochStart

func (h Hooks) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64)

BeforeEpochStart implements EpochHooks

func (Hooks) PostTxProcessing

func (h Hooks) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error

PostTxProcessing implements EvmHooks.PostTxProcessing. After each successful interaction with an incentivized contract, the participants's GasUsed is added to its gasMeter.

type Keeper

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

Keeper of this module maintains collections of incentives.

func NewKeeper

NewKeeper creates new instances of the incentives Keeper

func (Keeper) AfterEpochEnd

func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, _ int64)

AfterEpochEnd distributes the contract incentives at the end of each epoch

func (Keeper) AllocationMeter

AllocationMeter returns a given registered allocation meter

func (Keeper) AllocationMeters

AllocationMeters return registered allocation meters

func (Keeper) BeforeEpochStart

func (k Keeper) BeforeEpochStart(_ sdk.Context, _ string, _ int64)

BeforeEpochStart performs a no-op

func (Keeper) CancelIncentive

func (k Keeper) CancelIncentive(
	ctx sdk.Context,
	contract common.Address,
) error

RegisterIncentive deletes the incentive for a contract

func (Keeper) DeleteGasMeter

func (k Keeper) DeleteGasMeter(ctx sdk.Context, gm types.GasMeter)

DeleteGasMeter removes a gasMeter.

func (Keeper) DeleteIncentiveAndUpdateAllocationMeters

func (k Keeper) DeleteIncentiveAndUpdateAllocationMeters(ctx sdk.Context, incentive types.Incentive)

DeleteIncentiveAndUpdateAllocationMeters removes an incentive and updates the percentage of incentives allocated to each denomination.

func (Keeper) DistributeIncentives

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

Distribute transfers the allocated rewards to the participants of a given incentive.

  • allocates the amount to be distributed from the inflation pool
  • distributes the rewards to all particpants
  • deletes all gas meters
  • updates the remaining epochs of each incentive
  • sets the cumulative totalGas to zero

func (Keeper) GasMeter

GasMeter returns a given registered gas meter

func (Keeper) GasMeters

GasMeters return active gas meters

func (Keeper) GetAllAllocationMeters

func (k Keeper) GetAllAllocationMeters(ctx sdk.Context) []sdk.DecCoin

GetAllAllocationMeters - get all registered AllocationMeters

func (Keeper) GetAllIncentives

func (k Keeper) GetAllIncentives(ctx sdk.Context) []types.Incentive

GetAllIncentives - get all registered Incentives

func (Keeper) GetAllocationMeter

func (k Keeper) GetAllocationMeter(
	ctx sdk.Context,
	denom string,
) (sdk.DecCoin, bool)

GetAllocationMeter - get registered allocationMeter from the identifier

func (Keeper) GetGasMeter

func (k Keeper) GetGasMeter(
	ctx sdk.Context,
	contract, participant common.Address,
) (uint64, bool)

GetGasMeter - get cumulativeGas from gas meter

func (Keeper) GetIncentive

func (k Keeper) GetIncentive(
	ctx sdk.Context,
	contract common.Address,
) (types.Incentive, bool)

GetIncentive - get registered incentive from the identifier

func (Keeper) GetIncentiveGasMeters

func (k Keeper) GetIncentiveGasMeters(
	ctx sdk.Context,
	contract common.Address,
) []types.GasMeter

GetIncentiveGasMeters - get all registered GasMeters per contract

func (Keeper) GetIncentivesGasMeters

func (k Keeper) GetIncentivesGasMeters(ctx sdk.Context) []types.GasMeter

GetIncentivesGasMeters - get all registered GasMeters per Incentive

func (Keeper) GetParams

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

GetParams returns the total set of incentives parameters.

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) Incentive

Incentive returns a given registered incentive

func (Keeper) Incentives

Incentives return registered incentives

func (Keeper) IsIncentiveRegistered

func (k Keeper) IsIncentiveRegistered(
	ctx sdk.Context,
	contract common.Address,
) bool

IsIncentiveRegistered - check if registered Incentive is registered

func (Keeper) IterateIncentiveGasMeters

func (k Keeper) IterateIncentiveGasMeters(
	ctx sdk.Context,
	contract common.Address,
	handlerFn func(gm types.GasMeter) (stop bool),
)

IterateIncentiveGasMeters iterates over all the given registered incentivized contract's `GasMeter` and performs a callback.

func (Keeper) IterateIncentives

func (k Keeper) IterateIncentives(
	ctx sdk.Context,
	handlerFn func(incentive types.Incentive) (stop bool),
)

IterateIncentives iterates over all registered `Incentives` and performs a callback.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) Params

Params return hub contract param

func (Keeper) RegisterIncentive

func (k Keeper) RegisterIncentive(
	ctx sdk.Context,
	contract common.Address,
	allocations sdk.DecCoins,
	epochs uint32,
) (*types.Incentive, error)

RegisterIncentive creates an incentive for a contract

func (Keeper) SetAllocationMeter

func (k Keeper) SetAllocationMeter(ctx sdk.Context, am sdk.DecCoin)

SetAllocationMeter stores an allocationMeter

func (Keeper) SetGasMeter

func (k Keeper) SetGasMeter(ctx sdk.Context, gm types.GasMeter)

SetGasMeter stores a gasMeter

func (Keeper) SetIncentive

func (k Keeper) SetIncentive(ctx sdk.Context, incentive types.Incentive)

SetIncentive stores an incentive

func (Keeper) SetIncentiveTotalGas

func (k Keeper) SetIncentiveTotalGas(
	ctx sdk.Context,
	incentive types.Incentive,
	gas uint64,
)

Set total cummulative gas of a given incentive

func (Keeper) SetParams

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

SetParams sets the incentives parameters to the param space.

type Migrator

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

Jump to

Keyboard shortcuts

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