keeper

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

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 storetypes.StoreKey,
	memKey storetypes.StoreKey,

	authority string,

	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	distrkeeper types.DistrKeeper,
	poolKeeper types.PoolKeeper,
	upgradeKeeper types.UpgradeKeeper,
	stakersKeeper types.StakersKeeper,
) *Keeper

func (Keeper) AddAmountToDelegationRewards

func (k Keeper) AddAmountToDelegationRewards(ctx sdk.Context, stakerAddress string, amount uint64)

AddAmountToDelegationRewards adds the specified amount to the current delegationData object. This is needed by the F1-algorithm to calculate to outstanding rewards

func (Keeper) DoesDelegationDataExist

func (k Keeper) DoesDelegationDataExist(ctx sdk.Context, stakerAddress string) bool

DoesDelegationDataExist check if the staker with `stakerAddress` has a delegation data entry. This is the case if the staker as at least one delegator.

func (Keeper) DoesDelegatorExist

func (k Keeper) DoesDelegatorExist(
	ctx sdk.Context,
	stakerAddress string,
	delegatorAddress string,
) bool

DoesDelegatorExist checks if the key exists in the KV-store

func (Keeper) GetAllDelegationData

func (k Keeper) GetAllDelegationData(ctx sdk.Context) (list []types.DelegationData)

GetAllDelegationData returns all delegationData entries

func (Keeper) GetAllDelegationEntries

func (k Keeper) GetAllDelegationEntries(ctx sdk.Context) (list []types.DelegationEntry)

GetAllDelegationEntries returns all delegationEntries (of all stakers)

func (Keeper) GetAllDelegationSlashEntries

func (k Keeper) GetAllDelegationSlashEntries(ctx sdk.Context) (list []types.DelegationSlash)

GetAllDelegationSlashEntries returns all delegation slash entries (of all stakers)

func (Keeper) GetAllDelegationSlashesBetween

func (k Keeper) GetAllDelegationSlashesBetween(ctx sdk.Context, staker string, start uint64, end uint64) (list []types.DelegationSlash)

GetAllDelegationSlashesBetween returns all Slashes that happened between the given periods `start` and `end` are both inclusive.

func (Keeper) GetAllDelegators

func (k Keeper) GetAllDelegators(ctx sdk.Context) (list []types.Delegator)

GetAllDelegators returns all delegators (of all stakers)

func (Keeper) GetAllRedelegationCooldownEntries

func (k Keeper) GetAllRedelegationCooldownEntries(ctx sdk.Context) (list []types.RedelegationCooldown)

GetAllRedelegationCooldownEntries ...

func (Keeper) GetAllUnbondingDelegationQueueEntries

func (k Keeper) GetAllUnbondingDelegationQueueEntries(ctx sdk.Context) (list []types.UndelegationQueueEntry)

GetAllUnbondingDelegationQueueEntries returns all delegator unbondings

func (Keeper) GetAllUnbondingDelegationQueueEntriesOfDelegator

func (k Keeper) GetAllUnbondingDelegationQueueEntriesOfDelegator(ctx sdk.Context, address string) (list []types.UndelegationQueueEntry)

GetAllUnbondingDelegationQueueEntriesOfDelegator returns all delegator unbondings of the given address

func (Keeper) GetDelegationAmount

func (k Keeper) GetDelegationAmount(ctx sdk.Context, staker string) uint64

GetDelegationAmount returns the sum of all delegations for a specific staker. If the staker does not exist, it returns zero as the staker has zero delegations

func (Keeper) GetDelegationAmountOfDelegator

func (k Keeper) GetDelegationAmountOfDelegator(ctx sdk.Context, stakerAddress string, delegatorAddress string) uint64

GetDelegationAmountOfDelegator returns the amount of how many $KYVE `delegatorAddress` has delegated to `stakerAddress`. If one of the addresses does not exist, it returns zero.

func (Keeper) GetDelegationData

func (k Keeper) GetDelegationData(ctx sdk.Context, stakerAddress string) (val types.DelegationData, found bool)

GetDelegationData returns a delegationData entry for a specific staker with `stakerAddress`

func (Keeper) GetDelegationEntry

func (k Keeper) GetDelegationEntry(
	ctx sdk.Context,
	stakerAddress string,
	kIndex uint64,
) (val types.DelegationEntry, found bool)

GetDelegationEntry returns a delegationEntry from its index

func (Keeper) GetDelegationOfPool

func (k Keeper) GetDelegationOfPool(ctx sdk.Context, poolId uint64) uint64

GetDelegationOfPool returns the amount of how many $KYVE users have delegated to stakers that are participating in the given pool

func (Keeper) GetDelegationSlashEntry

func (k Keeper) GetDelegationSlashEntry(
	ctx sdk.Context,
	stakerAddress string,
	kIndex uint64,
) (val types.DelegationSlash, found bool)

