Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQueryServerImpl(keeper Keeper) types.QueryServer
- type Hooks
- func (h Hooks) AfterDelegationModified(ctx context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error
- func (h Hooks) AfterValidatorBeginUnbonding(ctx context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterValidatorBonded(ctx context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterValidatorCreated(_ context.Context, _ sdk.ValAddress) error
- func (h Hooks) AfterValidatorRemoved(ctx context.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) (err error)
- func (h Hooks) AfterValidatorSlashed(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress, _ math.LegacyDec)
- func (h Hooks) BeforeDelegationCreated(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeDelegationRemoved(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeDelegationSharesModified(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeValidatorModified(_ context.Context, _ sdk.ValAddress) error
- func (h Hooks) BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction math.LegacyDec) error
- type Keeper
- func (k Keeper) AddAssetsToRewardPool(ctx context.Context, from sdk.AccAddress, val types.AllianceValidator, ...) error
- func (k Keeper) CalculateDelegationRewards(ctx context.Context, delegation types.Delegation, val types.AllianceValidator, ...) (sdk.Coins, types.RewardHistories, error)
- func (k Keeper) ClaimDelegationRewards(ctx context.Context, delAddr sdk.AccAddress, val types.AllianceValidator, ...) (sdk.Coins, error)
- func (k Keeper) ClaimValidatorRewards(ctx context.Context, val types.AllianceValidator) (sdk.Coins, error)
- func (k Keeper) ClearDustDelegation(ctx context.Context, delAddr sdk.AccAddress, validator types.AllianceValidator, ...) error
- func (k Keeper) CompleteRedelegations(ctx sdk.Context) (deleted int)
- func (k Keeper) CompleteUnbondings(ctx context.Context) error
- func (k Keeper) ConsumeAssetRebalanceEvent(ctx context.Context) bool
- func (k Keeper) CreateAlliance(ctx context.Context, req *types.MsgCreateAllianceProposal) error
- func (k Keeper) DeductAssetsHook(ctx sdk.Context, assets []*types.AllianceAsset) (sdk.Coins, error)
- func (k Keeper) DeductAssetsWithTakeRate(ctx sdk.Context, lastClaim time.Time, assets []*types.AllianceAsset) (sdk.Coins, error)
- func (k Keeper) Delegate(ctx context.Context, delAddr sdk.AccAddress, validator types.AllianceValidator, ...) (*math.LegacyDec, error)
- func (k Keeper) DeleteAlliance(ctx context.Context, req *types.MsgDeleteAllianceProposal) error
- func (k Keeper) DeleteAsset(ctx context.Context, asset types.AllianceAsset) error
- func (k Keeper) DeleteRedelegation(ctx context.Context, redel types.Redelegation, completion time.Time) error
- func (k Keeper) DeleteValidatorInfo(ctx context.Context, valAddr sdk.ValAddress) error
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllAllianceValidatorInfo(ctx context.Context) (infos []types.AllianceValidatorInfo, err error)
- func (k Keeper) GetAllAssets(ctx context.Context) (assets []*types.AllianceAsset)
- func (k Keeper) GetAllianceBondedAmount(ctx context.Context, delegator sdk.AccAddress) (math.Int, error)
- func (k Keeper) GetAllianceValidator(ctx context.Context, valAddr sdk.ValAddress) (types.AllianceValidator, error)
- func (k Keeper) GetAllianceValidatorInfo(ctx context.Context, valAddr sdk.ValAddress) (types.AllianceValidatorInfo, bool)
- func (k Keeper) GetAssetByDenom(ctx context.Context, denom string) (asset types.AllianceAsset, found bool)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ...) (d types.Delegation, found bool)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetUnbondings(ctx sdk.Context, denom string, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (unbondingDelegations []types.UnbondingDelegation, err error)
- func (k Keeper) GetUnbondingsByDelegator(ctx context.Context, delAddr sdk.AccAddress) (unbondingDelegations []types.UnbondingDelegation, err error)
- func (k Keeper) GetUnbondingsByDenomAndDelegator(ctx context.Context, denom string, delAddr sdk.AccAddress) (unbondingDelegations []types.UnbondingDelegation, err error)
- func (k Keeper) HasRedelegation(ctx context.Context, delAddr sdk.AccAddress, dstVal sdk.ValAddress, ...) bool
- func (k Keeper) InitGenesis(ctx sdk.Context, g *types.GenesisState) []abci.ValidatorUpdate
- func (k Keeper) InitializeAllianceAssets(ctx context.Context, assets []*types.AllianceAsset) (err error)
- func (k Keeper) IterateAllWeightChangeSnapshot(ctx sdk.Context, ...)
- func (k Keeper) IterateAllianceValidatorInfo(ctx context.Context, ...) (err error)
- func (k Keeper) IterateDelegations(ctx context.Context, cb func(d types.Delegation) (stop bool)) (err error)
- func (k Keeper) IterateRedelegations(ctx context.Context, ...)
- func (k Keeper) IterateRedelegationsByDelegator(ctx context.Context, delAddr sdk.AccAddress) storetypes.Iterator
- func (k Keeper) IterateRedelegationsBySrcValidator(ctx context.Context, srcValAddr sdk.ValAddress) storetypes.Iterator
- func (k Keeper) IterateUndelegations(ctx context.Context, ...)
- func (k Keeper) IterateUndelegationsByCompletionTime(ctx context.Context, completionTime time.Time) storetypes.Iterator
- func (k Keeper) IterateUndelegationsBySrcValidator(ctx context.Context, valAddr sdk.ValAddress) storetypes.Iterator
- func (k Keeper) IterateWeightChangeSnapshot(ctx context.Context, denom string, valAddr sdk.ValAddress, ...) (cstore.Iterator, error)
- func (k Keeper) LastRewardClaimTime(ctx sdk.Context) (res time.Time)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) QueueAssetRebalanceEvent(ctx context.Context) error
- func (k Keeper) RebalanceBondTokenWeights(ctx context.Context, assets []*types.AllianceAsset) (err error)
- func (k Keeper) RebalanceHook(ctx context.Context, assets []*types.AllianceAsset) error
- func (k Keeper) Redelegate(ctx context.Context, delAddr sdk.AccAddress, srcVal types.AllianceValidator, ...) (*time.Time, error)
- func (k Keeper) ResetAssetAndValidators(ctx context.Context, asset types.AllianceAsset) error
- func (k Keeper) RewardClaimInterval(ctx sdk.Context) (res time.Duration)
- func (k Keeper) RewardDelayTime(ctx sdk.Context) (res time.Duration)
- func (k Keeper) RewardWeightChangeHook(ctx sdk.Context, assets []*types.AllianceAsset) error
- func (k Keeper) SetAsset(ctx context.Context, asset types.AllianceAsset) error
- func (k Keeper) SetDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ...) error
- func (k Keeper) SetLastRewardClaimTime(ctx sdk.Context, lastTime time.Time) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error
- func (k Keeper) SetRewardWeightChangeSnapshot(ctx context.Context, asset types.AllianceAsset, val types.AllianceValidator) error
- func (k Keeper) SetValidator(ctx context.Context, val types.AllianceValidator) error
- func (k Keeper) SetValidatorInfo(ctx context.Context, valAddr sdk.ValAddress, val types.AllianceValidatorInfo) error
- func (k Keeper) SlashValidator(ctx context.Context, valAddr sdk.ValAddress, fraction math.LegacyDec) error
- func (k Keeper) StakingHooks() Hooks
- func (k Keeper) StoreService() store.KVStoreService
- func (k Keeper) Undelegate(ctx context.Context, delAddr sdk.AccAddress, validator types.AllianceValidator, ...) (*time.Time, error)
- func (k Keeper) UpdateAlliance(ctx context.Context, req *types.MsgUpdateAllianceProposal) error
- func (k Keeper) UpdateAllianceAsset(ctx context.Context, newAsset types.AllianceAsset) error
- func (k Keeper) ValidateDelegatedAmount(delegation types.Delegation, coin sdk.Coin, val types.AllianceValidator, ...) (shares math.LegacyDec, err error)
- type MsgServer
- func (m MsgServer) ClaimDelegationRewards(ctx context.Context, msg *types.MsgClaimDelegationRewards) (*types.MsgClaimDelegationRewardsResponse, error)
- func (m MsgServer) CreateAlliance(ctx context.Context, msg *types.MsgCreateAlliance) (*types.MsgCreateAllianceResponse, error)
- func (m MsgServer) Delegate(ctx context.Context, msg *types.MsgDelegate) (*types.MsgDelegateResponse, error)
- func (m MsgServer) DeleteAlliance(ctx context.Context, msg *types.MsgDeleteAlliance) (*types.MsgDeleteAllianceResponse, error)
- func (m MsgServer) Redelegate(ctx context.Context, msg *types.MsgRedelegate) (*types.MsgRedelegateResponse, error)
- func (m MsgServer) Undelegate(ctx context.Context, msg *types.MsgUndelegate) (*types.MsgUndelegateResponse, error)
- func (m MsgServer) UpdateAlliance(ctx context.Context, msg *types.MsgUpdateAlliance) (*types.MsgUpdateAllianceResponse, error)
- func (m MsgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error)
- type QueryServer
- func (k QueryServer) AllAllianceValidators(c context.Context, req *types.QueryAllAllianceValidatorsRequest) (*types.QueryAllianceValidatorsResponse, error)
- func (k QueryServer) AllAlliancesDelegations(c context.Context, req *types.QueryAllAlliancesDelegationsRequest) (*types.QueryAlliancesDelegationsResponse, error)
- func (k QueryServer) Alliance(c context.Context, req *types.QueryAllianceRequest) (*types.QueryAllianceResponse, error)
- func (k QueryServer) AllianceDelegation(c context.Context, req *types.QueryAllianceDelegationRequest) (*types.QueryAllianceDelegationResponse, error)
- func (k QueryServer) AllianceDelegationRewards(context context.Context, req *types.QueryAllianceDelegationRewardsRequest) (*types.QueryAllianceDelegationRewardsResponse, error)
- func (k QueryServer) AllianceRedelegations(c context.Context, req *types.QueryAllianceRedelegationsRequest) (*types.QueryAllianceRedelegationsResponse, error)
- func (k QueryServer) AllianceRedelegationsByDelegator(c context.Context, req *types.QueryAllianceRedelegationsByDelegatorRequest) (*types.QueryAllianceRedelegationsByDelegatorResponse, error)
- func (k QueryServer) AllianceUnbondings(c context.Context, req *types.QueryAllianceUnbondingsRequest) (*types.QueryAllianceUnbondingsResponse, error)
- func (k QueryServer) AllianceUnbondingsByDelegator(c context.Context, req *types.QueryAllianceUnbondingsByDelegatorRequest) (*types.QueryAllianceUnbondingsByDelegatorResponse, error)
- func (k QueryServer) AllianceUnbondingsByDenomAndDelegator(c context.Context, ...) (*types.QueryAllianceUnbondingsByDenomAndDelegatorResponse, error)
- func (k QueryServer) AllianceValidator(c context.Context, req *types.QueryAllianceValidatorRequest) (*types.QueryAllianceValidatorResponse, error)
- func (k QueryServer) Alliances(c context.Context, req *types.QueryAlliancesRequest) (*types.QueryAlliancesResponse, error)
- func (k QueryServer) AlliancesDelegation(c context.Context, req *types.QueryAlliancesDelegationsRequest) (*types.QueryAlliancesDelegationsResponse, error)
- func (k QueryServer) AlliancesDelegationByValidator(c context.Context, req *types.QueryAlliancesDelegationByValidatorRequest) (*types.QueryAlliancesDelegationsResponse, error)
- func (k QueryServer) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- type RewardsKeeper
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.
func NewQueryServerImpl ¶
func NewQueryServerImpl(keeper Keeper) types.QueryServer
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(ctx context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) AfterUnbondingInitiated ¶
func (Hooks) AfterValidatorBeginUnbonding ¶
func (h Hooks) AfterValidatorBeginUnbonding(ctx context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(ctx context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
func (Hooks) AfterValidatorCreated ¶
func (Hooks) AfterValidatorRemoved ¶
func (h Hooks) AfterValidatorRemoved(ctx context.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) (err error)
func (Hooks) AfterValidatorSlashed ¶
func (h Hooks) AfterValidatorSlashed(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress, _ math.LegacyDec)
func (Hooks) BeforeDelegationCreated ¶
func (h Hooks) BeforeDelegationCreated(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) BeforeDelegationRemoved ¶
func (h Hooks) BeforeDelegationRemoved(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) BeforeValidatorModified ¶
func (Hooks) BeforeValidatorSlashed ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, distributionKeeper types.DistributionKeeper, feeCollectorName string, authorityAddr string, ) Keeper
func (Keeper) AddAssetsToRewardPool ¶
func (k Keeper) AddAssetsToRewardPool(ctx context.Context, from sdk.AccAddress, val types.AllianceValidator, coins sdk.Coins) error
AddAssetsToRewardPool increments a reward history array. A reward history stores the average reward per token/reward_weight. To calculate the number of rewards claimable, take reward_history * alliance_token_amount * reward_weight
func (Keeper) CalculateDelegationRewards ¶
func (k Keeper) CalculateDelegationRewards(ctx context.Context, delegation types.Delegation, val types.AllianceValidator, asset types.AllianceAsset) (sdk.Coins, types.RewardHistories, error)
CalculateDelegationRewards calculates the rewards that can be claimed for a delegation It takes past reward_rate changes into account by using the RewardRateChangeSnapshot entry
func (Keeper) ClaimDelegationRewards ¶
func (k Keeper) ClaimDelegationRewards( ctx context.Context, delAddr sdk.AccAddress, val types.AllianceValidator, denom string, ) (sdk.Coins, error)
ClaimDelegationRewards claims delegation rewards and transfers to the delegator account This method updates the delegation so you will need to re-query an updated version from the database
func (Keeper) ClaimValidatorRewards ¶
func (k Keeper) ClaimValidatorRewards(ctx context.Context, val types.AllianceValidator) (sdk.Coins, error)
ClaimValidatorRewards claims the validator rewards (minus commission) from the distribution module This should be called everytime validator delegation changes (e.g. [un/re]delegation) to update the reward claim history
func (Keeper) ClearDustDelegation ¶
func (k Keeper) ClearDustDelegation(ctx context.Context, delAddr sdk.AccAddress, validator types.AllianceValidator, asset types.AllianceAsset) error
func (Keeper) CompleteRedelegations ¶
CompleteRedelegations Go through the re-delegations queue and remove all that have passed the completion time
func (Keeper) CompleteUnbondings ¶ added in v0.2.2
CompleteUnbondings Go through all queued undelegations and send the tokens to the delAddrs
func (Keeper) ConsumeAssetRebalanceEvent ¶
func (Keeper) CreateAlliance ¶
func (Keeper) DeductAssetsHook ¶
DeductAssetsHook is called periodically to deduct from an alliance asset (calculated by take_rate). The interval in which assets are deducted is set in module params
func (Keeper) DeductAssetsWithTakeRate ¶
func (k Keeper) DeductAssetsWithTakeRate(ctx sdk.Context, lastClaim time.Time, assets []*types.AllianceAsset) (sdk.Coins, error)
DeductAssetsWithTakeRate Deducts an alliance asset using the take_rate The deducted asset is distributed to the fee_collector module account to be redistributed to stakers
func (Keeper) Delegate ¶
func (k Keeper) Delegate(ctx context.Context, delAddr sdk.AccAddress, validator types.AllianceValidator, coin sdk.Coin) (*math.LegacyDec, error)
Delegate is the entry point for delegators to delegate alliance assets to validators Voting power is not immediately accured to the delegators in this method and a flag is set to rebalance voting power at the end of the block. This improves performance since rebalancing only needs to happen once regardless of how many delegations are made in a single block
func (Keeper) DeleteAlliance ¶
func (Keeper) DeleteAsset ¶
func (Keeper) DeleteRedelegation ¶
func (Keeper) DeleteValidatorInfo ¶ added in v0.3.1
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
func (Keeper) GetAllAllianceValidatorInfo ¶
func (Keeper) GetAllAssets ¶
func (k Keeper) GetAllAssets(ctx context.Context) (assets []*types.AllianceAsset)
func (Keeper) GetAllianceBondedAmount ¶
func (k Keeper) GetAllianceBondedAmount(ctx context.Context, delegator sdk.AccAddress) (math.Int, error)
GetAllianceBondedAmount returns the total amount of bonded native tokens that are not in the unbonding pool
func (Keeper) GetAllianceValidator ¶
func (k Keeper) GetAllianceValidator(ctx context.Context, valAddr sdk.ValAddress) (types.AllianceValidator, error)
func (Keeper) GetAllianceValidatorInfo ¶
func (k Keeper) GetAllianceValidatorInfo(ctx context.Context, valAddr sdk.ValAddress) (types.AllianceValidatorInfo, bool)
func (Keeper) GetAssetByDenom ¶
func (Keeper) GetAuthority ¶ added in v0.3.0
func (Keeper) GetDelegation ¶
func (k Keeper) GetDelegation( ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, denom string, ) (d types.Delegation, found bool)
func (Keeper) GetUnbondings ¶ added in v0.2.2
func (k Keeper) GetUnbondings( ctx sdk.Context, denom string, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ) (unbondingDelegations []types.UnbondingDelegation, err error)
This method retun all unbonding delegations for a given denom, validator address and delegator address. It is the most optimal way to query that data because it uses the indexes that are already in place for the unbonding queue and ommits unnecessary checks or data parsings.
func (Keeper) GetUnbondingsByDelegator ¶ added in v0.3.5
func (k Keeper) GetUnbondingsByDelegator( ctx context.Context, delAddr sdk.AccAddress, ) (unbondingDelegations []types.UnbondingDelegation, err error)
This method retun all in-progress unbondings for a given delegator address
func (Keeper) GetUnbondingsByDenomAndDelegator ¶ added in v0.2.2
func (k Keeper) GetUnbondingsByDenomAndDelegator( ctx context.Context, denom string, delAddr sdk.AccAddress, ) (unbondingDelegations []types.UnbondingDelegation, err error)
This method retun all unbonding delegations for a given denom and delegator address, it is less optimal than GetUnbondings because it has do some data parsing and additional checks, plus it returns a larger data set.
func (Keeper) HasRedelegation ¶
func (k Keeper) HasRedelegation(ctx context.Context, delAddr sdk.AccAddress, dstVal sdk.ValAddress, denom string) bool
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, g *types.GenesisState) []abci.ValidatorUpdate
func (Keeper) InitializeAllianceAssets ¶
func (k Keeper) InitializeAllianceAssets(ctx context.Context, assets []*types.AllianceAsset) (err error)
InitializeAllianceAssets this hooks adds a reward change snapshot when time > asset.RewardStartTime A reward change snapshot of 0 weight is added to signify that the asset did not accrue any rewards during the warm up period so we can calculate the correct rewards when claiming
func (Keeper) IterateAllWeightChangeSnapshot ¶
func (k Keeper) IterateAllWeightChangeSnapshot(ctx sdk.Context, cb func(denom string, valAddr sdk.ValAddress, lastClaimHeight uint64, snapshot types.RewardWeightChangeSnapshot) (stop bool))
func (Keeper) IterateAllianceValidatorInfo ¶
func (k Keeper) IterateAllianceValidatorInfo(ctx context.Context, cb func(valAddr sdk.ValAddress, info types.AllianceValidatorInfo) (stop bool)) (err error)
func (Keeper) IterateDelegations ¶
func (Keeper) IterateRedelegations ¶
func (Keeper) IterateRedelegationsByDelegator ¶
func (k Keeper) IterateRedelegationsByDelegator(ctx context.Context, delAddr sdk.AccAddress) storetypes.Iterator
func (Keeper) IterateRedelegationsBySrcValidator ¶
func (k Keeper) IterateRedelegationsBySrcValidator(ctx context.Context, srcValAddr sdk.ValAddress) storetypes.Iterator
func (Keeper) IterateUndelegations ¶
func (Keeper) IterateUndelegationsByCompletionTime ¶
func (Keeper) IterateUndelegationsBySrcValidator ¶
func (k Keeper) IterateUndelegationsBySrcValidator(ctx context.Context, valAddr sdk.ValAddress) storetypes.Iterator
func (Keeper) IterateWeightChangeSnapshot ¶
func (Keeper) LastRewardClaimTime ¶
func (Keeper) QueueAssetRebalanceEvent ¶
func (Keeper) RebalanceBondTokenWeights ¶
func (k Keeper) RebalanceBondTokenWeights(ctx context.Context, assets []*types.AllianceAsset) (err error)
RebalanceBondTokenWeights uses asset reward weights to calculate the expected amount of staking token that has to be minted / burned to maintain the right ratio It iterates all validators and calculates the expected staked amount based on delegations and delegates/undelegates the difference.
func (Keeper) RebalanceHook ¶
func (Keeper) Redelegate ¶
func (k Keeper) Redelegate(ctx context.Context, delAddr sdk.AccAddress, srcVal types.AllianceValidator, dstVal types.AllianceValidator, coin sdk.Coin) (*time.Time, error)
Redelegate from one validator to another
func (Keeper) ResetAssetAndValidators ¶
ResetAssetAndValidators When an asset has no more tokens being delegated, go through all validators and set validator shares to zero
func (Keeper) RewardClaimInterval ¶
func (Keeper) RewardDelayTime ¶
func (Keeper) RewardWeightChangeHook ¶
func (Keeper) SetDelegation ¶
func (k Keeper) SetDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, denom string, del types.Delegation) error
func (Keeper) SetLastRewardClaimTime ¶
func (Keeper) SetRewardWeightChangeSnapshot ¶
func (k Keeper) SetRewardWeightChangeSnapshot(ctx context.Context, asset types.AllianceAsset, val types.AllianceValidator) error
func (Keeper) SetValidator ¶
func (Keeper) SetValidatorInfo ¶
func (k Keeper) SetValidatorInfo(ctx context.Context, valAddr sdk.ValAddress, val types.AllianceValidatorInfo) error
func (Keeper) SlashValidator ¶
func (k Keeper) SlashValidator(ctx context.Context, valAddr sdk.ValAddress, fraction math.LegacyDec) error
SlashValidator works by reducing the amount of validator shares for all alliance assets by a `fraction` This effectively reallocates tokens from slashed validators to good validators On top of slashing currently bonded delegations, we also slash re-delegations and un-delegations that are still in the progress of unbonding
func (Keeper) StakingHooks ¶
func (Keeper) StoreService ¶ added in v0.4.0
func (k Keeper) StoreService() store.KVStoreService
func (Keeper) Undelegate ¶
func (k Keeper) Undelegate(ctx context.Context, delAddr sdk.AccAddress, validator types.AllianceValidator, coin sdk.Coin) (*time.Time, error)
Undelegate from a validator Staked tokens are only distributed to the delegator after the unbonding period
func (Keeper) UpdateAlliance ¶
func (Keeper) UpdateAllianceAsset ¶
UpdateAllianceAsset updates the alliance asset with new params Also saves a snapshot whenever rewards weight changes to make sure delegation reward calculation has reference to historical reward rates
func (Keeper) ValidateDelegatedAmount ¶
func (k Keeper) ValidateDelegatedAmount(delegation types.Delegation, coin sdk.Coin, val types.AllianceValidator, asset types.AllianceAsset) (shares math.LegacyDec, err error)
ValidateDelegatedAmount returns the amount of shares for a given coin that is staked Returns the number of shares that represents the amount of staked tokens that was requested
type MsgServer ¶
type MsgServer struct {
Keeper
}
func (MsgServer) ClaimDelegationRewards ¶
func (m MsgServer) ClaimDelegationRewards(ctx context.Context, msg *types.MsgClaimDelegationRewards) (*types.MsgClaimDelegationRewardsResponse, error)
func (MsgServer) CreateAlliance ¶ added in v0.3.0
func (m MsgServer) CreateAlliance(ctx context.Context, msg *types.MsgCreateAlliance) (*types.MsgCreateAllianceResponse, error)
func (MsgServer) Delegate ¶
func (m MsgServer) Delegate(ctx context.Context, msg *types.MsgDelegate) (*types.MsgDelegateResponse, error)
func (MsgServer) DeleteAlliance ¶ added in v0.3.0
func (m MsgServer) DeleteAlliance(ctx context.Context, msg *types.MsgDeleteAlliance) (*types.MsgDeleteAllianceResponse, error)
func (MsgServer) Redelegate ¶
func (m MsgServer) Redelegate(ctx context.Context, msg *types.MsgRedelegate) (*types.MsgRedelegateResponse, error)
func (MsgServer) Undelegate ¶
func (m MsgServer) Undelegate(ctx context.Context, msg *types.MsgUndelegate) (*types.MsgUndelegateResponse, error)
func (MsgServer) UpdateAlliance ¶ added in v0.3.0
func (m MsgServer) UpdateAlliance(ctx context.Context, msg *types.MsgUpdateAlliance) (*types.MsgUpdateAllianceResponse, error)
func (MsgServer) UpdateParams ¶ added in v0.3.0
func (m MsgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error)
type QueryServer ¶
type QueryServer struct {
Keeper
}
func (QueryServer) AllAllianceValidators ¶
func (k QueryServer) AllAllianceValidators(c context.Context, req *types.QueryAllAllianceValidatorsRequest) (*types.QueryAllianceValidatorsResponse, error)
func (QueryServer) AllAlliancesDelegations ¶
func (k QueryServer) AllAlliancesDelegations(c context.Context, req *types.QueryAllAlliancesDelegationsRequest) (*types.QueryAlliancesDelegationsResponse, error)
func (QueryServer) Alliance ¶
func (k QueryServer) Alliance(c context.Context, req *types.QueryAllianceRequest) (*types.QueryAllianceResponse, error)
func (QueryServer) AllianceDelegation ¶
func (k QueryServer) AllianceDelegation(c context.Context, req *types.QueryAllianceDelegationRequest) (*types.QueryAllianceDelegationResponse, error)
func (QueryServer) AllianceDelegationRewards ¶
func (k QueryServer) AllianceDelegationRewards(context context.Context, req *types.QueryAllianceDelegationRewardsRequest) (*types.QueryAllianceDelegationRewardsResponse, error)
func (QueryServer) AllianceRedelegations ¶ added in v0.2.2
func (k QueryServer) AllianceRedelegations(c context.Context, req *types.QueryAllianceRedelegationsRequest) (*types.QueryAllianceRedelegationsResponse, error)
func (QueryServer) AllianceRedelegationsByDelegator ¶ added in v0.3.5
func (k QueryServer) AllianceRedelegationsByDelegator(c context.Context, req *types.QueryAllianceRedelegationsByDelegatorRequest) (*types.QueryAllianceRedelegationsByDelegatorResponse, error)
func (QueryServer) AllianceUnbondings ¶ added in v0.2.2
func (k QueryServer) AllianceUnbondings(c context.Context, req *types.QueryAllianceUnbondingsRequest) (*types.QueryAllianceUnbondingsResponse, error)
func (QueryServer) AllianceUnbondingsByDelegator ¶ added in v0.3.5
func (k QueryServer) AllianceUnbondingsByDelegator(c context.Context, req *types.QueryAllianceUnbondingsByDelegatorRequest) (*types.QueryAllianceUnbondingsByDelegatorResponse, error)
func (QueryServer) AllianceUnbondingsByDenomAndDelegator ¶ added in v0.2.2
func (k QueryServer) AllianceUnbondingsByDenomAndDelegator(c context.Context, req *types.QueryAllianceUnbondingsByDenomAndDelegatorRequest) (*types.QueryAllianceUnbondingsByDenomAndDelegatorResponse, error)
func (QueryServer) AllianceValidator ¶
func (k QueryServer) AllianceValidator(c context.Context, req *types.QueryAllianceValidatorRequest) (*types.QueryAllianceValidatorResponse, error)
func (QueryServer) Alliances ¶
func (k QueryServer) Alliances(c context.Context, req *types.QueryAlliancesRequest) (*types.QueryAlliancesResponse, error)
func (QueryServer) AlliancesDelegation ¶
func (k QueryServer) AlliancesDelegation(c context.Context, req *types.QueryAlliancesDelegationsRequest) (*types.QueryAlliancesDelegationsResponse, error)
func (QueryServer) AlliancesDelegationByValidator ¶
func (k QueryServer) AlliancesDelegationByValidator(c context.Context, req *types.QueryAlliancesDelegationByValidatorRequest) (*types.QueryAlliancesDelegationsResponse, error)
func (QueryServer) Params ¶
func (k QueryServer) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
type RewardsKeeper ¶
type RewardsKeeper interface{}