From 45526810e75b20e2f4543d46f921a09e6c3705b4 Mon Sep 17 00:00:00 2001 From: Teemu Patja Date: Mon, 28 Aug 2017 19:58:53 +0300 Subject: [PATCH] Add function wrapping multisig executeTransaction * support for calling executeTransaction for a give tx-id in a deployed bounty contract * minor cleanup --- src/clj/commiteth/eth/multisig_wallet.clj | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/clj/commiteth/eth/multisig_wallet.clj b/src/clj/commiteth/eth/multisig_wallet.clj index fc6eb95..ed3c30f 100644 --- a/src/clj/commiteth/eth/multisig_wallet.clj +++ b/src/clj/commiteth/eth/multisig_wallet.clj @@ -200,14 +200,30 @@ (mapv #(.toString %) (.getValue owner-addresses)) []))) +(defn uint256 [x] + (org.web3j.abi.datatypes.generated.Uint256. x)) + (defn is-confirmed? "Returns true if given internal transaction is confirmed in bounty contract." [bounty-addr tx-id] (let [bounty-contract (load-bounty-contract bounty-addr) - tx-id-web3j (org.web3j.abi.datatypes.generated.Uint256. tx-id) + tx-id-web3j (uint256 tx-id) ret (-> bounty-contract (.isConfirmed tx-id-web3j) .get)] (assert ret) (.getValue ret))) + +(defn execute-tx + "Execute internal transaction inside contract, identified by + tx-id. Returns transaction ID. Synchronous, blocks until transaction + is mined." + [bounty-addr tx-id] + (let [bounty-contract (load-bounty-contract bounty-addr) + tx-id-web3j (uint256 tx-id) + ret (-> bounty-contract + (.executeTransaction tx-id-web3j) + .get)] + (assert ret) + (.getTransactionHash ret)))