From 716e72fb5f6ba18057d060fb39736c13e9918fae Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Sat, 18 Sep 2021 13:59:07 +0200 Subject: [PATCH] ENSon Ropsten on PR and e2e builds --- .env.e2e | 2 ++ .env.jenkins | 2 ++ src/status_im/ethereum/core.cljs | 9 ++++++--- src/status_im/ethereum/stateofus.cljs | 9 +++++---- src/status_im/subs.cljs | 4 ++-- src/status_im/utils/config.cljs | 1 + 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.env.e2e b/.env.e2e index 3ea61bc474..9fde207a3f 100644 --- a/.env.e2e +++ b/.env.e2e @@ -26,6 +26,8 @@ ENABLE_REFERRAL_INVITE=1 MAX_IMAGES_BATCH=5 APN_TOPIC=im.status.ethereum.pr VERIFY_TRANSACTION_CHAIN_ID=3 +VERIFY_ENS_CHAIN_ID=3 +TEST_STATEOFUS=1 DATABASE_MANAGEMENT_ENABLED=1 COMMUNITIES_ENABLED=1 COMMUNITIES_MANAGEMENT_ENABLED=1 diff --git a/.env.jenkins b/.env.jenkins index f0b8aff35d..be4fef3629 100644 --- a/.env.jenkins +++ b/.env.jenkins @@ -25,6 +25,8 @@ ENABLE_REFERRAL_INVITE=1 DISABLE_WALLET_ON_MOBILE_NETWORK=1 APN_TOPIC=im.status.ethereum.pr VERIFY_TRANSACTION_CHAIN_ID=3 +VERIFY_ENS_CHAIN_ID=3 +TEST_STATEOFUS=1 BLANK_PREVIEW=0 MAX_IMAGES_BATCH=5 GOOGLE_FREE=0 diff --git a/src/status_im/ethereum/core.cljs b/src/status_im/ethereum/core.cljs index 32b2a46252..c97f460f22 100644 --- a/src/status_im/ethereum/core.cljs +++ b/src/status_im/ethereum/core.cljs @@ -39,6 +39,11 @@ (defn chain-keyword->chain-id [k] (get-in chains [k :id])) +(defn chain-keyword->snt-symbol [k] + (case k + :mainnet :SNT + :STT)) + (defn testnet? [id] (contains? #{(chain-keyword->chain-id :testnet) (chain-keyword->chain-id :rinkeby) @@ -120,9 +125,7 @@ (network->chain-id (get networks current-network))) (defn snt-symbol [db] - (case (chain-keyword db) - :mainnet :SNT - :STT)) + (chain-keyword->snt-symbol (chain-keyword db))) (def default-transaction-gas (money/bignumber 21000)) diff --git a/src/status_im/ethereum/stateofus.cljs b/src/status_im/ethereum/stateofus.cljs index 9482eb43ce..c4712d474b 100644 --- a/src/status_im/ethereum/stateofus.cljs +++ b/src/status_im/ethereum/stateofus.cljs @@ -1,6 +1,7 @@ (ns status-im.ethereum.stateofus (:require [clojure.string :as string] [status-im.ethereum.json-rpc :as json-rpc] + [status-im.utils.config :as config] [status-im.ethereum.ens :as ens])) (def domain "stateofus.eth") @@ -26,10 +27,10 @@ (first (string/split name ".")))) (def old-registrars - {:mainnet "0xDB5ac1a559b02E12F29fC0eC0e37Be8E046DEF49" - ;;NOTE: can be enabled for testing builds - ;;:testnet "0x11d9F481effd20D76cEE832559bd9Aca25405841" - }) + (merge + {:mainnet "0xDB5ac1a559b02E12F29fC0eC0e37Be8E046DEF49"} + (when config/test-stateofus? + {:testnet "0x11d9F481effd20D76cEE832559bd9Aca25405841"}))) (def registrars-cache (atom {})) diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 884b1c9aac..c13bacd274 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -2546,8 +2546,8 @@ :chain chain :amount-label (ens-amount-label chain-id) :sufficient-funds? (money/sufficient-funds? - (money/formatted->internal (money/bignumber 10) :SNT 18) - (get balance :SNT))})) + (money/formatted->internal (money/bignumber 10) (ethereum/chain-keyword->snt-symbol chain) 18) + (get balance (ethereum/chain-keyword->snt-symbol chain)))})) (re-frame/reg-sub :ens/confirmation-screen diff --git a/src/status_im/utils/config.cljs b/src/status_im/utils/config.cljs index d14730d5a4..da07b6f0c9 100644 --- a/src/status_im/utils/config.cljs +++ b/src/status_im/utils/config.cljs @@ -52,6 +52,7 @@ (def eip1559-enabled? (enabled? (get-config :EIP1559_ENABLED "0"))) (def delete-message-enabled? (enabled? (get-config :DELETE_MESSAGE_ENABLED "0"))) (def collectibles-enabled? (enabled? (get-config :COLLECTIBLES_ENABLED "1"))) +(def test-stateofus? (enabled? (get-config :TEST_STATEOFUS "0"))) ;; CONFIG VALUES (def log-level