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) AfterDelegationModified(ctx sdk.Context, delegator, provider string, amount sdk.Coin, ...) (err error)
- func (k Keeper) BalanceDelegator(ctx sdk.Context, delegator sdk.AccAddress) (int, error)
- func (k Keeper) BalanceValidatorsDelegators(ctx sdk.Context, validator string)
- func (k Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)
- func (k Keeper) CalcDelegatorReward(ctx sdk.Context, delegatorsReward sdk.Coins, totalDelegations math.Int, ...) sdk.Coins
- func (k Keeper) CalcRewards(ctx sdk.Context, totalReward sdk.Coins, totalDelegations math.Int, ...) (providerReward sdk.Coins, delegatorsReward sdk.Coins)
- func (k Keeper) ChangeDelegationTimestampForTesting(ctx sdk.Context, provider, delegator string, timestamp int64) error
- func (k Keeper) ClaimRewards(ctx sdk.Context, delegator string, provider string) (sdk.Coins, error)
- func (k Keeper) Delegate(ctx sdk.Context, delegator, provider string, amount sdk.Coin, stake bool) 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) DelegatorRewardsList(goCtx context.Context, req *types.QueryDelegatorRewardsRequest) (res *types.QueryDelegatorRewardsResponse, err error)
- func (k Keeper) GetAllDelegations(ctx sdk.Context) ([]types.Delegation, error)
- func (k Keeper) GetAllDelegatorReward(ctx sdk.Context) (list []types.DelegatorReward)
- func (k Keeper) GetDelegation(ctx sdk.Context, provider, delegator string) (types.Delegation, bool)
- func (k Keeper) GetDelegatorProviders(ctx sdk.Context, delegator string) (providers []string, err error)
- func (k Keeper) GetDelegatorReward(ctx sdk.Context, provider, delegator string) (val types.DelegatorReward, found bool)
- func (k Keeper) GetDisableDualstakingHook(ctx sdk.Context) bool
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetProviderDelegators(ctx sdk.Context, provider string) ([]types.Delegation, error)
- func (k Keeper) GetSlashedValidators(ctx sdk.Context) []string
- func (k Keeper) HandleSlashedValidators(ctx sdk.Context)
- func (k Keeper) Hooks() *Hooks
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MinSelfDelegation(ctx sdk.Context) (res sdk.Coin)
- 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 string, amount sdk.Coin, stake bool) error
- func (k Keeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation) error
- func (k Keeper) RemoveDelegatorReward(ctx sdk.Context, provider, delegator string)
- func (k Keeper) RewardProvidersAndDelegators(ctx sdk.Context, provider string, chainID string, totalReward sdk.Coins, ...) (providerReward sdk.Coins, err error)
- func (k Keeper) SetDelegation(ctx sdk.Context, delegation types.Delegation) error
- func (k Keeper) SetDelegatorReward(ctx sdk.Context, delegatorReward types.DelegatorReward)
- func (k Keeper) SetDisableDualstakingHook(ctx sdk.Context, val bool)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetSlashedValidators(ctx sdk.Context, val []string)
- 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, int, error)
- type Migrator
Constants ¶
const PROVIDERS_NUM_GAS_REFUND = 50
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 ¶
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) AfterDelegationModified ¶ added in v3.2.0
func (k Keeper) AfterDelegationModified(ctx sdk.Context, delegator, provider string, amount sdk.Coin, increase, stake bool) (err error)
this method is called after a delegation is called and redistributes the delegations among the stake entries of the provider. 'stake' arg needs to be true if the code reached here from pairing stake/unstake tx (this means the 'stake' field is already set)
func (Keeper) BalanceDelegator ¶
func (Keeper) BalanceValidatorsDelegators ¶
func (Keeper) BeginBlock ¶
func (k Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)
func (Keeper) CalcDelegatorReward ¶
func (k Keeper) CalcDelegatorReward(ctx sdk.Context, delegatorsReward sdk.Coins, totalDelegations math.Int, delegation types.Delegation) sdk.Coins
CalcDelegatorReward calculates a single delegator reward according to its delegation delegatorReward = delegatorsReward * (delegatorStake / totalDelegations) = (delegatorsReward * delegatorStake) / totalDelegations
func (Keeper) CalcRewards ¶
func (k Keeper) CalcRewards(ctx sdk.Context, totalReward sdk.Coins, totalDelegations math.Int, selfDelegation types.Delegation, delegations []types.Delegation, commission uint64) (providerReward sdk.Coins, delegatorsReward sdk.Coins)
CalcRewards calculates the provider reward and the total reward for delegators providerReward = totalReward * ((effectiveDelegations*commission + providerStake) / effectiveStake) delegatorsReward = totalReward - providerReward
func (Keeper) ChangeDelegationTimestampForTesting ¶
func (Keeper) ClaimRewards ¶
func (Keeper) Delegate ¶ added in v3.2.0
func (k Keeper) Delegate(ctx sdk.Context, delegator, provider string, amount sdk.Coin, stake bool) error
Delegate lets a delegator Delegate an amount of coins to a provider.
func (Keeper) DelegateFull ¶
func (k Keeper) DelegateFull(ctx sdk.Context, delegator string, validator string, provider string, amount sdk.Coin, stake bool) 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) DelegatorRewardsList ¶
func (k Keeper) DelegatorRewardsList(goCtx context.Context, req *types.QueryDelegatorRewardsRequest) (res *types.QueryDelegatorRewardsResponse, err error)
func (Keeper) GetAllDelegations ¶ added in v3.2.0
func (Keeper) GetAllDelegatorReward ¶
func (k Keeper) GetAllDelegatorReward(ctx sdk.Context) (list []types.DelegatorReward)
GetAllDelegatorReward returns all DelegatorReward
func (Keeper) GetDelegation ¶
func (Keeper) GetDelegatorProviders ¶
func (k Keeper) GetDelegatorProviders(ctx sdk.Context, delegator string) (providers []string, err error)
GetDelegatorProviders gets all the providers the delegator is delegated to
func (Keeper) GetDelegatorReward ¶
func (k Keeper) GetDelegatorReward(ctx sdk.Context, provider, delegator string) (val types.DelegatorReward, found bool)
GetDelegatorReward returns a DelegatorReward from its index
func (Keeper) GetDisableDualstakingHook ¶
GetDisableDualstakingHook returns disableDualstakingHook
func (Keeper) GetProviderDelegators ¶
func (Keeper) GetSlashedValidators ¶
GetDisableDualstakingHook returns disableDualstakingHook
func (Keeper) HandleSlashedValidators ¶
balance delegators dualstaking after potential validators slashing
func (Keeper) MinSelfDelegation ¶
MinSelfDelegation returns the MinSelfDelegation param
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 string, amount sdk.Coin, stake 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) RemoveDelegation ¶ added in v3.2.0
func (Keeper) RemoveDelegatorReward ¶
RemoveDelegatorReward removes a DelegatorReward from the store
func (Keeper) RewardProvidersAndDelegators ¶
func (k Keeper) RewardProvidersAndDelegators(ctx sdk.Context, provider string, chainID string, totalReward sdk.Coins, senderModule string, calcOnlyProvider bool, calcOnlyDelegators bool, calcOnlyContributor bool) (providerReward sdk.Coins, 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 since this function does not actually send rewards to the providers and delegator (but only allocates rewards to be claimed)
func (Keeper) SetDelegation ¶ added in v3.2.0
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) SetDisableDualstakingHook ¶
SetDisableDualstakingHook set disableDualstakingHook in the store
func (Keeper) SetSlashedValidators ¶
SetDisableDualstakingHook set disableDualstakingHook in the store
func (Keeper) UnbondFull ¶
func (k Keeper) UnbondFull(ctx sdk.Context, delegator string, validator string, provider string, amount sdk.Coin, stake bool) error
UnbondFul uses staking module for to unbond with hooks
func (Keeper) UnbondUniformProviders ¶
Source Files ¶
- balance.go
- 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
- slashing.go