diff --git a/src/clj/commiteth/eth/core.clj b/src/clj/commiteth/eth/core.clj index 77ff156..78c661d 100644 --- a/src/clj/commiteth/eth/core.clj +++ b/src/clj/commiteth/eth/core.clj @@ -14,7 +14,7 @@ (defn gas-price [] - (-> (:gas-price env 2000000000) + (-> (:gas-price env 20000000000) ;; 20 gwei default str BigInteger.)) diff --git a/src/clj/commiteth/eth/multisig_wallet.clj b/src/clj/commiteth/eth/multisig_wallet.clj index 1481224..f7132ef 100644 --- a/src/clj/commiteth/eth/multisig_wallet.clj +++ b/src/clj/commiteth/eth/multisig_wallet.clj @@ -164,4 +164,4 @@ (into {} (map (fn [addr] (let [tla (first (token-data/token-info-by-addr addr))] (assert tla) - [tla {:balance (token-balance bounty-addr tla)}])) token-addresses)))) + [tla (token-balance bounty-addr tla)])) token-addresses)))) diff --git a/src/clj/commiteth/scheduler.clj b/src/clj/commiteth/scheduler.clj index 27f832a..a123605 100644 --- a/src/clj/commiteth/scheduler.clj +++ b/src/clj/commiteth/scheduler.clj @@ -6,6 +6,7 @@ [commiteth.db.issues :as issues] [commiteth.db.bounties :as db-bounties] [commiteth.bounties :as bounties] + [commiteth.util.crypto-fiat-value :as fiat-util] [commiteth.util.util :refer [decimal->str]] [clojure.tools.logging :as log] [mount.core :as mount] @@ -197,6 +198,17 @@ +(defn get-bounty-funds + "Get funds in given bounty contract. + Returns map of asset -> balance + + key total-usd -> current total USD value for all funds" + [bounty-addr] + (let [token-balances (multisig/token-balances bounty-addr) + eth-balance (read-string (eth/get-balance-eth bounty-addr 4))] + (merge token-balances {:ETH eth-balance}))) + + + (defn run-periodic-tasks [time] (do (log/debug "run-periodic-tasks" time) diff --git a/src/clj/commiteth/util/crypto_fiat_value.clj b/src/clj/commiteth/util/crypto_fiat_value.clj index f51ae92..abc0948 100644 --- a/src/clj/commiteth/util/crypto_fiat_value.clj +++ b/src/clj/commiteth/util/crypto_fiat_value.clj @@ -1,5 +1,6 @@ (ns commiteth.util.crypto-fiat-value (:require [clj-http.client :as http] + [clojure.string :as str] [clojure.data.json :as json])) @@ -17,9 +18,10 @@ (defn bounty-usd-value - "Get current USD value of a bounty. bounty is a map of token-name to value" + "Get current USD value of a bounty. bounty is a map of token-tla (keyword) to value" [bounty] (reduce + (map (fn [[token value]] - (let [usd-price (get-token-usd-price token)] + (let [tla (subs (str token) 1) + usd-price (get-token-usd-price tla)] (* usd-price value))) bounty)))