-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: refactor events * chore: fix linting * chore: fix tests * chore: serialize errors to json correctly * chore: fix tests
- Loading branch information
1 parent
ba25bcd
commit 6c7c987
Showing
26 changed files
with
368 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package events | ||
|
||
import ( | ||
configTypes "main/pkg/config/types" | ||
"main/pkg/types" | ||
) | ||
|
||
type NotVotedEvent struct { | ||
Chain *configTypes.Chain | ||
Wallet *configTypes.Wallet | ||
Proposal types.Proposal | ||
} | ||
|
||
func (e NotVotedEvent) Name() string { | ||
return "not_voted" | ||
} | ||
|
||
func (e NotVotedEvent) IsAlert() bool { | ||
return true | ||
} | ||
|
||
func (e NotVotedEvent) GetChain() *configTypes.Chain { | ||
return e.Chain | ||
} | ||
|
||
func (e NotVotedEvent) GetProposal() types.Proposal { | ||
return e.Proposal | ||
} | ||
|
||
func (e NotVotedEvent) GetWallet() *configTypes.Wallet { | ||
return e.Wallet | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package events | ||
|
||
import ( | ||
configTypes "main/pkg/config/types" | ||
) | ||
|
||
type ProposalsQueryErrorEvent struct { | ||
Chain *configTypes.Chain | ||
Error error | ||
} | ||
|
||
func (e ProposalsQueryErrorEvent) Name() string { | ||
return "proposals_query_error" | ||
} | ||
|
||
func (e ProposalsQueryErrorEvent) IsAlert() bool { | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package events | ||
|
||
import ( | ||
configTypes "main/pkg/config/types" | ||
"main/pkg/types" | ||
) | ||
|
||
type RevotedEvent struct { | ||
Chain *configTypes.Chain | ||
Wallet *configTypes.Wallet | ||
Proposal types.Proposal | ||
Vote *types.Vote | ||
OldVote *types.Vote | ||
} | ||
|
||
func (e RevotedEvent) Name() string { | ||
return "revoted" | ||
} | ||
|
||
func (e RevotedEvent) IsAlert() bool { | ||
return true | ||
} | ||
|
||
func (e RevotedEvent) GetChain() *configTypes.Chain { | ||
return e.Chain | ||
} | ||
|
||
func (e RevotedEvent) GetProposal() types.Proposal { | ||
return e.Proposal | ||
} | ||
|
||
func (e RevotedEvent) GetWallet() *configTypes.Wallet { | ||
return e.Wallet | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package events | ||
|
||
import ( | ||
configTypes "main/pkg/config/types" | ||
"main/pkg/types" | ||
) | ||
|
||
type VoteQueryError struct { | ||
Chain *configTypes.Chain | ||
Proposal types.Proposal | ||
Error error | ||
} | ||
|
||
func (e VoteQueryError) Name() string { | ||
return "vote_query_error" | ||
} | ||
|
||
func (e VoteQueryError) IsAlert() bool { | ||
return true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package events | ||
|
||
import ( | ||
configTypes "main/pkg/config/types" | ||
"main/pkg/types" | ||
) | ||
|
||
type VotedEvent struct { | ||
Chain *configTypes.Chain | ||
Wallet *configTypes.Wallet | ||
Proposal types.Proposal | ||
Vote *types.Vote | ||
} | ||
|
||
func (e VotedEvent) Name() string { | ||
return "voted" | ||
} | ||
|
||
func (e VotedEvent) IsAlert() bool { | ||
return true | ||
} | ||
|
||
func (e VotedEvent) GetChain() *configTypes.Chain { | ||
return e.Chain | ||
} | ||
|
||
func (e VotedEvent) GetProposal() types.Proposal { | ||
return e.Proposal | ||
} | ||
|
||
func (e VotedEvent) GetWallet() *configTypes.Wallet { | ||
return e.Wallet | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package entry | ||
|
||
import ( | ||
configTypes "main/pkg/config/types" | ||
"main/pkg/types" | ||
) | ||
|
||
type ReportEntry interface { | ||
Name() string | ||
IsAlert() bool // only voted/not_voted are alerts, required for PagerDuty | ||
} | ||
|
||
type ReportEntryNotError interface { | ||
ReportEntry | ||
GetChain() *configTypes.Chain | ||
GetWallet() *configTypes.Wallet | ||
GetProposal() types.Proposal | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.