Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Iota Types for sinner contract_type #1498

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions services/sinner/config/indexer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ import (

// ContractType is the type of contract specified by the config and used for selecting the correct parser.
//
//go:generate go run golang.org/x/tools/cmd/stringer -type=ContractType
//go:generate go run golang.org/x/tools/cmd/stringer -type=ContractType -linecomment
type ContractType int

const (
// OriginType is the ContractType for the origin contract.
OriginType ContractType = iota
OriginType ContractType = iota // origin
// ExecutionHubType is the ContractType for the execution hub contract.
ExecutionHubType
ExecutionHubType // execution_hub
// UnknownType is the ContractType for an unknown contract.
UnknownType
UnknownType // unknown
)

// ContractTypeFromString converts a string (intended to be from parsed config) into the ContractType type.
func ContractTypeFromString(s string) (ContractType, error) {
switch s {
case "origin":
case OriginType.String():
return OriginType, nil
case "execution_hub":
case ExecutionHubType.String():
return ExecutionHubType, nil
default:
return UnknownType, fmt.Errorf("unknown contract type: %s", s)
Expand Down
6 changes: 3 additions & 3 deletions services/sinner/config/indexer/contracttype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading