keeper

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

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,
	memKey storetypes.StoreKey,
	ps paramtypes.Subspace,
	bankKeeper types.BankKeeper,
	accountKeeper types.AccountKeeper,
	epochstorageKeeper types.EpochstorageKeeper,
	specKeeper types.SpecKeeper,
	fixationStoreKeeper types.FixationStoreKeeper,
	timerStoreKeeper types.TimerStoreKeeper,
) *Keeper

func (Keeper) CalcDelegatorReward

func (k Keeper) CalcDelegatorReward(delegatorsReward math.Int, totalDelegations math.Int, delegation types.Delegation) math.Int

CalcDelegatorReward calculates a single delegator reward according to its delegation delegatorReward = delegatorsReward * (delegatorStake / totalDelegations) = (delegatorsReward * delegatorStake) / totalDelegations

func (Keeper) CalcEffectiveDelegationsAndStake

func (k Keeper) CalcEffectiveDelegationsAndStake(stakeEntry epochstoragetypes.StakeEntry) (effectiveDelegations math.Int, effectiveStake math.Int)

CalcEffectiveDelegationsAndStake calculates the effective stake and effective delegations (for delegator rewards calculations) effectiveDelegations = min(totalDelegations, delegateLimit) effectiveStake = effectiveDelegations + providerStake

func (Keeper) CalcRewards

func (k Keeper) CalcRewards(stakeEntry epochstoragetypes.StakeEntry, totalReward math.Int) (providerReward math.Int, delegatorsReward math.Int)

CalcRewards calculates the provider reward and the total reward for delegators providerReward = totalReward * ((effectiveDelegations*commission + providerStake) / effectiveStake) delegatorsReward = totalReward - providerReward

func (Keeper) ClaimRewards

func (k Keeper) ClaimRewards(ctx sdk.Context, delegator string, provider string) error

func (Keeper) Delegate added in v0.22.1

func (k Keeper) Delegate(ctx sdk.Context, delegator, provider, chainID string, amount sdk.Coin) error

Delegate lets a delegator delegate an amount of coins to a provider. (effective on next epoch)

func (Keeper) DelegatorProviders

func (Keeper) DelegatorRewards

func (Keeper) ExportDelegations

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

ExportDelegations exports dualstaking delegations data (for genesis)

func (Keeper) ExportDelegators

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

ExportDelegators exports dualstaking delegators data (for genesis)

func (Keeper) ExportUnbondings added in v0.22.1

func (k Keeper) ExportUnbondings(ctx sdk.Context) []fixationtypes.RawMessage

ExportUnbondings exports dualstaking unbonding timers data (for genesis)

func (Keeper) GetAllDelegatorReward

func (k Keeper) GetAllDelegatorReward(ctx sdk.Context) (list []types.DelegatorReward)

GetAllDelegatorReward returns all DelegatorReward

func (Keeper) GetBondedPool added in v0.22.1

func (k Keeper) GetBondedPool(ctx sdk.Context) (bondedPool authtypes.ModuleAccountI)

GetBondedPool returns the bonded tokens pool's module account

func (Keeper) GetDelegatorProviders

func (k Keeper) GetDelegatorProviders(ctx sdk.Context, delegator string, epoch uint64) (providers []string, err error)

GetDelegatorProviders gets all the providers the delegator is delegated to

func (Keeper) GetDelegatorReward

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

GetDelegatorReward returns a DelegatorReward from its index

func (Keeper) GetNotBondedPool added in v0.22.1

func (k Keeper) GetNotBondedPool(ctx sdk.Context) (notBondedPool authtypes.ModuleAccountI)

GetNotBondedPool returns the not bonded tokens pool's module account

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetProviderDelegators

func (k Keeper) GetProviderDelegators(ctx sdk.Context, provider string, epoch uint64) ([]types.Delegation, error)

func (Keeper) InitDelegations

func (k Keeper) InitDelegations(ctx sdk.Context, data fixationtypes.GenesisState)

InitDelegations imports dualstaking delegations data (from genesis)

func (Keeper) InitDelegators

func (k Keeper) InitDelegators(ctx sdk.Context, data fixationtypes.GenesisState)

InitDelegators imports dualstaking delegators data (from genesis)

func (Keeper) InitUnbondings added in v0.22.1

func (k Keeper) InitUnbondings(ctx sdk.Context, data []fixationtypes.RawMessage)

InitUnbondings imports subscriptions timers data (from genesis)

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) ProviderDelegators

func (Keeper) Redelegate

func (k Keeper) Redelegate(ctx sdk.Context, delegator, from, to, fromChainID, toChainID string, amount sdk.Coin) error

Redelegate lets a delegator transfer its delegation between providers, but without the funds being subject to unstakeHoldBlocks witholding period. (effective on next epoch)

func (Keeper) RemoveDelegatorReward

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

RemoveDelegatorReward removes a DelegatorReward from the store

func (Keeper) RewardProvidersAndDelegators

func (k Keeper) RewardProvidersAndDelegators(ctx sdk.Context, providerAddr sdk.AccAddress, chainID string, totalReward math.Int, senderModule string, calcOnly bool) (providerReward math.Int, err error)

RewardProvidersAndDelegators is the main function handling provider rewards with delegations it returns the provider reward amount and updates the delegatorReward map with the reward portion for each delegator

func (Keeper) SetDelegatorReward

func (k Keeper) SetDelegatorReward(ctx sdk.Context, delegatorReward types.DelegatorReward)

SetDelegatorReward set a specific DelegatorReward in the store from its index

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) TotalBondedTokens added in v0.22.1

func (k Keeper) TotalBondedTokens(ctx sdk.Context) math.Int

totalBondedTokens total staking tokens supply which is bonded

func (Keeper) TotalNotBondedTokens added in v0.22.1

func (k Keeper) TotalNotBondedTokens(ctx sdk.Context) math.Int

totalNotBondedTokens total staking tokens supply which is not bonded

func (Keeper) Unbond added in v0.22.1

func (k Keeper) Unbond(ctx sdk.Context, delegator, provider, chainID string, amount sdk.Coin) error

Unbond lets a delegator get its delegated coins back from a provider. The delegation ends immediately, but coins are held for unstakeHoldBlocks period before released and transferred back to the delegator. The rewards from the provider will be updated accordingly (or terminate) from the next epoch. (effective on next epoch)

Jump to

Keyboard shortcuts

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