mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-12 18:44:38 +00:00
Mount component for holding tokenreg data
This commit is contained in:
parent
9c71e37e2a
commit
6acc1bfb96
26
src/clj/commiteth/eth/token_data.clj
Normal file
26
src/clj/commiteth/eth/token_data.clj
Normal file
@ -0,0 +1,26 @@
|
||||
(ns commiteth.eth.token-data
|
||||
(:require [commiteth.eth.token-registry :as token-reg]
|
||||
[commiteth.config :refer [env]]
|
||||
[mount.core :as mount]
|
||||
[clojure.tools.logging :as log]))
|
||||
|
||||
(def token-data-atom (atom {}))
|
||||
|
||||
(mount/defstate
|
||||
token-data
|
||||
:start
|
||||
(do
|
||||
(log/info "token-data started")
|
||||
(let [token-data
|
||||
(if (env :on-testnet true)
|
||||
(env :testnet-token-data {})
|
||||
(token-reg/load-parity-tokenreg-data))]
|
||||
(reset! token-data-atom token-data)))
|
||||
:stop
|
||||
(log/info "token-data stopped"))
|
||||
|
||||
(defn as-map []
|
||||
@token-data-atom)
|
||||
|
||||
(defn token-info [mnemonic]
|
||||
(get @token-data-atom (keyword mnemonic)))
|
Loading…
x
Reference in New Issue
Block a user