mirror of
https://github.com/status-im/open-bounty.git
synced 2025-02-23 14:48:13 +00:00
Post "deploying contract" image
Post a PNG image informing that the bounty contract is being deployed immediately after bounty label. Fixes: #26
This commit is contained in:
parent
a3a7ac915b
commit
c93326e874
BIN
resources/public/img/deploying_contract.png
Normal file
BIN
resources/public/img/deploying_contract.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
@ -147,6 +147,7 @@ WITH t AS (
|
|||||||
i.title AS title,
|
i.title AS title,
|
||||||
i.transaction_hash AS transaction_hash,
|
i.transaction_hash AS transaction_hash,
|
||||||
i.contract_address AS contract_address,
|
i.contract_address AS contract_address,
|
||||||
|
i.comment_id AS comment_id,
|
||||||
i.repo_id AS repo_id,
|
i.repo_id AS repo_id,
|
||||||
r.owner AS owner,
|
r.owner AS owner,
|
||||||
r.repo AS repo
|
r.repo AS repo
|
||||||
@ -159,7 +160,7 @@ SET contract_address = :contract_address,
|
|||||||
updated = timezone('utc'::text, now())
|
updated = timezone('utc'::text, now())
|
||||||
FROM t
|
FROM t
|
||||||
WHERE i.issue_id = :issue_id
|
WHERE i.issue_id = :issue_id
|
||||||
RETURNING t.issue_id, t.issue_number, t.title, t.transaction_hash, i.contract_address, t.owner, t.repo, t.repo_id;
|
RETURNING t.issue_id, t.issue_number, t.title, t.transaction_hash, t.comment_id, i.contract_address, t.owner, t.repo, t.repo_id;
|
||||||
|
|
||||||
-- :name update-comment-id :! :n
|
-- :name update-comment-id :! :n
|
||||||
-- :doc updates comment-id for a given issue
|
-- :doc updates comment-id for a given issue
|
||||||
|
@ -23,17 +23,24 @@
|
|||||||
issue-number :number
|
issue-number :number
|
||||||
issue-title :title} issue
|
issue-title :title} issue
|
||||||
created-issue (issues/create repo-id issue-id issue-number issue-title)
|
created-issue (issues/create repo-id issue-id issue-number issue-title)
|
||||||
repo-owner-address (:address (users/get-repo-owner repo-id))]
|
{owner-address :address
|
||||||
(log/debug "Adding bounty for issue " repo issue-number "owner address: " repo-owner-address)
|
owner :owner} (users/get-repo-owner repo-id)]
|
||||||
|
(log/debug "Adding bounty for issue " repo issue-number "owner address: " owner-address)
|
||||||
(if (= 1 created-issue)
|
(if (= 1 created-issue)
|
||||||
(if (empty? repo-owner-address)
|
(if (empty? owner-address)
|
||||||
(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
|
||||||
(log/debug "deploying contract to " repo-owner-address)
|
(->> (github/post-deploying-comment owner
|
||||||
(let [transaction-hash (eth/deploy-contract repo-owner-address)]
|
repo
|
||||||
|
issue-number)
|
||||||
|
:id
|
||||||
|
(issues/update-comment-id issue-id))
|
||||||
|
(log/debug "Posting dep")
|
||||||
|
(log/debug "deploying contract to " 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" repo-owner-address)
|
(log/error "Failed to deploy contract to" owner-address)
|
||||||
(log/info "Contract deployed, transaction-hash:"
|
(log/info "Contract deployed, transaction-hash:"
|
||||||
transaction-hash ))
|
transaction-hash ))
|
||||||
(issues/update-transaction-hash issue-id transaction-hash))))
|
(issues/update-transaction-hash issue-id transaction-hash))))
|
||||||
|
@ -162,6 +162,11 @@
|
|||||||
[alt src]
|
[alt src]
|
||||||
(str "!" (md-url alt src)))
|
(str "!" (md-url alt src)))
|
||||||
|
|
||||||
|
|
||||||
|
(defn generate-deploying-comment
|
||||||
|
[owner repo issue-number]
|
||||||
|
(md-image "Contract deploying" (str (server-address) "/img/deploying_contract.png")))
|
||||||
|
|
||||||
(defn generate-comment
|
(defn generate-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))
|
||||||
@ -174,9 +179,9 @@
|
|||||||
"%s")
|
"%s")
|
||||||
balance-str contract-address image-url site-url)))
|
balance-str contract-address image-url site-url)))
|
||||||
|
|
||||||
(defn post-comment
|
(defn post-deploying-comment
|
||||||
[owner repo issue-number contract-address balance balance-str]
|
[owner repo issue-number]
|
||||||
(let [comment (generate-comment owner repo issue-number contract-address balance balance-str)]
|
(let [comment (generate-deploying-comment owner repo issue-number)]
|
||||||
(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))))
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
(let [issue (issues/update-contract-address issue-id contract-address)
|
(let [issue (issues/update-contract-address issue-id contract-address)
|
||||||
{owner :owner
|
{owner :owner
|
||||||
repo :repo
|
repo :repo
|
||||||
|
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 8)
|
||||||
balance (read-string balance-str)]
|
balance (read-string balance-str)]
|
||||||
@ -34,14 +35,13 @@
|
|||||||
contract-address
|
contract-address
|
||||||
balance
|
balance
|
||||||
balance-str)
|
balance-str)
|
||||||
(->> (github/post-comment owner
|
(github/update-comment owner
|
||||||
repo
|
repo
|
||||||
|
comment-id
|
||||||
issue-number
|
issue-number
|
||||||
contract-address
|
contract-address
|
||||||
balance
|
balance
|
||||||
balance-str)
|
balance-str))))))
|
||||||
:id
|
|
||||||
(issues/update-comment-id issue-id)))))))
|
|
||||||
|
|
||||||
(defn self-sign-bounty
|
(defn self-sign-bounty
|
||||||
"Walks through all issues eligible for bounty payout and signs corresponding transaction"
|
"Walks through all issues eligible for bounty payout and signs corresponding transaction"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user