Github comment improvements

* add missing "ETH" to github comment
* use 6 decimals instead of 8 for github comment + image
This commit is contained in:
Teemu Patja 2017-08-14 13:18:33 +03:00
parent 209698c170
commit 2bb7790768
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
3 changed files with 9 additions and 8 deletions

View File

@ -191,19 +191,18 @@
(defn generate-open-comment (defn generate-open-comment
[owner repo issue-number contract-address balance balance-str] [owner repo issue-number contract-address balance balance-str]
(let [image-url (md-image "QR Code" (get-qr-url owner repo issue-number balance)) (let [image-url (md-image "QR Code" (get-qr-url owner repo issue-number balance))
balance (str balance-str " ETH")
site-url (md-url (server-address) (server-address))] site-url (md-url (server-address) (server-address))]
(format (str "Current balance: %s\n" (format (str "Current balance: %s ETH\n"
"Contract address: %s\n" "Contract address: %s\n"
"%s\n" "%s\n"
(network-text) (network-text)
"To claim this bounty sign up at %s") "To claim this bounty sign up at %s")
balance-str contract-address image-url site-url))) balance contract-address image-url site-url)))
(defn generate-merged-comment (defn generate-merged-comment
[contract-address balance-str winner-login] [contract-address balance-str winner-login]
(format (str "Balance: %s\n" (format (str "Balance: %s ETH\n"
"Contract address: %s\n" "Contract address: %s\n"
(network-text) (network-text)
"Status: pending maintainer confirmation\n" "Status: pending maintainer confirmation\n"
@ -212,7 +211,7 @@
(defn generate-paid-comment (defn generate-paid-comment
[contract-address balance-str payee-login] [contract-address balance-str payee-login]
(format (str "Balance: %s\n" (format (str "Balance: %s ETH\n"
"Contract address: %s\n" "Contract address: %s\n"
(network-text) (network-text)
"Paid to: %s\n") "Paid to: %s\n")

View File

@ -27,7 +27,7 @@
repo :repo repo :repo
comment-id :comment_id comment-id :comment_id
issue-number :issue_number} issue issue-number :issue_number} issue
balance-str (eth/get-balance-eth contract-address 8) balance-str (eth/get-balance-eth contract-address 6)
balance (read-string balance-str)] balance (read-string balance-str)]
(bounties/update-bounty-comment-image issue-id (bounties/update-bounty-comment-image issue-id
owner owner
@ -158,7 +158,7 @@
old-balance :balance old-balance :balance
issue-number :issue_number} (db-bounties/open-bounty-contracts)] issue-number :issue_number} (db-bounties/open-bounty-contracts)]
(when comment-id (when comment-id
(let [current-balance-eth-str (eth/get-balance-eth contract-address 8) (let [current-balance-eth-str (eth/get-balance-eth contract-address 6)
current-balance-eth (read-string current-balance-eth-str)] current-balance-eth (read-string current-balance-eth-str)]
(log/debug "update-balances" current-balance-eth (log/debug "update-balances" current-balance-eth
current-balance-eth-str owner repo issue-number) current-balance-eth-str owner repo issue-number)

View File

@ -3,7 +3,9 @@
[clojure.data.json :as json])) [clojure.data.json :as json]))
(defn get-token-usd-price [token] (defn get-token-usd-price
"Get current USD value for a token using cryptonator API"
[token]
(let [url (str "https://api.cryptonator.com/api/ticker/" (let [url (str "https://api.cryptonator.com/api/ticker/"
token token
"-usd") "-usd")