Documentation ¶
Index ¶
- Constants
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Hooks
- func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterUnbondingInitiated(_ sdk.Context, _ uint64) error
- func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress) error
- func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error
- type Keeper
- 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) 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) DelegateFull(ctx sdk.Context, delegator string, validator string, provider string, ...) 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) fixationtypes.GenesisState
- func (k Keeper) ExportDelegators(ctx sdk.Context) fixationtypes.GenesisState
- func (k Keeper) GetAllDelegatorReward(ctx sdk.Context) (list []types.DelegatorReward)
- func (k Keeper) GetAllProviderDelegatorDelegations(ctx sdk.Context, delegator, provider string, epoch uint64) []types.Delegation
- func (k Keeper) GetDelegation(ctx sdk.Context, delegator, provider, chainID string, epoch uint64) (types.Delegation, bool)
- 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) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetProviderDelegators(ctx sdk.Context, provider string, epoch uint64) ([]types.Delegation, error)
- func (k Keeper) Hooks() *Hooks
- func (k Keeper) InitDelegations(ctx sdk.Context, data fixationtypes.GenesisState)
- func (k Keeper) InitDelegators(ctx sdk.Context, data fixationtypes.GenesisState)
- 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) PayContributors(ctx sdk.Context, senderModule string, contributorAddresses []sdk.AccAddress, ...) 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) RewardProvidersAndDelegators(ctx sdk.Context, providerAddr sdk.AccAddress, chainID string, ...) (providerReward math.Int, err error)
- func (k Keeper) SetDelegatorReward(ctx sdk.Context, delegatorReward types.DelegatorReward)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) UnbondFull(ctx sdk.Context, delegator string, validator string, provider string, ...) error
- func (k Keeper) UnbondUniformProviders(ctx sdk.Context, delegator string, amount sdk.Coin) error
- func (k Keeper) VerifyDelegatorBalance(ctx sdk.Context, delAddr sdk.AccAddress) (math.Int, error)
- type Migrator
- func (m Migrator) ConvertProviderStakeToSelfDelegation(ctx sdk.Context) error
- func (m Migrator) HandleProviderDelegators(ctx sdk.Context) error
- func (m Migrator) HandleValidatorsDelegators(ctx sdk.Context) error
- func (m Migrator) MigrateVersion1To2(ctx sdk.Context) error
- func (m Migrator) MigrateVersion2To3(ctx sdk.Context) error
- func (m Migrator) VerifyDelegationsBalance(ctx sdk.Context) error
Constants ¶
const ( EMPTY_PROVIDER = "empty_provider" EMPTY_PROVIDER_CHAINID = "" )
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Wrapper struct
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
create new delegation period record add description
func (Hooks) AfterUnbondingInitiated ¶
func (Hooks) AfterValidatorBeginUnbonding ¶
func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
func (Hooks) AfterValidatorCreated ¶
initialize validator distribution record
func (Hooks) AfterValidatorRemoved ¶
func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error
AfterValidatorRemoved performs clean up after a validator is removed
func (Hooks) BeforeDelegationCreated ¶
func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
increment period
func (Hooks) BeforeDelegationRemoved ¶
func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
withdraw delegation rewards (which also increments period)
func (Hooks) BeforeValidatorModified ¶
func (Hooks) BeforeValidatorSlashed ¶
func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error
BeforeValidatorSlashed hook unbonds funds from providers so the providers-validators delegations balance will preserve
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, stakingKeeper types.StakingKeeper, accountKeeper types.AccountKeeper, epochstorageKeeper types.EpochstorageKeeper, specKeeper types.SpecKeeper, fixationStoreKeeper types.FixationStoreKeeper, ) *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 (Keeper) DelegateFull ¶
func (k Keeper) DelegateFull(ctx sdk.Context, delegator string, validator string, provider string, chainID string, amount sdk.Coin) error
DelegateFull uses staking module for to delegate with hooks
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) 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) GetAllDelegatorReward ¶
func (k Keeper) GetAllDelegatorReward(ctx sdk.Context) (list []types.DelegatorReward)
GetAllDelegatorReward returns all DelegatorReward
func (Keeper) GetAllProviderDelegatorDelegations ¶
func (Keeper) GetDelegation ¶
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) GetProviderDelegators ¶
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) Params ¶
func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) PayContributors ¶
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, unstake bool) 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) 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) UnbondFull ¶
func (k Keeper) UnbondFull(ctx sdk.Context, delegator string, validator string, provider string, chainID string, amount sdk.Coin, unstake bool) error
UnbondFul uses staking module for to unbond with hooks
func (Keeper) UnbondUniformProviders ¶
func (Keeper) VerifyDelegatorBalance ¶
returns the difference between validators delegations and provider delegation (validators-providers)
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
func NewMigrator ¶
func (Migrator) ConvertProviderStakeToSelfDelegation ¶
ConvertProviderStakeToSelfDelegation does: 1. zero out each provider stake and return their money 2. use that same money to make the providers self delegate
func (Migrator) HandleProviderDelegators ¶
HandleProviderDelegators does: 1. merge the deprecated bonded and not-bonded pool funds 2. return the providers' delegators money back from the merged pool 3. use the same money to delegate to both the original delegation's provider and highest staked validator
func (Migrator) HandleValidatorsDelegators ¶
HandleValidatorsDelegators does: 1. get each validator's delegators 2. delegate the amount of their delegation to the empty provider (using the AfterDelegationModified hook)
func (Migrator) MigrateVersion1To2 ¶
MigrateVersion1To2 implements store migration: Create a self delegation for all providers
func (Migrator) MigrateVersion2To3 ¶
MigrateVersion2To3 implements store migration: Make providers-validators delegations balance
Source Files ¶
- delegate.go
- delegator_reward.go
- grpc_query_delegator_providers.go
- grpc_query_delegator_rewards.go
- grpc_query_provider_delegators.go
- hooks.go
- keeper.go
- migrations.go
- msg_server.go
- msg_server_claim_rewards.go
- msg_server_delegate.go
- msg_server_redelegate.go
- msg_server_unbond.go
- params.go
- query.go
- query_params.go