-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
hooks.go
44 lines (35 loc) · 1.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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
var _ GovHooks = MultiGovHooks{}
// combine multiple governance hooks, all hook functions are run in array sequence
type MultiGovHooks []GovHooks
func NewMultiGovHooks(hooks ...GovHooks) MultiGovHooks {
return hooks
}
func (h MultiGovHooks) AfterProposalSubmission(ctx sdk.Context, proposalID uint64) {
for i := range h {
h[i].AfterProposalSubmission(ctx, proposalID)
}
}
func (h MultiGovHooks) AfterProposalDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) {
for i := range h {
h[i].AfterProposalDeposit(ctx, proposalID, depositorAddr)
}
}
func (h MultiGovHooks) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) {
for i := range h {
h[i].AfterProposalVote(ctx, proposalID, voterAddr)
}
}
func (h MultiGovHooks) AfterProposalFailedMinDeposit(ctx sdk.Context, proposalID uint64) {
for i := range h {
h[i].AfterProposalFailedMinDeposit(ctx, proposalID)
}
}
func (h MultiGovHooks) AfterProposalVotingPeriodEnded(ctx sdk.Context, proposalID uint64) {
for i := range h {
h[i].AfterProposalVotingPeriodEnded(ctx, proposalID)
}
}