diff --git a/src/clj/commiteth/eth/token_data.clj b/src/clj/commiteth/eth/token_data.clj new file mode 100644 index 0000000..289c5c1 --- /dev/null +++ b/src/clj/commiteth/eth/token_data.clj @@ -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)))