From c9f7013b66576bd9dd39071b86ec0f8b2daeb8a0 Mon Sep 17 00:00:00 2001 From: Teemu Patja Date: Mon, 21 Aug 2017 10:24:14 +0300 Subject: [PATCH] Ignore empty records in token registry * ignore records with empty TLA when reading tokenreg data --- src/clj/commiteth/eth/token_registry.clj | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/clj/commiteth/eth/token_registry.clj b/src/clj/commiteth/eth/token_registry.clj index 2543f9d..d96cffe 100644 --- a/src/clj/commiteth/eth/token_registry.clj +++ b/src/clj/commiteth/eth/token_registry.clj @@ -37,17 +37,19 @@ (let [token-count (-> contract .tokenCount .get .getValue)] (log/debug "token-count" token-count) (into {} - (map (fn [[addr tla digits name owner]] - [(-> tla str keyword) - {:tla (str tla) - :name (str name) - :base (.getValue digits) - :address (str addr) - :owner (str owner)}]) - (for [i (range token-count)] - (-> (.token contract - (org.web3j.abi.datatypes.generated.Uint256. i)) - .get)))))))) + (->> (map (fn [[addr tla digits name owner]] + [(-> tla str keyword) + {:tla (str tla) + :name (str name) + :base (.getValue digits) + :address (str addr) + :owner (str owner)}]) + (for [i (range token-count)] + (-> (.token contract + (org.web3j.abi.datatypes.generated.Uint256. i)) + .get))) + ;; ignore empty records + (filter (fn [[tla _]] (not= ":" (str tla)))))))))) (defn deploy-parity-tokenreg "Deploy an instance of parity token-registry to current network"