diff --git a/contractabi/address.nim b/contractabi/address.nim index 30fb6f6..37dd964 100644 --- a/contractabi/address.nim +++ b/contractabi/address.nim @@ -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 diff --git a/contractabi/selector.nim b/contractabi/selector.nim index fd46540..8e18049 100644 --- a/contractabi/selector.nim +++ b/contractabi/selector.nim @@ -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]