...
This commit is contained in:
parent
5dabd1bf6d
commit
5790f33159
|
@ -254,7 +254,7 @@ func (app *GaiaApp) ExportAppStateAndValidators() (appState json.RawMessage, val
|
||||||
// Combined Staking Hooks
|
// Combined Staking Hooks
|
||||||
type Hooks struct {
|
type Hooks struct {
|
||||||
dh distr.Hooks
|
dh distr.Hooks
|
||||||
sh slashing.ValidatorHooks
|
sh slashing.Hooks
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHooks(dh distr.Hooks, sh slashing.ValidatorHooks) Hooks {
|
func NewHooks(dh distr.Hooks, sh slashing.ValidatorHooks) Hooks {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
// set the proposer for determining distribution during endblock
|
// set the proposer for determining distribution during endblock
|
||||||
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) {
|
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) {
|
||||||
consAddr := sdk.ConsAddress{req.Header.Proposer.Address}
|
consAddr := sdk.ConsAddress(req.Header.Proposer.Address)
|
||||||
k.SetProposerConsAddr(consAddr)
|
k.SetProposerConsAddr(ctx, consAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate fees
|
// allocate fees
|
||||||
|
|
|
@ -10,6 +10,8 @@ import (
|
||||||
|
|
||||||
type (
|
type (
|
||||||
Keeper = keeper.Keeper
|
Keeper = keeper.Keeper
|
||||||
|
Hooks = keeper.Hooks
|
||||||
|
|
||||||
DelegatorWithdrawInfo = types.DelegatorWithdrawInfo
|
DelegatorWithdrawInfo = types.DelegatorWithdrawInfo
|
||||||
DelegatorDistInfo = types.DelegatorDistInfo
|
DelegatorDistInfo = types.DelegatorDistInfo
|
||||||
ValidatorDistInfo = types.ValidatorDistInfo
|
ValidatorDistInfo = types.ValidatorDistInfo
|
||||||
|
@ -18,7 +20,7 @@ type (
|
||||||
|
|
||||||
MsgSetWithdrawAddress = types.MsgSetWithdrawAddress
|
MsgSetWithdrawAddress = types.MsgSetWithdrawAddress
|
||||||
MsgWithdrawDelegatorRewardsAll = types.MsgWithdrawDelegatorRewardsAll
|
MsgWithdrawDelegatorRewardsAll = types.MsgWithdrawDelegatorRewardsAll
|
||||||
MsgWithdrawDelegationReward = types.MsgWithdrawDelegationReward
|
MsgWithdrawDelegatorReward = types.MsgWithdrawDelegatorReward
|
||||||
MsgWithdrawValidatorRewardsAll = types.MsgWithdrawValidatorRewardsAll
|
MsgWithdrawValidatorRewardsAll = types.MsgWithdrawValidatorRewardsAll
|
||||||
|
|
||||||
GenesisState = types.GenesisState
|
GenesisState = types.GenesisState
|
||||||
|
@ -47,7 +49,7 @@ var (
|
||||||
|
|
||||||
NewMsgSetWithdrawAddress = types.NewMsgSetWithdrawAddress
|
NewMsgSetWithdrawAddress = types.NewMsgSetWithdrawAddress
|
||||||
NewMsgWithdrawDelegatorRewardsAll = types.NewMsgWithdrawDelegatorRewardsAll
|
NewMsgWithdrawDelegatorRewardsAll = types.NewMsgWithdrawDelegatorRewardsAll
|
||||||
NewMsgWithdrawDelegationReward = types.NewMsgWithdrawDelegationReward
|
NewMsgWithdrawDelegationReward = types.NewMsgWithdrawDelegatorReward
|
||||||
NewMsgWithdrawValidatorRewardsAll = types.NewMsgWithdrawValidatorRewardsAll
|
NewMsgWithdrawValidatorRewardsAll = types.NewMsgWithdrawValidatorRewardsAll
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -69,6 +71,6 @@ var (
|
||||||
ActionWithdrawValidatorRewardsAll = tags.ActionWithdrawValidatorRewardsAll
|
ActionWithdrawValidatorRewardsAll = tags.ActionWithdrawValidatorRewardsAll
|
||||||
|
|
||||||
TagAction = tags.Action
|
TagAction = tags.Action
|
||||||
TagValidator = tags.SrcValidator
|
TagValidator = tags.Validator
|
||||||
TagDelegator = tags.Delegator
|
TagDelegator = tags.Delegator
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,7 +2,7 @@ package distribution
|
||||||
|
|
||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
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
|
// 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 {
|
for _, ddi := range data.DelegatorDistInfos {
|
||||||
keeper.SetDelegatorDistInfo(ctx, ddi)
|
keeper.SetDelegatorDistInfo(ctx, ddi)
|
||||||
}
|
}
|
||||||
for _, dw := range data.DelegatorWithdrawAddrs {
|
for _, dw := range data.DelegatorWithdrawInfos {
|
||||||
keeper.SetDelegatorWithdrawAddr(ctx, dw.DelegatorAddr, dw.WithdrawAddr)
|
keeper.SetDelegatorWithdrawAddr(ctx, dw.DelegatorAddr, dw.WithdrawAddr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,6 @@ func WriteGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState {
|
||||||
FeePool: feePool,
|
FeePool: feePool,
|
||||||
ValidatorDistInfos: vdis,
|
ValidatorDistInfos: vdis,
|
||||||
DelegatorDistInfos: ddis,
|
DelegatorDistInfos: ddis,
|
||||||
DelegatorWithdrawAddrs: dws,
|
DelegatorWithdrawInfos: dws,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
|
||||||
return func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
|
return func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
|
||||||
// NOTE msg already has validate basic run
|
// NOTE msg already has validate basic run
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case types.MsgModifyWithdrawAddress:
|
case types.MsgSetWithdrawAddress:
|
||||||
return handleMsgModifyWithdrawAddress(ctx, msg, k)
|
return handleMsgModifyWithdrawAddress(ctx, msg, k)
|
||||||
case types.MsgWithdrawDelegatorRewardsAll:
|
case types.MsgWithdrawDelegatorRewardsAll:
|
||||||
return handleMsgWithdrawDelegatorRewardsAll(ctx, msg, k)
|
return handleMsgWithdrawDelegatorRewardsAll(ctx, msg, k)
|
||||||
|
@ -30,9 +30,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
|
||||||
// These functions assume everything has been authenticated,
|
// These functions assume everything has been authenticated,
|
||||||
// now we just perform action and save
|
// 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 := sdk.NewTags(
|
||||||
tags.Action, tags.ActionModifyWithdrawAddress,
|
tags.Action, tags.ActionModifyWithdrawAddress,
|
||||||
|
|
|
@ -62,7 +62,7 @@ type MsgWithdrawDelegatorRewardsAll struct {
|
||||||
DelegatorAddr sdk.AccAddress `json:"delegator_addr"`
|
DelegatorAddr sdk.AccAddress `json:"delegator_addr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMsgWithdrawDelegationRewardsAll(delAddr sdk.AccAddress) MsgWithdrawDelegatorRewardsAll {
|
func NewMsgWithdrawDelegatorRewardsAll(delAddr sdk.AccAddress) MsgWithdrawDelegatorRewardsAll {
|
||||||
return MsgWithdrawDelegatorRewardsAll{
|
return MsgWithdrawDelegatorRewardsAll{
|
||||||
DelegatorAddr: delAddr,
|
DelegatorAddr: delAddr,
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ type MsgWithdrawDelegatorReward struct {
|
||||||
ValidatorAddr sdk.ValAddress `json:"validator_addr"`
|
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{
|
return MsgWithdrawDelegatorReward{
|
||||||
DelegatorAddr: delAddr,
|
DelegatorAddr: delAddr,
|
||||||
ValidatorAddr: valAddr,
|
ValidatorAddr: valAddr,
|
||||||
|
|
Loading…
Reference in New Issue