-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #382 from district0x/improve-code-quality
Improve code quality
- Loading branch information
Showing
165 changed files
with
5,495 additions
and
4,637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,5 @@ designs/deploy | |
tags | ||
temp | ||
release | ||
.clj-kondo | ||
.lsp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,40 @@ | ||
(ns district.server.async-db) | ||
|
||
(defmacro with-async-resolver-tx [conn & body] | ||
|
||
(defmacro with-async-resolver-tx | ||
[conn & body] | ||
`(js/Promise. | ||
(fn [resolve# reject#] | ||
(.then (district.server.async-db/get-connection) | ||
(fn [~conn] | ||
(district.server.async-db/begin-tx ~conn) | ||
(cljs.core.async/take! (district.shared.async-helpers/safe-go ~@body) | ||
(fn [v-or-err#] | ||
|
||
(if (cljs.core/instance? js/Error v-or-err#) | ||
(do | ||
(district.server.async-db/rollback-tx ~conn) | ||
(district.server.async-db/release-connection ~conn) | ||
(reject# v-or-err#)) | ||
|
||
(do | ||
(district.server.async-db/commit-tx ~conn) | ||
(district.server.async-db/release-connection ~conn) | ||
(resolve# v-or-err#)))))))))) | ||
|
||
(defmacro with-async-resolver-conn [conn & body] | ||
(fn [resolve# reject#] | ||
(.then (district.server.async-db/get-connection) | ||
(fn [~conn] | ||
(district.server.async-db/begin-tx ~conn) | ||
(cljs.core.async/take! (district.shared.async-helpers/safe-go ~@body) | ||
(fn [v-or-err#] | ||
|
||
(if (cljs.core/instance? js/Error v-or-err#) | ||
(do | ||
(district.server.async-db/rollback-tx ~conn) | ||
(district.server.async-db/release-connection ~conn) | ||
(reject# v-or-err#)) | ||
|
||
(do | ||
(district.server.async-db/commit-tx ~conn) | ||
(district.server.async-db/release-connection ~conn) | ||
(resolve# v-or-err#)))))))))) | ||
|
||
|
||
(defmacro with-async-resolver-conn | ||
[conn & body] | ||
`(js/Promise. | ||
(fn [resolve# reject#] | ||
(.then (district.server.async-db/get-connection) | ||
(fn [~conn] | ||
(cljs.core.async/take! (district.shared.async-helpers/safe-go ~@body) | ||
(fn [v-or-err#] | ||
|
||
;; here we have the result so it is safe to release the connection | ||
(district.server.async-db/release-connection ~conn) | ||
|
||
(if (cljs.core/instance? js/Error v-or-err#) | ||
(reject# v-or-err#) | ||
(resolve# v-or-err#))))))))) | ||
(fn [resolve# reject#] | ||
(.then (district.server.async-db/get-connection) | ||
(fn [~conn] | ||
(cljs.core.async/take! (district.shared.async-helpers/safe-go ~@body) | ||
(fn [v-or-err#] | ||
|
||
;; here we have the result so it is safe to release the connection | ||
(district.server.async-db/release-connection ~conn) | ||
|
||
(if (cljs.core/instance? js/Error v-or-err#) | ||
(reject# v-or-err#) | ||
(resolve# v-or-err#))))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
(ns ethlance.server.contract.ethlance | ||
(:require [district.server.smart-contracts :as smart-contracts])) | ||
(:require | ||
[district.server.smart-contracts :as smart-contracts])) | ||
|
||
(defn initialize [job-proxy-address] | ||
|
||
(defn initialize | ||
[job-proxy-address] | ||
(smart-contracts/contract-send :ethlance :initialize [job-proxy-address] {:gas 6000000})) | ||
|
||
|
||
(defn create-job | ||
([creator offered-values arbiters ipfs-data] | ||
(create-job creator offered-values arbiters ipfs-data {})) | ||
|
||
([creator offered-values arbiters ipfs-data merged-opts] | ||
(smart-contracts/contract-send | ||
:ethlance :create-job | ||
[creator offered-values arbiters ipfs-data] | ||
(merge {:gas 6000000} merged-opts)))) | ||
(smart-contracts/contract-send | ||
:ethlance :create-job | ||
[creator offered-values arbiters ipfs-data] | ||
(merge {:gas 6000000} merged-opts)))) |
Oops, something went wrong.