Fix compile errors

* fix cyclic dependency issue
* fix several compile errors
This commit is contained in:
Teemu Patja 2017-08-17 17:06:01 +03:00
parent 6d7f47df4b
commit 7dde94ef65
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
4 changed files with 17 additions and 18 deletions

View File

@ -5,7 +5,7 @@
[commiteth.db.comment-images :as comment-images]
[commiteth.eth.core :as eth]
[commiteth.github.core :as github]
[commiteth.eth.core :as eth]
[commiteth.eth.multisig-wallet :as wallet]
[commiteth.util.png-rendering :as png-rendering]
[clojure.tools.logging :as log]))
@ -38,7 +38,7 @@
(issues/update-comment-id issue-id))
(log/debug "Posting dep")
(log/debug "deploying contract to " owner-address)
(let [transaction-hash (eth/deploy-contract owner-address)]
(let [transaction-hash (wallet/deploy-multisig owner-address)]
(if (nil? transaction-hash)
(log/error "Failed to deploy contract to" owner-address)
(log/info "Contract deployed, transaction-hash:"

View File

@ -6,8 +6,7 @@
[clojure.string :refer [join]]
[clojure.tools.logging :as log]
[clojure.string :as str]
[pandect.core :as pandect]
[commiteth.eth.multisig-wallet :as multisig]))
[pandect.core :as pandect]))
(defn eth-rpc-url [] (env :eth-rpc-url "http://localhost:8545"))
(defn eth-account [] (:eth-account env))
@ -93,11 +92,6 @@
(format "%064x" param)
(clojure.string/replace (format "%64s" (subs param 2)) " " "0")))
(defn deploy-contract
[owner]
(multisig/create-new (eth-account) owner 2))
(defn format-call-params
[method-id & params]
(let [params (join (map format-param params))]

View File

@ -2,7 +2,7 @@
(:require [commiteth.eth.core :as eth]
[clojure.tools.logging :as log]))
(defonce methods
(defonce method-ids
{:submit-transaction (eth/sig->method-id "submitTransaction(address,uint256,bytes)")
:withdraw-everything (eth/sig->method-id "withdrawEverything(address)")
:token-balances (eth/sig->method-id "tokenBalances(address)")
@ -20,19 +20,24 @@
[owner1 owner2 required]
(eth/execute (eth/eth-account)
factory-contract-addr
(:create methods)
(:create method-ids)
0x40
0x2
required
owner1
owner2))
(defn deploy-multisig
[owner]
(create-new (eth/eth-account) owner 2))
(defn execute
[contract to value]
(log/debug "multisig.execute(contract, to, value)" contract to value)
(eth/execute (eth/eth-account)
contract
(:submit-transaction methods)
(:submit-transaction method-ids)
to
value
"0x60"
@ -70,11 +75,11 @@
[contract to]
(log/debug "multisig.send-all(contract, to)" contract to)
(let [params (eth/format-call-params
(:withdraw-everything methods)
(:withdraw-everything method-ids)
to)]
(eth/execute (eth/eth-account)
contract
(:submit-transaction methods)
(:submit-transaction method-ids)
contract
0
"0x60"
@ -87,14 +92,14 @@
(log/debug "multisig.watch-token(contract, token)" contract token)
(eth/execute (eth/eth-account)
contract
(:watch methods)
(:watch method-ids)
token
0))
(defn token-balance
[contract token]
(eth/call contract (:token-balances methods) token))
(eth/call contract (:token-balances method-ids) token))
(defn tokens-list
[contract]
(eth/call contract (:get-token-list methods)))
(eth/call contract (:get-token-list method-ids)))

View File

@ -46,7 +46,7 @@
(defn deploy-contract [owner-address issue-id]
(let [transaction-hash (eth/deploy-contract owner-address)]
(let [transaction-hash (wallet/deploy-multisig owner-address)]
(if (nil? transaction-hash)
(log/error "Failed to deploy contract to" owner-address)
(log/info "Contract deployed, transaction-hash:"