forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 19
/
hooks.go
64 lines (60 loc) · 2.15 KB
/
hooks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package types
import (
sdk "github.com/enigmampc/cosmos-sdk/types"
)
// combine multiple staking hooks, all hook functions are run in array sequence
type MultiStakingHooks []StakingHooks
func NewMultiStakingHooks(hooks ...StakingHooks) MultiStakingHooks {
return hooks
}
// nolint
func (h MultiStakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) {
for i := range h {
h[i].AfterValidatorCreated(ctx, valAddr)
}
}
func (h MultiStakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) {
for i := range h {
h[i].BeforeValidatorModified(ctx, valAddr)
}
}
func (h MultiStakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) {
for i := range h {
h[i].AfterValidatorRemoved(ctx, consAddr, valAddr)
}
}
func (h MultiStakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) {
for i := range h {
h[i].AfterValidatorBonded(ctx, consAddr, valAddr)
}
}
func (h MultiStakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) {
for i := range h {
h[i].AfterValidatorBeginUnbonding(ctx, consAddr, valAddr)
}
}
func (h MultiStakingHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) {
for i := range h {
h[i].BeforeDelegationCreated(ctx, delAddr, valAddr)
}
}
func (h MultiStakingHooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) {
for i := range h {
h[i].BeforeDelegationSharesModified(ctx, delAddr, valAddr)
}
}
func (h MultiStakingHooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) {
for i := range h {
h[i].BeforeDelegationRemoved(ctx, delAddr, valAddr)
}
}
func (h MultiStakingHooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) {
for i := range h {
h[i].AfterDelegationModified(ctx, delAddr, valAddr)
}
}
func (h MultiStakingHooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) {
for i := range h {
h[i].BeforeValidatorSlashed(ctx, valAddr, fraction)
}
}