keeper

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServiceServer added in v0.6.0

func NewMsgServiceServer(k Keeper) types.MsgServiceServer

NewMsgServiceServer creates a new instance of `types.MsgServiceServer` using the provided Keeper.

func NewQueryServiceServer added in v0.6.0

func NewQueryServiceServer(keeper Keeper) types.QueryServiceServer

Types

type Keeper

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

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec, key sdk.StoreKey, params paramstypes.Subspace, feeCollectorName string) Keeper

func (*Keeper) AddDeposit

func (k *Keeper) AddDeposit(ctx sdk.Context, addr sdk.AccAddress, coin sdk.Coin) error

func (*Keeper) BeginBlock added in v0.11.0

func (k *Keeper) BeginBlock(ctx sdk.Context)

BeginBlock is a function that gets called at the beginning of every block. It processes the payouts scheduled to be made and performs the necessary actions accordingly.

func (*Keeper) CreateSubscriptionForNode added in v0.11.0

func (k *Keeper) CreateSubscriptionForNode(ctx sdk.Context, accAddr sdk.AccAddress, nodeAddr hubtypes.NodeAddress, gigabytes, hours int64, denom string) (*types.NodeSubscription, error)

CreateSubscriptionForNode creates a new NodeSubscription for a specific node and account.

func (*Keeper) CreateSubscriptionForPlan added in v0.11.0

func (k *Keeper) CreateSubscriptionForPlan(ctx sdk.Context, accAddr sdk.AccAddress, id uint64, denom string) (*types.PlanSubscription, error)

CreateSubscriptionForPlan creates a new PlanSubscription for a specific plan and account.

func (*Keeper) DeleteAllocation added in v0.11.0

func (k *Keeper) DeleteAllocation(ctx sdk.Context, id uint64, addr sdk.AccAddress)

func (*Keeper) DeletePayout added in v0.11.0

func (k *Keeper) DeletePayout(ctx sdk.Context, id uint64)

func (*Keeper) DeletePayoutForAccount added in v0.11.0

func (k *Keeper) DeletePayoutForAccount(ctx sdk.Context, addr sdk.AccAddress, id uint64)

func (*Keeper) DeletePayoutForAccountByNode added in v0.11.0

func (k *Keeper) DeletePayoutForAccountByNode(ctx sdk.Context, accAddr sdk.AccAddress, nodeAddr hubtypes.NodeAddress, id uint64)

func (*Keeper) DeletePayoutForNextAt added in v0.11.0

func (k *Keeper) DeletePayoutForNextAt(ctx sdk.Context, at time.Time, id uint64)

func (*Keeper) DeletePayoutForNode added in v0.11.0

func (k *Keeper) DeletePayoutForNode(ctx sdk.Context, addr hubtypes.NodeAddress, id uint64)

func (*Keeper) DeleteSubscription added in v0.9.0

func (k *Keeper) DeleteSubscription(ctx sdk.Context, id uint64)

func (*Keeper) DeleteSubscriptionForAccount added in v0.11.0

func (k *Keeper) DeleteSubscriptionForAccount(ctx sdk.Context, addr sdk.AccAddress, id uint64)

func (*Keeper) DeleteSubscriptionForInactiveAt added in v0.11.0

func (k *Keeper) DeleteSubscriptionForInactiveAt(ctx sdk.Context, at time.Time, id uint64)

func (*Keeper) DeleteSubscriptionForNode added in v0.11.0

func (k *Keeper) DeleteSubscriptionForNode(ctx sdk.Context, addr hubtypes.NodeAddress, id uint64)

func (*Keeper) DeleteSubscriptionForPlan added in v0.11.0

func (k *Keeper) DeleteSubscriptionForPlan(ctx sdk.Context, planID, subscriptionID uint64)

func (*Keeper) EndBlock added in v0.11.0

func (k *Keeper) EndBlock(ctx sdk.Context) []abcitypes.ValidatorUpdate

EndBlock is a function that gets called at the end of every block. It processes the subscriptions that have become inactive and performs the necessary actions accordingly.

func (*Keeper) GetAllocation added in v0.11.0

func (k *Keeper) GetAllocation(ctx sdk.Context, id uint64, addr sdk.AccAddress) (alloc types.Allocation, found bool)

func (*Keeper) GetAllocationsForSubscription added in v0.11.0

func (k *Keeper) GetAllocationsForSubscription(ctx sdk.Context, id uint64) (items types.Allocations)

func (*Keeper) GetCount added in v0.4.0

func (k *Keeper) GetCount(ctx sdk.Context) uint64

func (*Keeper) GetLatestPayoutForAccountByNode added in v0.11.0

func (k *Keeper) GetLatestPayoutForAccountByNode(ctx sdk.Context, accAddr sdk.AccAddress, nodeAddr hubtypes.NodeAddress) (payout types.Payout, found bool)