GetDelegationSlashEntry returns a DelegationSlash for the given staker and index.

func (Keeper) GetDelegator

func (k Keeper) GetDelegator(
	ctx sdk.Context,
	stakerAddress string,
	delegatorAddress string,
) (val types.Delegator, found bool)

GetDelegator returns a delegator from its index

func (Keeper) GetOutstandingRewards

func (k Keeper) GetOutstandingRewards(ctx sdk.Context, staker string, delegator string) uint64

GetOutstandingRewards calculates the current rewards a delegator has collected for the given staker.

func (Keeper) GetPaginatedActiveStakersByDelegation

func (k Keeper) GetPaginatedActiveStakersByDelegation(ctx sdk.Context, pagination *query.PageRequest, accumulator func(staker string, accumulate bool) bool) (*query.PageResponse, error)

GetPaginatedActiveStakersByDelegation returns all active stakers sorted by its current total delegation. It supports the cosmos query.PageRequest pagination.

func (Keeper) GetPaginatedActiveStakersByPoolCountAndDelegation

func (k Keeper) GetPaginatedActiveStakersByPoolCountAndDelegation(ctx sdk.Context, pagination *query.PageRequest) ([]string, *query.PageResponse, error)

GetPaginatedActiveStakersByPoolCountAndDelegation returns all active stakers sorted by the amount of pools they are participating. If the poolCount is equal they are sorted by current total delegation. It supports the cosmos query.PageRequest pagination.

func (Keeper) GetPaginatedInactiveStakersByDelegation

func (k Keeper) GetPaginatedInactiveStakersByDelegation(ctx sdk.Context, pagination *query.PageRequest, accumulator func(staker string, accumulate bool) bool) (*query.PageResponse, error)

GetPaginatedInactiveStakersByDelegation returns all inactive stakers sorted by its current total delegation. It supports the cosmos query.PageRequest pagination.

func (Keeper) GetPaginatedStakersByDelegation

func (k Keeper) GetPaginatedStakersByDelegation(ctx sdk.Context, pagination *query.PageRequest, accumulator func(staker string, accumulate bool) bool) (*query.PageResponse, error)

GetPaginatedStakersByDelegation returns all stakers (active and inactive) sorted by its current total delegation. It supports the cosmos query.PageRequest pagination.

func (Keeper) GetParams

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

GetParams returns the current x/delegation module parameters.

func (Keeper) GetQueueState

func (k Keeper) GetQueueState(ctx sdk.Context) (state types.QueueState)

GetQueueState returns the state for the undelegation queue

func (Keeper) GetRedelegationCooldown

func (k Keeper) GetRedelegationCooldown(ctx sdk.Context) (res uint64)

GetRedelegationCooldown returns the RedelegationCooldown param

func (Keeper) GetRedelegationCooldownEntries

func (k Keeper) GetRedelegationCooldownEntries(ctx sdk.Context, delegatorAddress string) (creationDates []uint64)

GetRedelegationCooldownEntries ...

func (Keeper) GetRedelegationMaxAmount

func (k Keeper) GetRedelegationMaxAmount(ctx sdk.Context) (res uint64)

GetRedelegationMaxAmount returns the RedelegationMaxAmount param

func (Keeper) GetStakersByDelegator

func (k Keeper) GetStakersByDelegator(ctx sdk.Context, delegator string) (list []string)

func (Keeper) GetTimeoutSlash

func (k Keeper) GetTimeoutSlash(ctx sdk.Context) (res string)

GetTimeoutSlash returns the TimeoutSlash param

func (Keeper) GetUnbondingDelegationTime

func (k Keeper) GetUnbondingDelegationTime(ctx sdk.Context) (res uint64)

GetUnbondingDelegationTime returns the UnbondingDelegationTime param

func (Keeper) GetUndelegationQueueEntry

func (k Keeper) GetUndelegationQueueEntry(ctx sdk.Context, index uint64) (val types.UndelegationQueueEntry, found bool)

GetUndelegationQueueEntry ...

func (Keeper) GetUploadSlash

func (k Keeper) GetUploadSlash(ctx sdk.Context) (res string)

GetUploadSlash returns the UploadSlash param

func (Keeper) GetVoteSlash

func (k Keeper) GetVoteSlash(ctx sdk.Context) (res string)

GetVoteSlash returns the VoteSlash param

func (Keeper) InitMemStore

func (k Keeper) InitMemStore(gasCtx sdk.Context)

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) PayoutRewards

func (k Keeper) PayoutRewards(ctx sdk.Context, staker string, amount uint64, payerModuleName string) (success bool)

