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 4c35a20feb
commit eb820525bc
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"
"repo owner has no Ethereum addres")
(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)
(let [transaction-hash (multisig/deploy-multisig owner-address)]
(if (nil? transaction-hash)
(log/error "Failed to deploy contract to" owner-address)
(log/info "Contract deployed, transaction-hash:"
transaction-hash ))
(do
(log/info "Contract deployed, 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))))
(log/debug "Issue already exists in DB, ignoring"))))

View File

@ -182,10 +182,21 @@
[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
[owner repo issue-number]
(md-image "Contract deploying" (str (server-address) "/img/deploying_contract.png")))
[owner repo issue-number tx-id]
(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 []
(str "Network: " (if (on-testnet?)
@ -244,8 +255,8 @@
(defn post-deploying-comment
[owner repo issue-number]
(let [comment (generate-deploying-comment owner repo issue-number)]
[owner repo issue-number tx-id]
(let [comment (generate-deploying-comment owner repo issue-number tx-id)]
(log/debug "Posting comment to" (str owner "/" repo "/" issue-number) ":" comment)
(issues/create-comment owner repo issue-number comment (self-auth-params))))