func (*Keeper) GetNode

func (k *Keeper) GetNode(ctx sdk.Context, address hubtypes.NodeAddress) (nodetypes.Node, bool)

func (*Keeper) GetParams

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

func (*Keeper) GetPayout added in v0.11.0

func (k *Keeper) GetPayout(ctx sdk.Context, id uint64) (payout types.Payout, found bool)

func (*Keeper) GetPayouts added in v0.11.0

func (k *Keeper) GetPayouts(ctx sdk.Context) (items types.Payouts)

func (*Keeper) GetPlan

func (k *Keeper) GetPlan(ctx sdk.Context, id uint64) (plantypes.Plan, bool)

func (*Keeper) GetSession added in v0.11.1

func (k *Keeper) GetSession(ctx sdk.Context, id uint64) (sessiontypes.Session, bool)

func (*Keeper) GetSubscription

func (k *Keeper) GetSubscription(ctx sdk.Context, id uint64) (subscription types.Subscription, found bool)

func (*Keeper) GetSubscriptions

func (k *Keeper) GetSubscriptions(ctx sdk.Context) (items types.Subscriptions)

func (*Keeper) GetSubscriptionsForAccount added in v0.11.0

func (k *Keeper) GetSubscriptionsForAccount(ctx sdk.Context, addr sdk.AccAddress) (items types.Subscriptions)

func (*Keeper) GetSubscriptionsForNode

func (k *Keeper) GetSubscriptionsForNode(ctx sdk.Context, addr hubtypes.NodeAddress) (items types.Subscriptions)

func (*Keeper) GetSubscriptionsForPlan

func (k *Keeper) GetSubscriptionsForPlan(ctx sdk.Context, id uint64) (items types.Subscriptions)

func (*Keeper) HasAllocation added in v0.11.0

func (k *Keeper) HasAllocation(ctx sdk.Context, id uint64, addr sdk.AccAddress) bool

func (*Keeper) HasPayout added in v0.11.0

func (k *Keeper) HasPayout(ctx sdk.Context, id uint64) bool

func (*Keeper) HasSubscriptionForAccount added in v0.11.0

func (k *Keeper) HasSubscriptionForAccount(ctx sdk.Context, addr sdk.AccAddress, id uint64) bool

func (*Keeper) HashPayoutForAccount added in v0.11.0

func (k *Keeper) HashPayoutForAccount(ctx sdk.Context, addr sdk.AccAddress, id uint64) bool

func (*Keeper) HashPayoutForAccountByNode added in v0.11.0

func (k *Keeper) HashPayoutForAccountByNode(ctx sdk.Context, accAddr sdk.AccAddress, nodeAddr hubtypes.NodeAddress, id uint64) bool

func (*Keeper) HashPayoutForNode added in v0.11.0

func (k *Keeper) HashPayoutForNode(ctx sdk.Context, addr hubtypes.NodeAddress, id uint64) bool

func (*Keeper) HashSubscriptionForNode added in v0.11.0

func (k *Keeper) HashSubscriptionForNode(ctx sdk.Context, addr hubtypes.NodeAddress, id uint64) bool

func (*Keeper) HashSubscriptionForPlan added in v0.11.0

func (k *Keeper) HashSubscriptionForPlan(ctx sdk.Context, planID, subscriptionID uint64) bool

func (*Keeper) IterateAllocationsForSubscription added in v0.11.0

func (k *Keeper) IterateAllocationsForSubscription(ctx sdk.Context, id uint64, fn func(index int, item types.Allocation) (stop bool))

func (*Keeper) IteratePayouts added in v0.11.0

func (k *Keeper) IteratePayouts(ctx sdk.Context, fn func(index int, item types.Payout) (stop bool))

func (*Keeper) IteratePayoutsForNextAt added in v0.11.0

func (k *Keeper) IteratePayoutsForNextAt(ctx sdk.Context, at time.Time, fn func(index int, item types.Payout) (stop bool))

func (*Keeper) IterateSubscriptions added in v0.11.0

func (k *Keeper) IterateSubscriptions(ctx sdk.Context, fn func(index int, item types.Subscription) (stop bool))

func (*Keeper) IterateSubscriptionsForInactiveAt added in v0.11.0

func (k *Keeper) IterateSubscriptionsForInactiveAt(ctx sdk.Context, endTime time.Time, fn func(index int, item types.Subscription) (stop bool))

func (*Keeper) Logger

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

func (*Keeper) SendCoin

func (k *Keeper) SendCoin(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, coin sdk.Coin) error

func (*Keeper) SendCoinFromAccountToModule added in v0.10.0

func (k *Keeper) SendCoinFromAccountToModule(ctx sdk.Context, from sdk.AccAddress, to string, coin sdk.Coin) error

