keeper

package
v0.30.3 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const LIMIT_TOKEN_PER_CU = 100
View Source
const MONTHS_IN_YEAR = 12

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.

func NextMonth added in v0.14.1

func NextMonth(date time.Time) time.Time

NextMonth returns the date of the same day next month (assumes UTC), adjusting for end-of-months differences if needed.

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	ps paramtypes.Subspace,

	bankKeeper types.BankKeeper,
	accountKeeper types.AccountKeeper,
	epochstorageKeeper types.EpochstorageKeeper,
	projectsKeeper types.ProjectsKeeper,
	plansKeeper types.PlansKeeper,
	dualstakingKeeper types.DualStakingKeeper,
	fixationStoreKeeper types.FixationStoreKeeper,
	timerStoreKeeper types.TimerStoreKeeper,
	stakingKeeper types.StakingKeeper,
) *Keeper

func (Keeper) AddProjectToSubscription

func (k Keeper) AddProjectToSubscription(ctx sdk.Context, consumer string, projectData projectstypes.ProjectData) error

func (Keeper) AddTrackedCu

func (k Keeper) AddTrackedCu(ctx sdk.Context, sub string, provider string, chainID string, cuToAdd uint64, block uint64) error

AddTrackedCu adds CU to the CU counters in relevant trackedCu entry

func (Keeper) CalcTotalMonthlyReward

func (k Keeper) CalcTotalMonthlyReward(ctx sdk.Context, totalAmount math.Int, trackedCu uint64, totalCuUsedBySub uint64) math.Int

func (Keeper) ChargeComputeUnitsToSubscription

func (k Keeper) ChargeComputeUnitsToSubscription(ctx sdk.Context, consumer string, block, cuAmount uint64) (types.Subscription, error)

func (Keeper) CreateSubscription

func (k Keeper) CreateSubscription(
	ctx sdk.Context,
	creator string,
	consumer string,
	planIndex string,
	duration uint64,
	autoRenewalFlag bool,
) error

CreateSubscription creates a subscription for a consumer

func (Keeper) Current

func (Keeper) DelProjectFromSubscription

func (k Keeper) DelProjectFromSubscription(ctx sdk.Context, consumer, name string) error

func (Keeper) ExportCuTrackerTimers

func (k Keeper) ExportCuTrackerTimers(ctx sdk.Context) timerstoretypes.GenesisState

ExportCuTrackerTimers exports CuTracker timers data (for genesis)

func (Keeper) ExportCuTrackers

func (k Keeper) ExportCuTrackers(ctx sdk.Context) fixationtypes.GenesisState

ExportCuTrackers exports CuTrackers data (for genesis)

func (Keeper) ExportSubscriptions

func (k Keeper) ExportSubscriptions(ctx sdk.Context) fixationtypes.GenesisState

ExportSubscriptions exports subscriptions data (for genesis)

func (Keeper) ExportSubscriptionsTimers

func (k Keeper) ExportSubscriptionsTimers(ctx sdk.Context) timerstoretypes.GenesisState

ExportSubscriptionsTimers exports subscriptions timers data (for genesis)

func (Keeper) GetAllSubTrackedCuIndices

func (k Keeper) GetAllSubTrackedCuIndices(ctx sdk.Context, sub string) []string

GetAllSubTrackedCuIndices gets all the trackedCu entries that are related to a specific subscription

func (Keeper) GetAllSubscriptionsIndices

func (k Keeper) GetAllSubscriptionsIndices(ctx sdk.Context) []string

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetPlanFromSubscription

func (k Keeper) GetPlanFromSubscription(ctx sdk.Context, consumer string, block uint64) (planstypes.Plan, error)

func (Keeper) GetSubTrackedCuInfo

func (k Keeper) GetSubTrackedCuInfo(ctx sdk.Context, sub string, subBlockStr string) (trackedCuList []trackedCuInfo, totalCuTracked uint64)

func (Keeper) GetSubscription

func (k Keeper) GetSubscription(ctx sdk.Context, consumer string) (val types.Subscription, found bool)

GetSubscription returns the subscription of a given consumer

func (Keeper) GetTrackedCu

func (k Keeper) GetTrackedCu(ctx sdk.Context, sub string, provider string, chainID string, subBlock uint64) (cu uint64, found bool, key string)

GetTrackedCu gets the tracked CU counter (with QoS influence) and the trackedCu entry's block

func (Keeper) InitCuTrackerTimers

func (k Keeper) InitCuTrackerTimers(ctx sdk.Context, data timerstoretypes.GenesisState)

InitCuTrackerTimers imports CuTrackers timers data (from genesis)

func (Keeper) InitCuTrackers

func (k Keeper) InitCuTrackers(ctx sdk.Context, gs fixationtypes.GenesisState)

InitCuTrackers imports CuTracker data (from genesis)

func (Keeper) InitSubscriptions

func (k Keeper) InitSubscriptions(ctx sdk.Context, gs fixationtypes.GenesisState)

InitSubscriptions imports subscriptions data (from genesis)

func (Keeper) InitSubscriptionsTimers

func (k Keeper) InitSubscriptionsTimers(ctx sdk.Context, data timerstoretypes.GenesisState)

InitSubscriptions imports subscriptions timers data (from genesis)

func (Keeper) List

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) RemoveExpiredSubscription

func (k Keeper) RemoveExpiredSubscription(ctx sdk.Context, consumer string, block uint64)

func (Keeper) RewardAndResetCuTracker

func (k Keeper) RewardAndResetCuTracker(ctx sdk.Context, cuTrackerTimerKeyBytes []byte, cuTrackerTimerData []byte)

remove only before the sub is deleted

func (Keeper) SetParams

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

SetParams set the params

type Migrator

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

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

func (Migrator) Migrate2to3

func (m Migrator) Migrate2to3(ctx sdk.Context) error

Migrate2to3 implements store migration from v2 to v3:

  • Convert subscription store to fixation store and use timers

func (Migrator) Migrate3to4

func (m Migrator) Migrate3to4(ctx sdk.Context) error

Migrate3to4 implements store migration from v3 to v4: -- trigger fixation migration (v4->v5), initialize IsLatest field

func (Migrator) Migrate4to5

func (m Migrator) Migrate4to5(ctx sdk.Context) error

Migrate4to5 implements store migration from v4 to v5: -- rename the DurationTotal field to DurationBought -- introduce two new fields: DurationTotal (with new meaning) and cluster -- assign the subscription's cluster

func (Migrator) Migrate5to6

func (m Migrator) Migrate5to6(ctx sdk.Context) error

Migrate5to6 implements store migration from v5 to v6: -- find old subscriptions and trigger advance month to make them expire

Jump to

Keyboard shortcuts

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