mirror of
https://github.com/status-im/open-bounty.git
synced 2025-02-25 15:45:22 +00:00
Get USD value for token-value map
* get current USD value for an arbirary size token-value map
This commit is contained in:
parent
f379da4924
commit
209698c170
@ -12,3 +12,12 @@
|
||||
(json/read-str))]
|
||||
(-> (get-in m ["ticker" "price"])
|
||||
(read-string))))
|
||||
|
||||
|
||||
(defn bounty-usd-value
|
||||
"Get current USD value of a bounty. bounty is a map of token-name to value"
|
||||
[bounty]
|
||||
(reduce + (map (fn [[token value]]
|
||||
(let [usd-price (get-token-usd-price token)]
|
||||
(* usd-price value)))
|
||||
bounty)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user