This commit is contained in:
rigelrozanski 2018-09-19 23:01:55 -04:00
parent 5dabd1bf6d
commit 5790f33159
6 changed files with 17 additions and 15 deletions

View File

@ -254,7 +254,7 @@ func (app *GaiaApp) ExportAppStateAndValidators() (appState json.RawMessage, val
// Combined Staking Hooks
type Hooks struct {
dh distr.Hooks
sh slashing.ValidatorHooks
sh slashing.Hooks
}
func NewHooks(dh distr.Hooks, sh slashing.ValidatorHooks) Hooks {

View File

@ -9,8 +9,8 @@ import (
// set the proposer for determining distribution during endblock
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) {
consAddr := sdk.ConsAddress{req.Header.Proposer.Address}
k.SetProposerConsAddr(consAddr)
consAddr := sdk.ConsAddress(req.Header.Proposer.Address)
k.SetProposerConsAddr(ctx, consAddr)
}
// allocate fees

View File

@ -9,7 +9,9 @@ import (
)
type (
Keeper = keeper.Keeper
Keeper = keeper.Keeper
Hooks = keeper.Hooks
DelegatorWithdrawInfo = types.DelegatorWithdrawInfo
DelegatorDistInfo = types.DelegatorDistInfo
ValidatorDistInfo = types.ValidatorDistInfo
@ -18,7 +20,7 @@ type (
MsgSetWithdrawAddress = types.MsgSetWithdrawAddress
MsgWithdrawDelegatorRewardsAll = types.MsgWithdrawDelegatorRewardsAll
MsgWithdrawDelegationReward = types.MsgWithdrawDelegationReward
MsgWithdrawDelegatorReward = types.MsgWithdrawDelegatorReward
MsgWithdrawValidatorRewardsAll = types.MsgWithdrawValidatorRewardsAll
GenesisState = types.GenesisState
@ -47,7 +49,7 @@ var (
NewMsgSetWithdrawAddress = types.NewMsgSetWithdrawAddress
NewMsgWithdrawDelegatorRewardsAll = types.NewMsgWithdrawDelegatorRewardsAll
NewMsgWithdrawDelegationReward = types.NewMsgWithdrawDelegationReward
NewMsgWithdrawDelegationReward = types.NewMsgWithdrawDelegatorReward
NewMsgWithdrawValidatorRewardsAll = types.NewMsgWithdrawValidatorRewardsAll
)
@ -69,6 +71,6 @@ var (
ActionWithdrawValidatorRewardsAll = tags.ActionWithdrawValidatorRewardsAll
TagAction = tags.Action
TagValidator = tags.SrcValidator
TagValidator = tags.Validator
TagDelegator = tags.Delegator
)

View File

@ -2,7 +2,7 @@ package distribution
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/stake/types"
"github.com/cosmos/cosmos-sdk/x/distribution/types"
)
// InitGenesis sets distribution information for genesis
@ -15,7 +15,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) {
for _, ddi := range data.DelegatorDistInfos {
keeper.SetDelegatorDistInfo(ctx, ddi)
}
for _, dw := range data.DelegatorWithdrawAddrs {
for _, dw := range data.DelegatorWithdrawInfos {
keeper.SetDelegatorWithdrawAddr(ctx, dw.DelegatorAddr, dw.WithdrawAddr)
}
}
@ -32,6 +32,6 @@ func WriteGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState {
FeePool: feePool,
ValidatorDistInfos: vdis,
DelegatorDistInfos: ddis,
DelegatorWithdrawAddrs: dws,
DelegatorWithdrawInfos: dws,
}
}

View File

@ -11,7 +11,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
// NOTE msg already has validate basic run
switch msg := msg.(type) {
case types.MsgModifyWithdrawAddress:
case types.MsgSetWithdrawAddress:
return handleMsgModifyWithdrawAddress(ctx, msg, k)
case types.MsgWithdrawDelegatorRewardsAll:
return handleMsgWithdrawDelegatorRewardsAll(ctx, msg, k)
@ -30,9 +30,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
// These functions assume everything has been authenticated,
// now we just perform action and save
func handleMsgModifyWithdrawAddress(ctx sdk.Context, msg types.MsgModifyWithdrawAddress, k keeper.Keeper) sdk.Result {
func handleMsgModifyWithdrawAddress(ctx sdk.Context, msg types.MsgSetWithdrawAddress, k keeper.Keeper) sdk.Result {
k.SetDelegatorWithdrawAddr(ctx, msg.DelegatorAddr, msg.WithdrawAddress)
k.SetDelegatorWithdrawAddr(ctx, msg.DelegatorAddr, msg.WithdrawAddr)
tags := sdk.NewTags(
tags.Action, tags.ActionModifyWithdrawAddress,

View File

@ -62,7 +62,7 @@ type MsgWithdrawDelegatorRewardsAll struct {
DelegatorAddr sdk.AccAddress `json:"delegator_addr"`
}
func NewMsgWithdrawDelegationRewardsAll(delAddr sdk.AccAddress) MsgWithdrawDelegatorRewardsAll {
func NewMsgWithdrawDelegatorRewardsAll(delAddr sdk.AccAddress) MsgWithdrawDelegatorRewardsAll {
return MsgWithdrawDelegatorRewardsAll{
DelegatorAddr: delAddr,
}
@ -101,7 +101,7 @@ type MsgWithdrawDelegatorReward struct {
ValidatorAddr sdk.ValAddress `json:"validator_addr"`
}
func NewMsgWithdrawDelegationReward(delAddr sdk.AccAddress, valAddr sdk.ValAddress) MsgWithdrawDelegatorReward {
func NewMsgWithdrawDelegatorReward(delAddr sdk.AccAddress, valAddr sdk.ValAddress) MsgWithdrawDelegatorReward {
return MsgWithdrawDelegatorReward{
DelegatorAddr: delAddr,
ValidatorAddr: valAddr,