Include link to etherscan.io for deployment transaction

* include a link to etherscan.io for a bounty contract's "deploying"
  comment

Fixes: #99
This commit is contained in:
Teemu Patja 2017-10-09 17:09:26 +03:00
parent c10221501a
commit 67754abaf1
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
2 changed files with 25 additions and 12 deletions

View File

@ -31,18 +31,20 @@
(log/error "Unable to deploy bounty contract because" (log/error "Unable to deploy bounty contract because"
"repo owner has no Ethereum addres") "repo owner has no Ethereum addres")
(do (do
(->> (github/post-deploying-comment owner
repo
issue-number)
:id
(issues/update-comment-id issue-id))
(log/debug "Posting dep")
(log/debug "deploying contract to " owner-address) (log/debug "deploying contract to " owner-address)
(let [transaction-hash (eth/deploy-contract owner-address)] (let [transaction-hash (eth/deploy-contract owner-address)]
(if (nil? transaction-hash) (if (nil? transaction-hash)
(log/error "Failed to deploy contract to" owner-address) (log/error "Failed to deploy contract to" owner-address)
(do
(log/info "Contract deployed, transaction-hash:" (log/info "Contract deployed, transaction-hash:"
transaction-hash )) transaction-hash)
(->> (github/post-deploying-comment owner
repo
issue-number
transaction-hash)
:id
(issues/update-comment-id issue-id)))
)
(issues/update-transaction-hash issue-id transaction-hash)))) (issues/update-transaction-hash issue-id transaction-hash))))
(log/debug "Issue already exists in DB, ignoring")))) (log/debug "Issue already exists in DB, ignoring"))))

View File

@ -182,10 +182,21 @@
[alt src] [alt src]
(str "!" (md-url alt src))) (str "!" (md-url alt src)))
(defn etherscan-tx-url [tx-id]
(str "https://"
(when (on-testnet?) "ropsten.")
"etherscan.io/tx/" tx-id))
(defn generate-deploying-comment (defn generate-deploying-comment
[owner repo issue-number] [owner repo issue-number tx-id]
(md-image "Contract deploying" (str (server-address) "/img/deploying_contract.png"))) (let [deploying-image (md-image
"Contract deploying"
(str (server-address) "/img/deploying_contract.png"))
tx-link (md-url tx-id (etherscan-tx-url tx-id))]
(format (str "%s\n"
"Transaction: %s\n")
deploying-image
tx-link)))
(defn network-text [] (defn network-text []
(str "Network: " (if (on-testnet?) (str "Network: " (if (on-testnet?)
@ -225,8 +236,8 @@
(defn post-deploying-comment (defn post-deploying-comment
[owner repo issue-number] [owner repo issue-number tx-id]
(let [comment (generate-deploying-comment owner repo issue-number)] (let [comment (generate-deploying-comment owner repo issue-number tx-id)]
(log/debug "Posting comment to" (str owner "/" repo "/" issue-number) ":" comment) (log/debug "Posting comment to" (str owner "/" repo "/" issue-number) ":" comment)
(issues/create-comment owner repo issue-number comment (self-auth-params)))) (issues/create-comment owner repo issue-number comment (self-auth-params))))