Skip to content

Commit

Permalink
Remember last config passed to basic syncer
Browse files Browse the repository at this point in the history
  • Loading branch information
madis committed Jul 22, 2024
1 parent 5676e3e commit 1e37812
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/src/ethlance/basic_syncer/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
(.readFileSync fs ,,,)
(.parse js/JSON ,,,)))

(def last-config (atom nil))

(defn start-from-ethlance-server-config! [config]
(log/info ">>> START start-from-ethlance-server-config!")
(reset! last-config config)
(let [ethereum-node (get-in config [:web3 :url])
ethlance-json-path (str (get-in config [:smart-contracts :contracts-build-path]) "/Ethlance.json")
ethlance-json (read-json ethlance-json-path)
Expand Down
3 changes: 3 additions & 0 deletions server/src/ethlance/basic_syncer/web3_subscribe.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@
(new (.-Contract (.-eth web3)) abi address))

(def last-event (atom nil))
(def last-config (atom nil))

(defn subscribe! [ethereum-node ethlance-abi ethlance-address]
(log/info "web3-subscribe/subscribe WITH:" {:ethereum-node ethereum-node :ethlance-address ethlance-address :ethlance-abi ethlance-abi})
(reset! last-config [ethereum-node ethlance-abi ethlance-address])

(let [web3 (init-web3 ethereum-node)
contract (init-contract web3 ethlance-abi ethlance-address)]
(.allEvents (g/get contract "events")
Expand Down

0 comments on commit 1e37812

Please sign in to comment.