Skip to content

Commit

Permalink
sinner strings for contract_type
Browse files Browse the repository at this point in the history
  • Loading branch information
trajan0x committed Oct 25, 2023
1 parent 4f0ef6c commit 589d574
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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.

0 comments on commit 589d574

Please sign in to comment.