From 26c44fbf54f9ebf11755b2b6e42c07d554a4f784 Mon Sep 17 00:00:00 2001 From: Jacques Wagener Date: Thu, 27 Jun 2019 18:23:21 +0200 Subject: [PATCH] Restructure files a bit. --- eth_contracts.nimble | 30 ------------------- examples/wrc20.nim | 2 +- examples/wrc202.nim | 4 +-- .../builtin_keywords.nim | 0 .../eth_abi_utils.nim | 2 +- eth_contracts.nim => nimplay/ewasm_eei.nim | 0 eth_macros.nim => nimplay/nimplay_macros.nim | 3 -- 7 files changed, 4 insertions(+), 37 deletions(-) delete mode 100644 eth_contracts.nimble rename builtin_keywords.nim => nimplay/builtin_keywords.nim (100%) rename eth_abi_utils.nim => nimplay/eth_abi_utils.nim (97%) rename eth_contracts.nim => nimplay/ewasm_eei.nim (100%) rename eth_macros.nim => nimplay/nimplay_macros.nim (99%) diff --git a/eth_contracts.nimble b/eth_contracts.nimble deleted file mode 100644 index a22d7d0..0000000 --- a/eth_contracts.nimble +++ /dev/null @@ -1,30 +0,0 @@ -version = "0.1.0" -author = "Status Research & Development GmbH" -description = "Ethereum smart contracts in Nim" -license = "Apache License 2.0" -skipDirs = @["examples"] - -# Dependencies - -requires "nim >= 0.18.1", "stint", "nimcrypto" - -proc buildExample(name: string) = - exec "nim c -d:release --out:examples/" & name & ".wasm examples/" & name - exec "./postprocess.sh examples/" & name & ".wasm" - - -proc buildTool(name: string) = - exec "nim c -d:release --out:tools/" & name & " tools/" & name - - -task examples, "Build examples": - # buildExample("wrc20") - buildExample("wrc202") - # buildExample("hello") - # buildExample("hello2") - # buildExample("hello3") - - -task tools, "Build tools": - buildTool("abi_gen") - buildTool("k256_sig") diff --git a/examples/wrc20.nim b/examples/wrc20.nim index 3856b4e..40814ad 100644 --- a/examples/wrc20.nim +++ b/examples/wrc20.nim @@ -1,7 +1,7 @@ ## ewasm “WRC20” token contract coding challenge ## https://gist.github.com/axic/16158c5c88fbc7b1d09dfa8c658bc363 -import ../eth_contracts, endians +import ../nimplay/ewasm_eei, endians proc do_balance() = if getCallDataSize() != 24: diff --git a/examples/wrc202.nim b/examples/wrc202.nim index bac136e..c02838e 100644 --- a/examples/wrc202.nim +++ b/examples/wrc202.nim @@ -1,5 +1,5 @@ -import ../eth_contracts -import ../eth_macros +import ../nimplay/ewasm_eei +import ../nimplay/nimplay_macros import math diff --git a/builtin_keywords.nim b/nimplay/builtin_keywords.nim similarity index 100% rename from builtin_keywords.nim rename to nimplay/builtin_keywords.nim diff --git a/eth_abi_utils.nim b/nimplay/eth_abi_utils.nim similarity index 97% rename from eth_abi_utils.nim rename to nimplay/eth_abi_utils.nim index ee61aa5..0e6b4d4 100644 --- a/eth_abi_utils.nim +++ b/nimplay/eth_abi_utils.nim @@ -40,7 +40,7 @@ proc generate_method_sig*(func_sig: FunctionSignature, v2_sig: bool = false): st proc getKHash(inp: string): string {.compileTime.} = - let exec_string = "tools/k256_sig \"" & inp & "\"" + let exec_string = "../tools/k256_sig \"" & inp & "\"" let outp_shell = staticExec(exec_string) return outp_shell diff --git a/eth_contracts.nim b/nimplay/ewasm_eei.nim similarity index 100% rename from eth_contracts.nim rename to nimplay/ewasm_eei.nim diff --git a/eth_macros.nim b/nimplay/nimplay_macros.nim similarity index 99% rename from eth_macros.nim rename to nimplay/nimplay_macros.nim index 47e1492..353c541 100644 --- a/eth_macros.nim +++ b/nimplay/nimplay_macros.nim @@ -154,8 +154,6 @@ proc handle_contract_interface(stmts: NimNode): NimNode = discard # raise newException(ParserError, ">> Invalid stmt \"" & getTypeInst(child) & "\" not supported in contract block") - echo function_signatures - if filter(function_signatures, proc(x: FunctionSignature): bool = x.is_private).len == 0: raise newException( ParserError, @@ -204,7 +202,6 @@ proc handle_contract_interface(stmts: NimNode): NimNode = for func_sig in function_signatures: if func_sig.is_private: - echo "!!!" continue echo "Building " & func_sig.method_sig var call_and_copy_block = nnkStmtList.newTree()