keeper

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const LIMIT_TOKEN_PER_CU = 100

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,
	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,
	rewardsKeeper types.RewardsKeeper,
	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 Also, it counts the IPRPC CU if the subscription is IPRPC eligible

func (Keeper) AdjustmentIndex

func (k Keeper) AdjustmentIndex(consumer string, provider string) string

func (Keeper) AppendAdjustment

func (k Keeper) AppendAdjustment(ctx sdk.Context, consumer string, provider string, totalConsumerUsage uint64, usageWithThisProvider uint64)

func (Keeper) CalcTotalMonthlyReward

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

func (Keeper) CalculateParticipationFees added in v1.2.5

func (k Keeper) CalculateParticipationFees(ctx sdk.Context, reward sdk.Coin) (sdk.Coins, sdk.Coins, error)

wrapper function for calculating the validators and community participation fees

func (Keeper) ChargeComputeUnitsToSubscription

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

func (Keeper) CreateFutureSubscription

func (k Keeper) CreateFutureSubscription(ctx sdk.Context,
	creator string,
	consumer string,
	planIndex string,
	duration uint64,
) 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) GetAdjustment

func (k Keeper) GetAdjustment(
	ctx sdk.Context,
	index string,
) (val types.Adjustment, found bool)

GetAdjustment returns a Adjustment from its index

func (Keeper) GetAdjustmentFactorProvider

func (k Keeper) GetAdjustmentFactorProvider(ctx sdk.Context, adjustments []types.Adjustment) map[string]sdk.Dec

func (Keeper) GetAllAdjustment

func (k Keeper) GetAllAdjustment(ctx sdk.Context) (list []types.Adjustment)

GetAllAdjustment returns all Adjustment

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) GetConsumerAdjustments

func (k Keeper) GetConsumerAdjustments(ctx sdk.Context, consumer string) (list []types.Adjustment)

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) GetProviderFromAdjustment

func (k Keeper) GetProviderFromAdjustment(adjustment *types.Adjustment) (string, error)

func (Keeper) GetSubTrackedCuInfo

func (k Keeper) GetSubTrackedCuInfo(ctx sdk.Context, sub string, block uint64) (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) GetSubscriptionForBlock

func (k Keeper) GetSubscriptionForBlock(ctx sdk.Context, consumer string, block uint64) (val types.Subscription, entryBlock uint64, found bool)

GetSubscription returns the subscription of a given consumer in a specific block

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) RemoveAdjustment

func (k Keeper) RemoveAdjustment(
	ctx sdk.Context,
	index string,
)

RemoveAdjustment removes a Adjustment from the store

func (Keeper) RemoveConsumerAdjustments

func (k Keeper) RemoveConsumerAdjustments(ctx sdk.Context, consumer string)

assumes consumer comes first in the key, when querying by subscription it will catch all

func (Keeper) RemoveExpiredSubscription

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

func (Keeper) RewardAndResetCuTracker

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

remove only before the sub is deleted

func (Keeper) SetAdjustment

func (k Keeper) SetAdjustment(ctx sdk.Context, adjustment types.Adjustment)

SetAdjustment set a specific Adjustment in the store from its index

func (Keeper) SetAllAdjustment

func (k Keeper) SetAllAdjustment(ctx sdk.Context, list []types.Adjustment)

SetAllAdjustment sets all adjustments to the store

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

func (Migrator) Migrate6to7

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

Migrate6to7 implements store migration from v6 to v7: -- if subscription's auto_renewal = true, set auto_renewal_next_plan to the current's subscription plan

func (Migrator) Migrate7to8

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

Migrate7to8 implements store migration from v7 to v8: init new credit field

Jump to

Keyboard shortcuts

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