func (*Keeper) SendCoinFromDepositToAccount added in v0.11.0

func (k *Keeper) SendCoinFromDepositToAccount(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, coin sdk.Coin) error

func (*Keeper) SendCoinFromDepositToModule added in v0.11.0

func (k *Keeper) SendCoinFromDepositToModule(ctx sdk.Context, fromAddr sdk.AccAddress, toModule string, coin sdk.Coin) error

func (*Keeper) SessionInactiveHook added in v0.11.0

func (k *Keeper) SessionInactiveHook(ctx sdk.Context, id uint64, accAddr sdk.AccAddress, nodeAddr hubtypes.NodeAddress, utilisedBytes sdk.Int) error

SessionInactiveHook is a function that handles the end of a session. It updates the allocation's utilized bytes, calculates and sends payments, and staking rewards.

func (*Keeper) SetAllocation added in v0.11.0

func (k *Keeper) SetAllocation(ctx sdk.Context, alloc types.Allocation)

func (*Keeper) SetCount added in v0.4.0

func (k *Keeper) SetCount(ctx sdk.Context, count uint64)

func (*Keeper) SetParams

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

func (*Keeper) SetPayout added in v0.11.0

func (k *Keeper) SetPayout(ctx sdk.Context, payout types.Payout)

func (*Keeper) SetPayoutForAccount added in v0.11.0

func (k *Keeper) SetPayoutForAccount(ctx sdk.Context, addr sdk.AccAddress, id uint64)

func (*Keeper) SetPayoutForAccountByNode added in v0.11.0

func (k *Keeper) SetPayoutForAccountByNode(ctx sdk.Context, accAddr sdk.AccAddress, nodeAddr hubtypes.NodeAddress, id uint64)

func (*Keeper) SetPayoutForNextAt added in v0.11.0

func (k *Keeper) SetPayoutForNextAt(ctx sdk.Context, at time.Time, id uint64)

func (*Keeper) SetPayoutForNode added in v0.11.0

func (k *Keeper) SetPayoutForNode(ctx sdk.Context, addr hubtypes.NodeAddress, id uint64)

func (*Keeper) SetSubscription

func (k *Keeper) SetSubscription(ctx sdk.Context, subscription types.Subscription)

func (*Keeper) SetSubscriptionForAccount added in v0.11.0

func (k *Keeper) SetSubscriptionForAccount(ctx sdk.Context, addr sdk.AccAddress, id uint64)

func (*Keeper) SetSubscriptionForInactiveAt added in v0.11.0

func (k *Keeper) SetSubscriptionForInactiveAt(ctx sdk.Context, at time.Time, id uint64)

func (*Keeper) SetSubscriptionForNode

func (k *Keeper) SetSubscriptionForNode(ctx sdk.Context, addr hubtypes.NodeAddress, id uint64)

func (*Keeper) SetSubscriptionForPlan

func (k *Keeper) SetSubscriptionForPlan(ctx sdk.Context, planID, subscriptionID uint64)

func (*Keeper) StatusChangeDelay added in v0.11.0

func (k *Keeper) StatusChangeDelay(ctx sdk.Context) (duration time.Duration)

func (*Keeper) Store

func (k *Keeper) Store(ctx sdk.Context) sdk.KVStore

func (*Keeper) SubscriptionInactivePendingHook added in v0.11.0

func (k *Keeper) SubscriptionInactivePendingHook(ctx sdk.Context, id uint64) error

func (*Keeper) SubtractDeposit

func (k *Keeper) SubtractDeposit(ctx sdk.Context, addr sdk.AccAddress, coin sdk.Coin) error

func (*Keeper) WithBankKeeper

func (k *Keeper) WithBankKeeper(keeper expected.BankKeeper)

func (*Keeper) WithDepositKeeper

func (k *Keeper) WithDepositKeeper(keeper expected.DepositKeeper)

func (*Keeper) WithNodeKeeper

func (k *Keeper) WithNodeKeeper(keeper expected.NodeKeeper)

func (*Keeper) WithPlanKeeper

func (k *Keeper) WithPlanKeeper(keeper expected.PlanKeeper)

func (*Keeper) WithProviderKeeper added in v0.10.0

func (k *Keeper) WithProviderKeeper(keeper expected.ProviderKeeper)

func (*Keeper) WithSessionKeeper added in v0.8.0

func (k *Keeper) WithSessionKeeper(keeper expected.SessionKeeper)

type Migrator added in v0.9.0

type Migrator struct {
	Keeper
}

func NewMigrator added in v0.9.0

func NewMigrator(k Keeper) Migrator

func (Migrator) Migrate2to3 added in v0.11.0

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

Jump to

Keyboard shortcuts

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