PayoutRewards transfers `amount` $nKYVE from the `payerModuleName`-module to the delegation module. It then awards these tokens internally to all delegators of staker `staker`. Delegators can then receive these rewards if they call the `withdraw`-transaction. This method returns false if the payout fails. This happens usually if there are no delegators for that staker. If this happens one should do something else with the rewards.

func (Keeper) ProcessDelegatorUnbondingQueue

func (k Keeper) ProcessDelegatorUnbondingQueue(ctx sdk.Context)

ProcessDelegatorUnbondingQueue is called in the end block and checks the queue for entries that have surpassed the unbonding time. If the unbonding time is reached, the actual unbonding is performed and the entry is removed from the queue.

func (Keeper) RemoveDelegationData

func (k Keeper) RemoveDelegationData(ctx sdk.Context, stakerAddress string)

RemoveDelegationData removes a delegationData entry from the pool

func (Keeper) RemoveDelegationEntry

func (k Keeper) RemoveDelegationEntry(
	ctx sdk.Context,
	stakerAddress string,
	kIndex uint64,
)

RemoveDelegationEntry removes a delegationEntry for the given staker with the given index from the store

func (Keeper) RemoveDelegationSlashEntry

func (k Keeper) RemoveDelegationSlashEntry(
	ctx sdk.Context,
	stakerAddress string,
	kIndex uint64,
)

RemoveDelegationSlashEntry removes an entry for a given staker and index

func (Keeper) RemoveDelegator

func (k Keeper) RemoveDelegator(
	ctx sdk.Context,
	stakerAddress string,
	delegatorAddress string,
)

RemoveDelegator removes a delegator from the store

func (Keeper) RemoveRedelegationCooldown

func (k Keeper) RemoveRedelegationCooldown(ctx sdk.Context, delegatorAddress string, block uint64)

RemoveRedelegationCooldown ...

func (Keeper) RemoveStakerIndex

func (k Keeper) RemoveStakerIndex(ctx sdk.Context, staker string)

RemoveStakerIndex deletes and Index-entry which sorts all stakers (active and passive) by its total delegation

func (Keeper) RemoveUndelegationQueueEntry

func (k Keeper) RemoveUndelegationQueueEntry(ctx sdk.Context, undelegationQueueEntry *types.UndelegationQueueEntry)

RemoveUndelegationQueueEntry ...

func (Keeper) SetDelegationData

func (k Keeper) SetDelegationData(ctx sdk.Context, delegationData types.DelegationData)

SetDelegationData set a specific delegationPoolData in the store from its index

func (Keeper) SetDelegationEntry

func (k Keeper) SetDelegationEntry(ctx sdk.Context, delegationEntries types.DelegationEntry)

SetDelegationEntry set a specific delegationEntry in the store for the staker and a given index

func (Keeper) SetDelegationSlashEntry

func (k Keeper) SetDelegationSlashEntry(ctx sdk.Context, slashEntry types.DelegationSlash)

SetDelegationSlashEntry for the affected staker with the index of the period the slash is starting.

func (Keeper) SetDelegator

func (k Keeper) SetDelegator(ctx sdk.Context, delegator types.Delegator)

SetDelegator set a specific delegator in the store from its index

func (Keeper) SetParams

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

SetParams sets the x/delegation module parameters.

func (Keeper) SetQueueState

func (k Keeper) SetQueueState(ctx sdk.Context, state types.QueueState)

SetQueueState saves the undelegation queue state

func (Keeper) SetRedelegationCooldown

func (k Keeper) SetRedelegationCooldown(ctx sdk.Context, redelegationCooldown types.RedelegationCooldown)

SetRedelegationCooldown ...

func (Keeper) SetStakerIndex

func (k Keeper) SetStakerIndex(ctx sdk.Context, staker string)

SetStakerIndex sets and Index-entry which sorts all stakers (active and passive) by its total delegation

func (Keeper) SetUndelegationQueueEntry

func (k Keeper) SetUndelegationQueueEntry(ctx sdk.Context, undelegationQueueEntry types.UndelegationQueueEntry)

SetUndelegationQueueEntry ...

func (Keeper) SlashDelegators

func (k Keeper) SlashDelegators(ctx sdk.Context, poolId uint64, staker string, slashType types.SlashType)

SlashDelegators reduces the delegation of all delegators of `staker` by fraction and transfers the amount to the Treasury.

func (Keeper) StartUnbondingDelegator

func (k Keeper) StartUnbondingDelegator(ctx sdk.Context, staker string, delegatorAddress string, amount uint64)

StartUnbondingDelegator creates a queue entry to schedule the unbonding. After the DelegationTime is reached the actual unbonding will be performed The actual unbonding is then performed by `func ProcessDelegatorUnbondingQueue(...)`

func (Keeper) StoreKey

func (k Keeper) StoreKey() storetypes.StoreKey

Jump to

Keyboard shortcuts

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