Merge pull request #528 from narimiran/parse-enum-2

write `Fork` enum in a "modern way"
This commit is contained in:
andri lim 2020-09-04 15:09:01 +07:00 committed by GitHub
commit 676ce3aedb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 19 deletions

View File

@ -9,22 +9,11 @@ import stint, eth/common/eth_types
type
Fork* = enum
FkFrontier,
FkHomestead,
FkTangerine,
FkSpurious,
FkByzantium,
FkConstantinople,
FkPetersburg,
FkIstanbul
proc `$`*(fork: Fork): string =
case fork
of FkFrontier: result = "Frontier"
of FkHomestead: result = "Homestead"
of FkTangerine: result = "Tangerine Whistle"
of FkSpurious: result = "Spurious Dragon"
of FkByzantium: result = "Byzantium"
of FkConstantinople: result = "Constantinople"
of FkPetersburg: result = "Petersburg"
of FkIstanbul: result = "Istanbul"
FkFrontier = "frontier"
FkHomestead = "homestead"
FkTangerine = "tangerine whistle"
FkSpurious = "spurious dragon"
FkByzantium = "byzantium"
FkConstantinople = "constantinople"
FkPetersburg = "petersburg"
FkIstanbul = "istanbul"