Documentation ¶
Index ¶
- type Hooks
- type Keeper
- func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, _ int64)
- func (k Keeper) AllocationMeter(c context.Context, req *types.QueryAllocationMeterRequest) (*types.QueryAllocationMeterResponse, error)
- func (k Keeper) AllocationMeters(c context.Context, req *types.QueryAllocationMetersRequest) (*types.QueryAllocationMetersResponse, error)
- func (k Keeper) BeforeEpochStart(_ sdk.Context, _ string, _ int64)
- func (k Keeper) CancelIncentive(ctx sdk.Context, contract common.Address) error
- func (k Keeper) DeleteGasMeter(ctx sdk.Context, gm types.GasMeter)
- func (k Keeper) DeleteIncentiveAndUpdateAllocationMeters(ctx sdk.Context, incentive types.Incentive)
- func (k Keeper) DistributeIncentives(ctx sdk.Context) error
- func (k Keeper) GasMeter(c context.Context, req *types.QueryGasMeterRequest) (*types.QueryGasMeterResponse, error)
- func (k Keeper) GasMeters(c context.Context, req *types.QueryGasMetersRequest) (*types.QueryGasMetersResponse, error)
- func (k Keeper) GetAllAllocationMeters(ctx sdk.Context) []sdk.DecCoin
- func (k Keeper) GetAllIncentives(ctx sdk.Context) []types.Incentive
- func (k Keeper) GetAllocationMeter(ctx sdk.Context, denom string) (sdk.DecCoin, bool)
- func (k Keeper) GetGasMeter(ctx sdk.Context, contract, participant common.Address) (uint64, bool)
- func (k Keeper) GetIncentive(ctx sdk.Context, contract common.Address) (types.Incentive, bool)
- func (k Keeper) GetIncentiveGasMeters(ctx sdk.Context, contract common.Address) []types.GasMeter
- func (k Keeper) GetIncentivesGasMeters(ctx sdk.Context) []types.GasMeter
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) Incentive(c context.Context, req *types.QueryIncentiveRequest) (*types.QueryIncentiveResponse, error)
- func (k Keeper) Incentives(c context.Context, req *types.QueryIncentivesRequest) (*types.QueryIncentivesResponse, error)
- func (k Keeper) IsIncentiveRegistered(ctx sdk.Context, contract common.Address) bool
- func (k Keeper) IterateIncentiveGasMeters(ctx sdk.Context, contract common.Address, ...)
- func (k Keeper) IterateIncentives(ctx sdk.Context, handlerFn func(incentive types.Incentive) (stop bool))
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) RegisterIncentive(ctx sdk.Context, contract common.Address, allocations sdk.DecCoins, ...) (*types.Incentive, error)
- func (k Keeper) SetAllocationMeter(ctx sdk.Context, am sdk.DecCoin)
- func (k Keeper) SetGasMeter(ctx sdk.Context, gm types.GasMeter)
- func (k Keeper) SetIncentive(ctx sdk.Context, incentive types.Incentive)
- func (k Keeper) SetIncentiveTotalGas(ctx sdk.Context, incentive types.Incentive, gas uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- type Migrator
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 ¶
AfterEpochEnd implements EpochHooks
func (Hooks) BeforeEpochStart ¶
BeforeEpochStart implements EpochHooks
func (Hooks) PostTxProcessing ¶
func (h Hooks) PostTxProcessing(ctx sdk.Context, participant common.Address, contract *common.Address, 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 ¶
func NewKeeper( storeKey sdk.StoreKey, cdc codec.BinaryCodec, ps paramtypes.Subspace, ak types.AccountKeeper, bk types.BankKeeper, ik types.InflationKeeper, sk types.StakeKeeper, evmKeeper types.EVMKeeper, ) Keeper
NewKeeper creates new instances of the incentives Keeper
func (Keeper) AfterEpochEnd ¶
AfterEpochEnd distributes the contract incentives at the end of each epoch
func (Keeper) AllocationMeter ¶
func (k Keeper) AllocationMeter( c context.Context, req *types.QueryAllocationMeterRequest, ) (*types.QueryAllocationMeterResponse, error)
AllocationMeter returns a given registered allocation meter
func (Keeper) AllocationMeters ¶
func (k Keeper) AllocationMeters( c context.Context, req *types.QueryAllocationMetersRequest, ) (*types.QueryAllocationMetersResponse, error)
AllocationMeters return registered allocation meters
func (Keeper) BeforeEpochStart ¶
BeforeEpochStart performs a no-op
func (Keeper) CancelIncentive ¶
RegisterIncentive deletes the incentive for a contract
func (Keeper) DeleteGasMeter ¶
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 ¶
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 ¶
func (k Keeper) GasMeter( c context.Context, req *types.QueryGasMeterRequest, ) (*types.QueryGasMeterResponse, error)
GasMeter returns a given registered gas meter
func (Keeper) GasMeters ¶
func (k Keeper) GasMeters( c context.Context, req *types.QueryGasMetersRequest, ) (*types.QueryGasMetersResponse, error)
GasMeters return active gas meters
func (Keeper) GetAllAllocationMeters ¶
GetAllAllocationMeters - get all registered AllocationMeters
func (Keeper) GetAllIncentives ¶
GetAllIncentives - get all registered Incentives
func (Keeper) GetAllocationMeter ¶
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 ¶
GetIncentive - get registered incentive from the identifier
func (Keeper) GetIncentiveGasMeters ¶
GetIncentiveGasMeters - get all registered GasMeters per contract
func (Keeper) GetIncentivesGasMeters ¶
GetIncentivesGasMeters - get all registered GasMeters per Incentive
func (Keeper) Incentive ¶
func (k Keeper) Incentive( c context.Context, req *types.QueryIncentiveRequest, ) (*types.QueryIncentiveResponse, error)
Incentive returns a given registered incentive
func (Keeper) Incentives ¶
func (k Keeper) Incentives( c context.Context, req *types.QueryIncentivesRequest, ) (*types.QueryIncentivesResponse, error)
Incentives return registered incentives
func (Keeper) IsIncentiveRegistered ¶
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) Params ¶
func (k Keeper) Params( c context.Context, _ *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error)
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 ¶
SetAllocationMeter stores an allocationMeter
func (Keeper) SetGasMeter ¶
SetGasMeter stores a gasMeter
func (Keeper) SetIncentive ¶
SetIncentive stores an incentive
func (Keeper) SetIncentiveTotalGas ¶
Set total cummulative gas of a given incentive