Error handling for token-balance

This commit is contained in:
Teemu Patja 2017-10-31 16:35:12 +02:00
parent 1957c58a3a
commit e8721fadfe
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
1 changed files with 9 additions and 5 deletions

View File

@ -156,11 +156,15 @@
[bounty-addr token]
(let [token-address (get-token-address token)]
(log/debug "token-balance" bounty-addr token token-address)
(-> (eth/call token-address
(:balance-of method-ids)
bounty-addr)
eth/hex->big-integer
(convert-token-value token))))
(try
(-> (eth/call token-address
(:balance-of method-ids)
bounty-addr)
eth/hex->big-integer
(convert-token-value token))
(catch Throwable t
(log/error "Failed to query token balance " t)
0))))
(defn token-balances