Merge branch 'develop'

This commit is contained in:
Teemu Patja 2017-11-09 16:27:55 +02:00
commit aab5534c74
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
2 changed files with 22 additions and 7 deletions

View File

@ -243,12 +243,14 @@
(defn generate-merged-comment (defn generate-merged-comment
[contract-address eth-balance-str tokens winner-login] [contract-address eth-balance-str tokens winner-login winner-address-missing?]
(format (str "Balance: %s ETH\n" (format (str "Balance: %s ETH\n"
(token-balances-text tokens) (token-balances-text tokens)
(contract-addr-text contract-address) (contract-addr-text contract-address)
(network-text) (network-text)
"Status: pending maintainer confirmation\n" (str "Status: " (if winner-address-missing?
"Pending user to save ETH address"
"Pending maintainer confirmation") "\n")
"Winner: %s\n") "Winner: %s\n")
eth-balance-str winner-login)) eth-balance-str winner-login))
@ -303,14 +305,17 @@
(assoc (self-auth-params) :body comment))] (assoc (self-auth-params) :body comment))]
(tentacles/safe-parse (http/request req))))) (tentacles/safe-parse (http/request req)))))
(defn update-merged-issue-comment (defn update-merged-issue-comment
"Update comment for a bounty issue with winning claim (waiting to be "Update comment for a bounty issue with winning claim (waiting to be
signed off by maintainer)" signed off by maintainer/user ETH address missing)"
[owner repo comment-id contract-address eth-balance-str tokens winner-login] [owner repo comment-id contract-address eth-balance-str tokens winner-login winner-address-missing?]
(let [comment (generate-merged-comment contract-address (let [comment (generate-merged-comment contract-address
eth-balance-str eth-balance-str
tokens tokens
winner-login)] winner-login
winner-address-missing?)]
(log/debug (str "Updating merged bounty issue (" owner "/" repo ")" (log/debug (str "Updating merged bounty issue (" owner "/" repo ")"
" comment#" comment-id " with contents: " comment)) " comment#" comment-id " with contents: " comment))
(let [req (make-patch-request "repos/%s/%s/issues/comments/%s" (let [req (make-patch-request "repos/%s/%s/issues/comments/%s"

View File

@ -93,7 +93,16 @@
winner-login :winner_login} (db-bounties/pending-bounties) winner-login :winner_login} (db-bounties/pending-bounties)
:let [value (eth/get-balance-hex contract-address)]] :let [value (eth/get-balance-hex contract-address)]]
(if (empty? payout-address) (if (empty? payout-address)
(log/error "Cannot sign pending bounty - winner has no payout address") (do
(log/error "Cannot sign pending bounty - winner has no payout address")
(github/update-merged-issue-comment owner
repo
comment-id
contract-address
(eth-decimal->str balance-eth)
tokens
winner-login
true))
(let [execute-hash (multisig/send-all contract-address payout-address)] (let [execute-hash (multisig/send-all contract-address payout-address)]
(log/info "Payout self-signed, called sign-all(" contract-address payout-address ") tx:" execute-hash) (log/info "Payout self-signed, called sign-all(" contract-address payout-address ") tx:" execute-hash)
(db-bounties/update-execute-hash issue-id execute-hash) (db-bounties/update-execute-hash issue-id execute-hash)
@ -104,7 +113,8 @@
contract-address contract-address
(eth-decimal->str balance-eth) (eth-decimal->str balance-eth)
tokens tokens
winner-login))))) winner-login
false)))))
(defn update-confirm-hash (defn update-confirm-hash
"Gets transaction receipt for each pending payout and updates DB confirm_hash with tranaction ID of commiteth bot account's confirmation." "Gets transaction receipt for each pending payout and updates DB confirm_hash with tranaction ID of commiteth bot account's confirmation."