Update USD value for an issue also when balance changes

* in addition to updating current USD value for open issues every 5
  minutes, update for an issue if change in balance detected
This commit is contained in:
Teemu Patja 2017-09-22 19:27:24 +03:00
parent 8e3762c701
commit b3b2d5eb5c
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
1 changed files with 10 additions and 4 deletions

View File

@ -218,14 +218,19 @@
{:ETH eth-balance})]
(merge all-funds {:total-usd (fiat-util/bounty-usd-value all-funds)})))
(defn update-issue-usd-value
[bounty-addr]
(let [funds (get-bounty-funds bounty-addr)]
(issues/update-usd-value bounty-addr
(:total-usd funds))))
(defn update-open-issue-usd-values
"Sum up current USD values of all crypto assets in a bounty and store to DB"
[]
(doseq [{bounty-addr :contract_address}
(db-bounties/open-bounty-contracts)]
(let [funds (get-bounty-funds bounty-addr)]
(issues/update-usd-value bounty-addr
(:total-usd funds)))))
(update-issue-usd-value bounty-addr)))
(defn update-balances
[]
@ -265,7 +270,8 @@
contract-address
balance-eth
balance-eth-str
token-balances))))))
token-balances)
(update-issue-usd-value contract-address))))))
(defn wrap-in-try-catch [func]