From b386a18e3efbc44daee1ae0a572c8c2b7ce8c7c1 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Thu, 7 Apr 2022 14:38:09 +0200 Subject: [PATCH 1/3] Remove asdf .tool-versions --- .tool-versions | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .tool-versions diff --git a/.tool-versions b/.tool-versions deleted file mode 100644 index 40f67df..0000000 --- a/.tool-versions +++ /dev/null @@ -1 +0,0 @@ -nim 1.6.0 From d179f9a11db7da8bdfa41936dd940d6b26ea7d15 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Thu, 7 Apr 2022 14:39:46 +0200 Subject: [PATCH 2/3] Fix solidity type for byte arrays greater than 32 bytes --- contractabi/selector.nim | 5 ++++- tests/contractabi/testSelector.nim | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contractabi/selector.nim b/contractabi/selector.nim index 8cdfa3c..42f827f 100644 --- a/contractabi/selector.nim +++ b/contractabi/selector.nim @@ -40,7 +40,10 @@ solidityType Address, "address" func solidityType*[N: static int, T](_: type array[N, T]): string = when T is byte: - "bytes" & $N + when 0 < N and N <= 32: + "bytes" & $N + else: + "bytes1[" & $N & "]" else: solidityType(T) & "[" & $N & "]" diff --git a/tests/contractabi/testSelector.nim b/tests/contractabi/testSelector.nim index 808d067..913371b 100644 --- a/tests/contractabi/testSelector.nim +++ b/tests/contractabi/testSelector.nim @@ -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[]" From 8e46b6b5f3ef1410f40517608e5cd3a1c9f59bd4 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Thu, 7 Apr 2022 14:40:23 +0200 Subject: [PATCH 3/3] version 0.4.3 --- Readme.md | 2 +- contractabi.nimble | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 199d49b..9f5cf13 100644 --- a/Readme.md +++ b/Readme.md @@ -11,7 +11,7 @@ Use the [Nimble][2] package manager to add `contractabi` to an existing project. Add the following to its .nimble file: ```nim -requires "contractabi >= 0.4.2 & < 0.5.0" +requires "contractabi >= 0.4.3 & < 0.5.0" ``` Usage diff --git a/contractabi.nimble b/contractabi.nimble index 93b8fc6..d8dae48 100644 --- a/contractabi.nimble +++ b/contractabi.nimble @@ -1,4 +1,4 @@ -version = "0.4.2" +version = "0.4.3" author = "Contract ABI Authors" description = "ABI Encoding for Ethereum contracts" license = "MIT"