From 70e2afbd30054f4459c30ddb24bd1f52dabb3937 Mon Sep 17 00:00:00 2001 From: Teemu Patja Date: Wed, 8 Nov 2017 17:49:36 +0200 Subject: [PATCH] Configurable blacklist for tokens --- env/dev/resources/config.edn | 5 ++++- src/clj/commiteth/eth/token_data.clj | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/env/dev/resources/config.edn b/env/dev/resources/config.edn index d4ba640..1ee9264 100644 --- a/env/dev/resources/config.edn +++ b/env/dev/resources/config.edn @@ -41,4 +41,7 @@ :hubspot-contact-create-enabled false ;; needeed when :hubspot-contact-create-enabled - :hubspot-api-key "xxxxxxx-xxxx-x-xxxx-xxxx"} + :hubspot-api-key "xxxxxxx-xxxx-x-xxxx-xxxx" + + ;; used for blacklisting tokens from token registry data + :token-blacklist #{}} diff --git a/src/clj/commiteth/eth/token_data.clj b/src/clj/commiteth/eth/token_data.clj index 553f4b1..06703f3 100644 --- a/src/clj/commiteth/eth/token_data.clj +++ b/src/clj/commiteth/eth/token_data.clj @@ -6,13 +6,21 @@ (def token-data-atom (atom {})) +(defn token-blacklisted? + [tla] + (let [blacklist (env :token-blacklist #{})] + (blacklist tla))) + + (defn update-data [] (let [test-data (env :testnet-token-data) token-data (if (and (env :on-testnet true) test-data) test-data - (token-reg/load-parity-tokenreg-data))] + (into {} + (filter (fn [[tla _]] (not (token-blacklisted? tla))) + (token-reg/load-parity-tokenreg-data))))] (reset! token-data-atom token-data))) (mount/defstate