Ignore empty records in token registry

* ignore records with empty TLA when reading tokenreg data
This commit is contained in:
Teemu Patja 2017-08-21 10:24:14 +03:00
parent a2a569f980
commit c9f7013b66
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
1 changed files with 13 additions and 11 deletions

View File

@ -37,17 +37,19 @@
(let [token-count (-> contract .tokenCount .get .getValue)] (let [token-count (-> contract .tokenCount .get .getValue)]
(log/debug "token-count" token-count) (log/debug "token-count" token-count)
(into {} (into {}
(map (fn [[addr tla digits name owner]] (->> (map (fn [[addr tla digits name owner]]
[(-> tla str keyword) [(-> tla str keyword)
{:tla (str tla) {:tla (str tla)
:name (str name) :name (str name)
:base (.getValue digits) :base (.getValue digits)
:address (str addr) :address (str addr)
:owner (str owner)}]) :owner (str owner)}])
(for [i (range token-count)] (for [i (range token-count)]
(-> (.token contract (-> (.token contract
(org.web3j.abi.datatypes.generated.Uint256. i)) (org.web3j.abi.datatypes.generated.Uint256. i))
.get)))))))) .get)))
;; ignore empty records
(filter (fn [[tla _]] (not= ":" (str tla))))))))))
(defn deploy-parity-tokenreg (defn deploy-parity-tokenreg
"Deploy an instance of parity token-registry to current network" "Deploy an instance of parity token-registry to current network"