github.com/Finschia/finschia-sdk@v0.48.1/x/gov/types/hooks.go (about)

     1  package types
     2  
     3  import (
     4  	sdk "github.com/Finschia/finschia-sdk/types"
     5  )
     6  
     7  var _ GovHooks = MultiGovHooks{}
     8  
     9  // combine multiple governance hooks, all hook functions are run in array sequence
    10  type MultiGovHooks []GovHooks
    11  
    12  func NewMultiGovHooks(hooks ...GovHooks) MultiGovHooks {
    13  	return hooks
    14  }
    15  
    16  func (h MultiGovHooks) AfterProposalSubmission(ctx sdk.Context, proposalID uint64) {
    17  	for i := range h {
    18  		h[i].AfterProposalSubmission(ctx, proposalID)
    19  	}
    20  }
    21  
    22  func (h MultiGovHooks) AfterProposalDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) {
    23  	for i := range h {
    24  		h[i].AfterProposalDeposit(ctx, proposalID, depositorAddr)
    25  	}
    26  }
    27  
    28  func (h MultiGovHooks) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) {
    29  	for i := range h {
    30  		h[i].AfterProposalVote(ctx, proposalID, voterAddr)
    31  	}
    32  }
    33  
    34  func (h MultiGovHooks) AfterProposalFailedMinDeposit(ctx sdk.Context, proposalID uint64) {
    35  	for i := range h {
    36  		h[i].AfterProposalFailedMinDeposit(ctx, proposalID)
    37  	}
    38  }
    39  
    40  func (h MultiGovHooks) AfterProposalVotingPeriodEnded(ctx sdk.Context, proposalID uint64) {
    41  	for i := range h {
    42  		h[i].AfterProposalVotingPeriodEnded(ctx, proposalID)
    43  	}
    44  }