Fixes for Nim 1.2.x

This commit is contained in:
Mark Spanbroek 2022-01-19 09:47:29 +01:00
parent ad3d2f7a4b
commit 2a8133b349
2 changed files with 11 additions and 10 deletions

View File

@ -23,4 +23,5 @@ func toArray*(address: Address): array[20, byte] =
func `$`*(address: Address): string =
"0x" & toHex(address.toArray)
func `==`*(a, b: Address): bool {.borrow.}
func `==`*(a, b: Address): bool =
a.toArray == b.toArray

View File

@ -34,17 +34,17 @@ solidityType bool, "bool"
solidityType string, "string"
solidityType Address, "address"
func solidityType*[N: static int](_: type array[N, byte]): string =
"bytes" & $N
func solidityType*(_: type seq[byte]): string =
"bytes"
func solidityType*[T, N](_: type array[N, T]): string =
solidityType(T) & "[" & $array[N, T].default.len & "]"
func solidityType*[N: static int, T](_: type array[N, T]): string =
when T is byte:
"bytes" & $N
else:
solidityType(T) & "[" & $N & "]"
func solidityType*[T](_: type seq[T]): string =
solidityType(T) & "[]"
when T is byte:
"bytes"
else:
solidityType(T) & "[]"
func solidityType*(Tuple: type tuple): string =
var names: seq[string]