Fix solidity type for byte arrays greater than 32 bytes
This commit is contained in:
parent
b386a18e3e
commit
d179f9a11d
|
@ -40,7 +40,10 @@ solidityType Address, "address"
|
|||
|
||||
func solidityType*[N: static int, T](_: type array[N, T]): string =
|
||||
when T is byte:
|
||||
when 0 < N and N <= 32:
|
||||
"bytes" & $N
|
||||
else:
|
||||
"bytes1[" & $N & "]"
|
||||
else:
|
||||
solidityType(T) & "[" & $N & "]"
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@ suite "function selector":
|
|||
check solidityType(Address) == "address"
|
||||
check solidityType(array[4, byte]) == "bytes4"
|
||||
check solidityType(array[16, byte]) == "bytes16"
|
||||
check solidityType(array[32, byte]) == "bytes32"
|
||||
check solidityType(array[0, byte]) == "bytes1[0]"
|
||||
check solidityType(array[33, byte]) == "bytes1[33]"
|
||||
check solidityType(seq[byte]) == "bytes"
|
||||
check solidityType(array[4, string]) == "string[4]"
|
||||
check solidityType(seq[string]) == "string[]"
|
||||
|
|
Loading…
Reference in New Issue