Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) BeginBlock(ctx sdk.Context)
- func (k Keeper) CalcDelegatorReward(delegatorsReward math.Int, totalDelegations math.Int, ...) math.Int
- func (k Keeper) CalcEffectiveDelegationsAndStake(stakeEntry epochstoragetypes.StakeEntry) (effectiveDelegations math.Int, effectiveStake math.Int)
- func (k Keeper) CalcProviderRewardWithDelegations(ctx sdk.Context, providerAddr sdk.AccAddress, chainID string, block uint64, ...) (providerReward math.Int, err error)
- func (k Keeper) CalcRewards(stakeEntry epochstoragetypes.StakeEntry, totalReward math.Int) (providerReward math.Int, delegatorsReward math.Int)
- func (k Keeper) ClaimRewards(ctx sdk.Context, delegator string, provider string) error
- func (k Keeper) Delegate(ctx sdk.Context, delegator, provider, chainID string, amount sdk.Coin) error
- func (k Keeper) DelegatorProviders(goCtx context.Context, req *types.QueryDelegatorProvidersRequest) (res *types.QueryDelegatorProvidersResponse, err error)
- func (k Keeper) DelegatorRewards(goCtx context.Context, req *types.QueryDelegatorRewardsRequest) (res *types.QueryDelegatorRewardsResponse, err error)
- func (k Keeper) ExportDelegations(ctx sdk.Context) commontypes.GenesisState
- func (k Keeper) ExportDelegators(ctx sdk.Context) commontypes.GenesisState
- func (k Keeper) ExportUnbondings(ctx sdk.Context) []commontypes.RawMessage
- func (k Keeper) GetAllDelegatorReward(ctx sdk.Context) (list []types.DelegatorReward)
- func (k Keeper) GetBondedPool(ctx sdk.Context) (bondedPool authtypes.ModuleAccountI)
- func (k Keeper) GetDelegatorProviders(ctx sdk.Context, delegator string, epoch uint64) (providers []string, err error)
- func (k Keeper) GetDelegatorReward(ctx sdk.Context, index string) (val types.DelegatorReward, found bool)
- func (k Keeper) GetNotBondedPool(ctx sdk.Context) (notBondedPool authtypes.ModuleAccountI)
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetProviderDelegators(ctx sdk.Context, provider string, epoch uint64) ([]types.Delegation, error)
- func (k Keeper) InitDelegations(ctx sdk.Context, data commontypes.GenesisState)
- func (k Keeper) InitDelegators(ctx sdk.Context, data commontypes.GenesisState)
- func (k Keeper) InitUnbondings(ctx sdk.Context, data []commontypes.RawMessage)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) ProviderDelegators(goCtx context.Context, req *types.QueryProviderDelegatorsRequest) (res *types.QueryProviderDelegatorsResponse, err error)
- func (k Keeper) Redelegate(ctx sdk.Context, delegator, from, to, fromChainID, toChainID string, ...) error
- func (k Keeper) RemoveDelegatorReward(ctx sdk.Context, index string)
- func (k Keeper) SetDelegatorReward(ctx sdk.Context, delegatorReward types.DelegatorReward)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) TotalBondedTokens(ctx sdk.Context) math.Int
- func (k Keeper) TotalNotBondedTokens(ctx sdk.Context) math.Int
- func (k Keeper) Unbond(ctx sdk.Context, delegator, provider, chainID string, amount sdk.Coin) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
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, ) *Keeper
func (Keeper) BeginBlock ¶ added in v0.22.1
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) CalcProviderRewardWithDelegations ¶ added in v0.23.6
func (k Keeper) CalcProviderRewardWithDelegations(ctx sdk.Context, providerAddr sdk.AccAddress, chainID string, block uint64, totalReward math.Int) (providerReward math.Int, err error)
CalcProviderRewardWithDelegations 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) 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 (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 (k Keeper) DelegatorProviders(goCtx context.Context, req *types.QueryDelegatorProvidersRequest) (res *types.QueryDelegatorProvidersResponse, err error)
func (Keeper) DelegatorRewards ¶
func (k Keeper) DelegatorRewards(goCtx context.Context, req *types.QueryDelegatorRewardsRequest) (res *types.QueryDelegatorRewardsResponse, err error)
func (Keeper) ExportDelegations ¶
func (k Keeper) ExportDelegations(ctx sdk.Context) commontypes.GenesisState
ExportDelegations exports dualstaking delegations data (for genesis)
func (Keeper) ExportDelegators ¶
func (k Keeper) ExportDelegators(ctx sdk.Context) commontypes.GenesisState
ExportDelegators exports dualstaking delegators data (for genesis)
func (Keeper) ExportUnbondings ¶ added in v0.22.1
func (k Keeper) ExportUnbondings(ctx sdk.Context) []commontypes.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) GetProviderDelegators ¶
func (Keeper) InitDelegations ¶
func (k Keeper) InitDelegations(ctx sdk.Context, data commontypes.GenesisState)
InitDelegations imports dualstaking delegations data (from genesis)
func (Keeper) InitDelegators ¶
func (k Keeper) InitDelegators(ctx sdk.Context, data commontypes.GenesisState)
InitDelegators imports dualstaking delegators data (from genesis)
func (Keeper) InitUnbondings ¶ added in v0.22.1
func (k Keeper) InitUnbondings(ctx sdk.Context, data []commontypes.RawMessage)
InitUnbondings imports subscriptions timers data (from genesis)
func (Keeper) Params ¶
func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) ProviderDelegators ¶
func (k Keeper) ProviderDelegators(goCtx context.Context, req *types.QueryProviderDelegatorsRequest) (res *types.QueryProviderDelegatorsResponse, err error)
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 ¶
RemoveDelegatorReward removes a DelegatorReward from the store
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) TotalBondedTokens ¶ added in v0.22.1
totalBondedTokens total staking tokens supply which is bonded
func (Keeper) TotalNotBondedTokens ¶ added in v0.22.1
totalNotBondedTokens total staking tokens supply which is not bonded
func (Keeper) Unbond ¶ added in v0.22.1
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)