From 252dd95c84ea1064eb0e763aa79dd49f484e6f1d Mon Sep 17 00:00:00 2001 From: Remon Nashid Date: Wed, 30 Oct 2019 12:04:44 -0700 Subject: [PATCH 01/13] chore: support Goerli network --- .../new-polymath-issuer/config/.env.local | 1 + .../config/.env.required.local | 1 + .../new-polymath-issuer/config/.env.tests | 2 + .../src/constants/network.ts | 14 ++ .../pages/DividendsWizard/Step-3/index.tsx | 1 + .../new-polymath-sdk/src/LowLevel/types.ts | 1 + .../src/constants/network.ts | 2 + packages/polymath-investor/.env.local | 3 + packages/polymath-investor/README.md | 1 + packages/polymath-investor/src/RouteLoader.js | 5 +- packages/polymath-issuer/.env.local | 6 +- packages/polymath-issuer/README.md | 1 + .../src/components/ProtectedPages.js | 2 +- .../polymath-issuer/src/components/Root.js | 5 +- packages/polymath-offchain/.env.local | 4 + packages/polymath-offchain/README.md | 2 + packages/polymath-offchain/src/constants.js | 37 +++- .../polymath-offchain/src/startup/index.js | 6 + packages/polymath-shared/src/constants.js | 3 + .../components/EthNetworkWrapper/networks.js | 8 + .../polymath-ui/src/redux/account/actions.js | 174 ++++++++++++------ 21 files changed, 212 insertions(+), 67 deletions(-) diff --git a/packages/new-polymath-issuer/config/.env.local b/packages/new-polymath-issuer/config/.env.local index adc59a02a..070fcc813 100644 --- a/packages/new-polymath-issuer/config/.env.local +++ b/packages/new-polymath-issuer/config/.env.local @@ -3,5 +3,6 @@ PORT=3000 PUBLIC_URL=http://localhost:3000 POLYMATH_REGISTRY_ADDRESS_LOCAL=0x9FBDa871d559710256a2502A2517b794B482Db40 POLYMATH_REGISTRY_ADDRESS_KOVAN=0x577cf8c535f9c814e74d07197d94a3ea10bc0714 +POLYMATH_REGISTRY_ADDRESS_GOERLI=0x7e3c8aF98538Ba19A10Dfc7E8F5469a76998b0f0 NETWORK_WS_PROVIDER_LOCAL=ws://localhost:8545 DEPLOYMENT_STAGE=local \ No newline at end of file diff --git a/packages/new-polymath-issuer/config/.env.required.local b/packages/new-polymath-issuer/config/.env.required.local index 78f8ae470..0cce747e3 100644 --- a/packages/new-polymath-issuer/config/.env.required.local +++ b/packages/new-polymath-issuer/config/.env.required.local @@ -4,6 +4,7 @@ POLYMATH_OFFCHAIN_URL= PORT= POLYMATH_REGISTRY_ADDRESS_LOCAL= POLYMATH_REGISTRY_ADDRESS_KOVAN= +POLYMATH_REGISTRY_ADDRESS_GOERLI= NETWORK_WS_PROVIDER_LOCAL= DEPLOYMENT_STAGE= PUBLIC_URL= \ No newline at end of file diff --git a/packages/new-polymath-issuer/config/.env.tests b/packages/new-polymath-issuer/config/.env.tests index 47c64e60f..ea3bedc17 100644 --- a/packages/new-polymath-issuer/config/.env.tests +++ b/packages/new-polymath-issuer/config/.env.tests @@ -4,7 +4,9 @@ POLYMATH_OFFCHAIN_URL=https://foo.com PORT=1234 POLYMATH_REGISTRY_ADDRESS_LOCAL=1234 POLYMATH_REGISTRY_ADDRESS_KOVAN=5678 +POLYMATH_REGISTRY_ADDRESS_GOERLI=6543 NETWORK_WS_PROVIDER_KOVAN=wss://kovanwsproviderurl.com +NETWORK_WS_PROVIDER_GOERLI=wss://goerliwsproviderurl.com NETWORK_WS_PROVIDER_LOCAL=wss://localwsproviderurl.com DEPLOYMENT_STAGE=local PUBLIC_URL=https://foo.com \ No newline at end of file diff --git a/packages/new-polymath-issuer/src/constants/network.ts b/packages/new-polymath-issuer/src/constants/network.ts index 10643ca24..690a6342c 100644 --- a/packages/new-polymath-issuer/src/constants/network.ts +++ b/packages/new-polymath-issuer/src/constants/network.ts @@ -5,10 +5,14 @@ export const POLYMATH_REGISTRY_ADDRESS_LOCAL = process.env .POLYMATH_REGISTRY_ADDRESS_LOCAL as string; export const POLYMATH_REGISTRY_ADDRESS_KOVAN = process.env .POLYMATH_REGISTRY_ADDRESS_KOVAN as string; +export const POLYMATH_REGISTRY_ADDRESS_GOERLI = process.env + .POLYMATH_REGISTRY_ADDRESS_GOERLI as string; export const WS_PROVIDER_LOCAL = process.env .NETWORK_WS_PROVIDER_LOCAL as string; export const WS_PROVIDER_KOVAN = process.env .NETWORK_WS_PROVIDER_LOCAL as string; +export const WS_PROVIDER_GOERLI = process.env + .NETWORK_WS_PROVIDER_LOCAL as string; export const WS_PROVIDER_MAINNET = process.env .NETWORK_WS_PROVIDER_LOCAL as string; @@ -17,6 +21,7 @@ interface NetworkConfig { } let kovanConfig: NetworkConfig = {}; +let goerliConfig: NetworkConfig = {}; let localConfig: NetworkConfig = {}; if (POLYMATH_REGISTRY_ADDRESS_KOVAN) { @@ -27,6 +32,14 @@ if (POLYMATH_REGISTRY_ADDRESS_KOVAN) { }, }; } +if (POLYMATH_REGISTRY_ADDRESS_GOERLI) { + goerliConfig = { + [constants.NetworkIds.GOERLI]: { + polymathRegistryAddress: POLYMATH_REGISTRY_ADDRESS_GOERLI, + wsProviderUrl: WS_PROVIDER_GOERLI, + }, + }; +} if (POLYMATH_REGISTRY_ADDRESS_LOCAL) { localConfig = { [constants.NetworkIds.Local]: { @@ -38,5 +51,6 @@ if (POLYMATH_REGISTRY_ADDRESS_LOCAL) { export const POLY_CLIENT_PARAMS = { ...kovanConfig, + ...goerliConfig, ...localConfig, }; diff --git a/packages/new-polymath-issuer/src/pages/DividendsWizard/Step-3/index.tsx b/packages/new-polymath-issuer/src/pages/DividendsWizard/Step-3/index.tsx index 015ca7a68..10ffd7720 100644 --- a/packages/new-polymath-issuer/src/pages/DividendsWizard/Step-3/index.tsx +++ b/packages/new-polymath-issuer/src/pages/DividendsWizard/Step-3/index.tsx @@ -129,6 +129,7 @@ const Step3Base: FC = ({ const isTestNet = [ constants.NetworkIds.Kovan, + constants.NetworkIds.Goerli, constants.NetworkIds.Local, constants.NetworkIds.LocalVm, ].includes(networkId); diff --git a/packages/new-polymath-sdk/src/LowLevel/types.ts b/packages/new-polymath-sdk/src/LowLevel/types.ts index 1c3fd90f4..470b8c764 100644 --- a/packages/new-polymath-sdk/src/LowLevel/types.ts +++ b/packages/new-polymath-sdk/src/LowLevel/types.ts @@ -310,6 +310,7 @@ export enum NetworkIds { Local = 15, LocalVm = 16, Kovan = 42, + Goerli = 5, Mainnet = 1, Ropsten = 3, Rinkeby = 4, diff --git a/packages/new-polymath-shared/src/constants/network.ts b/packages/new-polymath-shared/src/constants/network.ts index 43ad149d6..20c8efa4b 100644 --- a/packages/new-polymath-shared/src/constants/network.ts +++ b/packages/new-polymath-shared/src/constants/network.ts @@ -4,6 +4,7 @@ export enum NetworkIds { Local = 15, LocalVm = 16, Kovan = 42, + Goerli = 5, Mainnet = 1, Ropsten = 3, Rinkeby = 4, @@ -13,6 +14,7 @@ export const EtherscanSubdomains: { [key: number]: string; } = { [NetworkIds.Kovan]: 'kovan', + [NetworkIds.Goerli]: 'goerli', [NetworkIds.Ropsten]: 'ropsten', [NetworkIds.Mainnet]: '', [NetworkIds.Local]: 'localhost', diff --git a/packages/polymath-investor/.env.local b/packages/polymath-investor/.env.local index 7f058a9e4..be55753f0 100644 --- a/packages/polymath-investor/.env.local +++ b/packages/polymath-investor/.env.local @@ -2,6 +2,7 @@ # Blockchain node URLs # ------------------------------------------------------------------------------ # * REACT_APP_NETWORK_KOVAN_WS: Kovan node's websocket url +# * REACT_APP_NETWORK_GOERLI_WS: Goerli node's websocket url # * REACT_APP_NETWORK_MAIN_WS: Mainnet node's websocket url # * REACT_APP_NETWORK_LOCAL_WS: Local blockchain network's url # * REACT_APP_NODE_WS: Legacy env variable used to override websocket url to @@ -13,6 +14,8 @@ # contract for the local network # * REACT_APP_POLYMATH_REGISTRY_ADDRESS_KOVAN: address of the polymath registry # contract for the kovan network +# * REACT_APP_POLYMATH_REGISTRY_ADDRESS_GOERLI: address of the polymath registry +# contract for the goerli network # * REACT_APP_POLYMATH_REGISTRY_ADDRESS_MAINNET: address of the polymath registry # contract for the mainnet network # diff --git a/packages/polymath-investor/README.md b/packages/polymath-investor/README.md index 0613cb9d0..d6c179c13 100755 --- a/packages/polymath-investor/README.md +++ b/packages/polymath-investor/README.md @@ -9,4 +9,5 @@ You can set the following env vars inside a `.env` file on the package's root `REACT_APP_NETWORK_KOVAN_WS`: To connect to Kovan locally +`REACT_APP_NETWORK_GOERLI_WS`: To connect to Goerli locally `REACT_APP_NETWORK_MAIN_WS`: To connect to the Mainnet locally diff --git a/packages/polymath-investor/src/RouteLoader.js b/packages/polymath-investor/src/RouteLoader.js index 2824bc4dd..14a9788af 100755 --- a/packages/polymath-investor/src/RouteLoader.js +++ b/packages/polymath-investor/src/RouteLoader.js @@ -7,6 +7,7 @@ import { Loading } from 'carbon-components-react'; import { MetamaskStatus } from '@polymathnetwork/ui'; import { KOVAN_NETWORK_ID, + GOERLI_NETWORK_ID, MAINNET_NETWORK_ID, } from '@polymathnetwork/shared/constants'; import EthNetworkWrapper from '@polymathnetwork/ui/components/EthNetworkWrapper'; @@ -22,11 +23,11 @@ type Props = { class RouteLoader extends Component { render() { - const networks = [MAINNET_NETWORK_ID, KOVAN_NETWORK_ID]; + const networks = [MAINNET_NETWORK_ID, KOVAN_NETWORK_ID, GOERLI_NETWORK_ID]; return ( } - guide={} + guide={} networks={networks} > {renderRoutes(routes)} diff --git a/packages/polymath-issuer/.env.local b/packages/polymath-issuer/.env.local index 76fd067b0..b7dac8f9c 100644 --- a/packages/polymath-issuer/.env.local +++ b/packages/polymath-issuer/.env.local @@ -2,6 +2,7 @@ # Blockchain node URLs # ------------------------------------------------------------------------------ # * REACT_APP_NETWORK_KOVAN_WS: Kovan node's websocket url +# * REACT_APP_NETWORK_GOERLI_WS: Goerli node's websocket url # * REACT_APP_NETWORK_MAIN_WS: Mainnet node's websocket url # * REACT_APP_NETWORK_LOCAL_WS: Local blockchain network's url # * REACT_APP_NETWORK_LOCALVM_WS: LocalVM blockchain network's url (used for @@ -13,8 +14,8 @@ # ------------------------------------------------------------------------------ # * REACT_APP_POLYMATH_REGISTRY_ADDRESS_LOCAL: address of the polymath registry # contract for the local network -# * REACT_APP_POLYMATH_REGISTRY_ADDRESS_KOVAN: address of the polymath registry -# contract for the kovan network +# * REACT_APP_POLYMATH_REGISTRY_ADDRESS_GOERLI: address of the polymath registry +# contract for the goerli network # * REACT_APP_POLYMATH_REGISTRY_ADDRESS_MAINNET: address of the polymath registry # contract for the mainnet network # @@ -40,4 +41,5 @@ REACT_APP_POLYMATH_OFFCHAIN_ADDRESS=http://localhost:3001 REACT_APP_POLYMATH_REGISTRY_ADDRESS_LOCAL=0x9FBDa871d559710256a2502A2517b794B482Db40 REACT_APP_DEPLOYMENT_STAGE=local REACT_APP_POLYMATH_REGISTRY_ADDRESS_KOVAN=0x5b215a7d39ee305ad28da29bf2f0425c6c2a00b3 +REACT_APP_POLYMATH_REGISTRY_ADDRESS_GOERLI=0x7e3c8aF98538Ba19A10Dfc7E8F5469a76998b0f0 REACT_APP_ALLOW_GANACHE_ONLY=false \ No newline at end of file diff --git a/packages/polymath-issuer/README.md b/packages/polymath-issuer/README.md index 672f54030..81aefe1f4 100644 --- a/packages/polymath-issuer/README.md +++ b/packages/polymath-issuer/README.md @@ -13,6 +13,7 @@ You can set the following env vars inside a `.env` file on the package's root `REACT_APP_NETWORK_KOVAN_WS`: To connect to Kovan locally +`REACT_APP_NETWORK_GOERLI_WS`: To connect to Goerli locally `REACT_APP_NETWORK_MAIN_WS`: To connect to the Mainnet locally `REACT_APP_ALLOW_GANACHE_ONLY`: Allows usage of ganache without Metamask when running in local stage diff --git a/packages/polymath-issuer/src/components/ProtectedPages.js b/packages/polymath-issuer/src/components/ProtectedPages.js index 136f483d3..6972ed1d8 100644 --- a/packages/polymath-issuer/src/components/ProtectedPages.js +++ b/packages/polymath-issuer/src/components/ProtectedPages.js @@ -28,7 +28,7 @@ class ProtectedPages extends Component { Loading={} errorRender={({ networkError, onRequestAuth }) => ( diff --git a/packages/polymath-issuer/src/components/Root.js b/packages/polymath-issuer/src/components/Root.js index 81e0d1724..7deaf1d4a 100644 --- a/packages/polymath-issuer/src/components/Root.js +++ b/packages/polymath-issuer/src/components/Root.js @@ -23,6 +23,7 @@ import { import { MAINNET_NETWORK_ID, KOVAN_NETWORK_ID, + GOERLI_NETWORK_ID, EtherscanSubdomains, } from '@polymathnetwork/shared/constants'; import { ModalTransactionQueue } from '@polymathnetwork/new-issuer/components/ModalTransactionQueue'; @@ -65,7 +66,7 @@ class Root extends Component { render() { const { routes, location, transactionLinkSubdomain } = this.props; const isUnsupportedBrowser = !isChrome && !isFirefox && !isOpera; - const networks = [MAINNET_NETWORK_ID, KOVAN_NETWORK_ID]; + const networks = [MAINNET_NETWORK_ID, GOERLI_NETWORK_ID, KOVAN_NETWORK_ID]; // FIXME @RafaelVidaurre: Remove this hack, only used for temporary maintenance mode if (window.location.pathname === '/maintenance') { @@ -92,7 +93,7 @@ class Root extends Component { Loading={} errorRender={({ networkError, onRequestAuth }) => ( diff --git a/packages/polymath-offchain/.env.local b/packages/polymath-offchain/.env.local index c3de9b3d0..870296339 100644 --- a/packages/polymath-offchain/.env.local +++ b/packages/polymath-offchain/.env.local @@ -5,11 +5,14 @@ # for cross-browser testing) # * WEB3_NETWORK_LOCAL_WS: LOCAL URL for the web3 WebsocketProvider # * WEB3_NETWORK_KOVAN_WS: KOVAN URL for the web3 WebsocketProvider +# * WEB3_NETWORK_GOERLI_WS: GOERLI URL for the web3 WebsocketProvider # * WEB3_NETWORK_MAINNET_WS: MAINNET URL for the web3 WebsocketProvider # * POLYMATH_REGISTRY_ADDRESS_LOCAL: Address of the deployed PolymathRegistry # in the local blockchain # * POLYMATH_REGISTRY_ADDRESS_KOVAN: Address of the deployed PolymathRegistry # in the Kovan testnet +# * POLYMATH_REGISTRY_ADDRESS_GOERLI: Address of the deployed PolymathRegistry +# in the Goerli testnet # * POLYMATH_REGISTRY_ADDRESS_MAINNET: Address of the deployed PolymathRegistry # in Mainnet # @@ -38,6 +41,7 @@ WEB3_NETWORK_LOCAL_WS="ws://localhost:8545" POLYMATH_REGISTRY_ADDRESS_LOCAL="0x9FBDa871d559710256a2502A2517b794B482Db40" POLYMATH_REGISTRY_ADDRESS_KOVAN=0x5b215a7d39ee305ad28da29bf2f0425c6c2a00b3 +POLYMATH_REGISTRY_ADDRESS_GOERLI=0x7e3c8aF98538Ba19A10Dfc7E8F5469a76998b0f0 PORT="3001" CRITICAL_RETRIES="5" diff --git a/packages/polymath-offchain/README.md b/packages/polymath-offchain/README.md index 72877dfe5..ccad72931 100644 --- a/packages/polymath-offchain/README.md +++ b/packages/polymath-offchain/README.md @@ -15,10 +15,12 @@ Depending on the deployment stage, you will have to set one or more of the follo `WEB3_NETWORK_LOCAL_WS`: LOCAL URL for the web3 WebsocketProvider (mandatory in local, optional in staging and production) `WEB3_NETWORK_LOCALVM_WS`: LOCAL VM URL for the web3 WebSocketProvider (used for cross-browser testing, optional in all stages. If this is set then `WEB3_NETWORK_LOCAL_WS` cannot be set and vice-versa) `WEB3_NETWORK_KOVAN_WS`: KOVAN URL for the web3 WebsocketProvider (optional in local, mandatory in staging and production) +`WEB3_NETWORK_GOERLI_WS`: GOERLI URL for the web3 WebsocketProvider (optional in local, mandatory in staging and production) `WEB3_NETWORK_MAINNET_WS`: MAINNET URL for the web3 WebsocketProvider (unused in local and staging, mandatory in production) `POLYMATH_REGISTRY_ADDRESS_LOCAL`: Address of the deployed PolymathRegistry in the local blockchain (mandatory in local, optional in staging and production) `POLYMATH_REGISTRY_ADDRESS_KOVAN`: Address of the deployed PolymathRegistry in the Kovan testnet (optional in local, mandatory in staging and production) +`POLYMATH_REGISTRY_ADDRESS_GOERLI`: Address of the deployed PolymathRegistry in the Goerli testnet (optional in local, mandatory in staging and production) `POLYMATH_REGISTRY_ADDRESS_MAINNET`: Address of the deployed PolymathRegistry in Mainnet (unused in local and staging, mandatory in production) `PORT`: Web server's port diff --git a/packages/polymath-offchain/src/constants.js b/packages/polymath-offchain/src/constants.js index 94af39e16..fd62d382b 100644 --- a/packages/polymath-offchain/src/constants.js +++ b/packages/polymath-offchain/src/constants.js @@ -5,6 +5,7 @@ import { LOCAL_NETWORK_ID, LOCALVM_NETWORK_ID, KOVAN_NETWORK_ID, + GOERLI_NETWORK_ID, MAINNET_NETWORK_ID, } from '@polymathnetwork/shared/constants'; @@ -26,9 +27,11 @@ type Environment = {| WEB3_NETWORK_LOCALVM_WS?: string, WEB3_NETWORK_LOCAL_WS?: string, WEB3_NETWORK_KOVAN_WS?: string, + WEB3_NETWORK_GOERLI_WS?: string, WEB3_NETWORK_MAINNET_WS?: string, POLYMATH_REGISTRY_ADDRESS_LOCAL?: string, POLYMATH_REGISTRY_ADDRESS_KOVAN?: string, + POLYMATH_REGISTRY_ADDRESS_GOERLI?: string, POLYMATH_REGISTRY_ADDRESS_MAINNET?: string, PORT: string, POLYMATH_OFFCHAIN_URL: string, @@ -54,9 +57,11 @@ const { WEB3_NETWORK_LOCALVM_WS, WEB3_NETWORK_LOCAL_WS, WEB3_NETWORK_KOVAN_WS, + WEB3_NETWORK_GOERLI_WS, WEB3_NETWORK_MAINNET_WS, POLYMATH_REGISTRY_ADDRESS_LOCAL, POLYMATH_REGISTRY_ADDRESS_KOVAN, + POLYMATH_REGISTRY_ADDRESS_GOERLI, POLYMATH_REGISTRY_ADDRESS_MAINNET, } = env; @@ -123,6 +128,15 @@ export const NETWORKS: { localNetwork: false, polymathRegistryAddress: POLYMATH_REGISTRY_ADDRESS_KOVAN || '', }, + [GOERLI_NETWORK_ID]: { + name: 'goerli', + url: WEB3_NETWORK_GOERLI_WS || '', + connect: false, + optional: true, + maxRetries: OPTIONAL_RETRIES, + localNetwork: false, + polymathRegistryAddress: POLYMATH_REGISTRY_ADDRESS_GOERLI || '', + }, [MAINNET_NETWORK_ID]: { name: 'mainnet', url: WEB3_NETWORK_MAINNET_WS || '', @@ -135,9 +149,9 @@ export const NETWORKS: { }; /** - * - Production offchain MUST listen to Mainnet and Kovan and can optionally + * - Production offchain MUST listen to Mainnet, Kovan and Goerli and can optionally * listen to the local blockchain - * - Staging offchain MUST listen to kovan and can optionally listen to + * - Staging offchain MUST listen to kovan and goerli, and can optionally listen to * the local blockchain * - Local offchain MUST listen to either the local blockchain or the * localVM blockchain @@ -146,11 +160,18 @@ if (DEPLOYMENT_STAGE !== 'local') { if (!WEB3_NETWORK_KOVAN_WS) { throw new Error('Missing env variable WEB3_NETWORK_KOVAN_WS'); } + if (!WEB3_NETWORK_GOERLI_WS) { + throw new Error('Missing env variable WEB3_NETWORK_GOERLI_WS'); + } NETWORKS[KOVAN_NETWORK_ID].connect = true; NETWORKS[KOVAN_NETWORK_ID].optional = false; NETWORKS[KOVAN_NETWORK_ID].maxRetries = CRITICAL_RETRIES; + NETWORKS[GOERLI_NETWORK_ID].connect = true; + NETWORKS[GOERLI_NETWORK_ID].optional = false; + NETWORKS[GOERLI_NETWORK_ID].maxRetries = CRITICAL_RETRIES; + if (WEB3_NETWORK_LOCAL_WS && POLYMATH_REGISTRY_ADDRESS_LOCAL) { NETWORKS[LOCAL_NETWORK_ID].connect = true; NETWORKS[LOCAL_NETWORK_ID].optional = true; @@ -173,6 +194,9 @@ if (DEPLOYMENT_STAGE !== 'local') { if (!POLYMATH_REGISTRY_ADDRESS_KOVAN) { throw new Error('Missing env variable POLYMATH_REGISTRY_ADDRESS_KOVAN'); } + if (!POLYMATH_REGISTRY_ADDRESS_GOERLI) { + throw new Error('Missing env variable POLYMATH_REGISTRY_ADDRESS_GOERLI'); + } NETWORKS[MAINNET_NETWORK_ID].connect = true; NETWORKS[MAINNET_NETWORK_ID].optional = false; @@ -181,14 +205,23 @@ if (DEPLOYMENT_STAGE !== 'local') { NETWORKS[ KOVAN_NETWORK_ID ].polymathRegistryAddress = POLYMATH_REGISTRY_ADDRESS_KOVAN; + NETWORKS[ + GOERLI_NETWORK_ID + ].polymathRegistryAddress = POLYMATH_REGISTRY_ADDRESS_GOERLI; } else { if (!POLYMATH_REGISTRY_ADDRESS_KOVAN) { throw new Error('Missing env variable POLYMATH_REGISTRY_ADDRESS_KOVAN'); } + if (!POLYMATH_REGISTRY_ADDRESS_GOERLI) { + throw new Error('Missing env variable POLYMATH_REGISTRY_ADDRESS_GOERLI'); + } NETWORKS[ KOVAN_NETWORK_ID ].polymathRegistryAddress = POLYMATH_REGISTRY_ADDRESS_KOVAN; + NETWORKS[ + GOERLI_NETWORK_ID + ].polymathRegistryAddress = POLYMATH_REGISTRY_ADDRESS_GOERLI; } } else { if (!WEB3_NETWORK_LOCAL_WS && !WEB3_NETWORK_LOCALVM_WS) { diff --git a/packages/polymath-offchain/src/startup/index.js b/packages/polymath-offchain/src/startup/index.js index 70d164b81..9dd86bdf1 100644 --- a/packages/polymath-offchain/src/startup/index.js +++ b/packages/polymath-offchain/src/startup/index.js @@ -5,6 +5,7 @@ import { LOCAL_NETWORK_ID, LOCALVM_NETWORK_ID, KOVAN_NETWORK_ID, + GOERLI_NETWORK_ID, MAINNET_NETWORK_ID, } from '@polymathnetwork/shared/constants'; import { NETWORKS } from '../constants'; @@ -59,6 +60,7 @@ const connectToNetwork = async (networkId: string, options: NetworkOptions) => { [LOCAL_NETWORK_ID]: local, [LOCALVM_NETWORK_ID]: localVM, [KOVAN_NETWORK_ID]: kovan, + [GOERLI_NETWORK_ID]: goerli, [MAINNET_NETWORK_ID]: mainnet, } = NETWORKS; @@ -74,6 +76,10 @@ const connectToNetwork = async (networkId: string, options: NetworkOptions) => { await connectToNetwork(KOVAN_NETWORK_ID, kovan); } + if (goerli.connect) { + await connectToNetwork(GOERLI_NETWORK_ID, goerli); + } + if (mainnet.connect) { await connectToNetwork(MAINNET_NETWORK_ID, mainnet); } diff --git a/packages/polymath-shared/src/constants.js b/packages/polymath-shared/src/constants.js index cdecbb87d..2a0a7d50e 100644 --- a/packages/polymath-shared/src/constants.js +++ b/packages/polymath-shared/src/constants.js @@ -3,6 +3,7 @@ import PolyTokenFaucetArtifact from '@polymathnetwork/polymath-scripts/fixtures/contracts/PolyTokenFaucet.json'; export const KOVAN_NETWORK_ID = '42'; +export const GOERLI_NETWORK_ID = '5'; export const MAINNET_NETWORK_ID = '1'; export const LOCAL_NETWORK_ID = '15'; export const LOCALVM_NETWORK_ID = '16'; @@ -24,6 +25,7 @@ const faucetAddress = export const DAI_ADDRESSES: DaiAddresses = { [MAINNET_NETWORK_ID]: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', [KOVAN_NETWORK_ID]: '0xc4375b7de8af5a38a93548eb8453a498222c4ff2', + [GOERLI_NETWORK_ID]: faucetAddress, [LOCAL_NETWORK_ID]: faucetAddress, [LOCALVM_NETWORK_ID]: faucetAddress, }; @@ -35,5 +37,6 @@ export const MIN_SAFE_NUMBER = -99999999999999; export const EtherscanSubdomains = { [KOVAN_NETWORK_ID]: 'kovan', + [GOERLI_NETWORK_ID]: 'goerli', [LOCAL_NETWORK_ID]: 'localhost', }; diff --git a/packages/polymath-ui/src/components/EthNetworkWrapper/networks.js b/packages/polymath-ui/src/components/EthNetworkWrapper/networks.js index aa8f14788..f4d5fd1d3 100644 --- a/packages/polymath-ui/src/components/EthNetworkWrapper/networks.js +++ b/packages/polymath-ui/src/components/EthNetworkWrapper/networks.js @@ -6,6 +6,7 @@ import { ROPSTEN_NETWORK_ID, RINKEBY_NETWORK_ID, KOVAN_NETWORK_ID, + GOERLI_NETWORK_ID, MAINNET_NETWORK_ID, } from '@polymathnetwork/shared/constants'; @@ -18,10 +19,12 @@ type Network = { const { REACT_APP_NETWORK_MAIN_WS, REACT_APP_NETWORK_KOVAN_WS, + REACT_APP_NETWORK_GOERLI_WS, REACT_APP_NETWORK_LOCAL_WS, REACT_APP_NETWORK_LOCALVM_WS, REACT_APP_POLYMATH_REGISTRY_ADDRESS_LOCAL, REACT_APP_POLYMATH_REGISTRY_ADDRESS_KOVAN, + REACT_APP_POLYMATH_REGISTRY_ADDRESS_GOERLI, REACT_APP_POLYMATH_REGISTRY_ADDRESS_MAINNET, } = process.env; @@ -45,6 +48,11 @@ export function getNetworkInfo(id: string = LOCAL_NETWORK_ID): Network { url: REACT_APP_NETWORK_KOVAN_WS, polymathRegistryAddress: REACT_APP_POLYMATH_REGISTRY_ADDRESS_KOVAN, }, + [GOERLI_NETWORK_ID]: { + name: 'Goerli Testnet', + url: REACT_APP_NETWORK_GOERLI_WS, + polymathRegistryAddress: REACT_APP_POLYMATH_REGISTRY_ADDRESS_GOERLI, + }, [LOCAL_NETWORK_ID]: { name: 'Localhost', url: REACT_APP_NETWORK_LOCAL_WS, diff --git a/packages/polymath-ui/src/redux/account/actions.js b/packages/polymath-ui/src/redux/account/actions.js index 9308c7193..fcaa91152 100644 --- a/packages/polymath-ui/src/redux/account/actions.js +++ b/packages/polymath-ui/src/redux/account/actions.js @@ -351,63 +351,121 @@ export const faucet = (message: string, amount?: number = 100500) => async ( ) ); return; + } else if (Number(getState().network.id) === 42) { + const buttonLabel = `REQUEST ${amount / 1000}K POLY`; + dispatch( + confirm( +
+ {intro} +

+ You are currently connected to the{' '} + Kovan Test Network. +

+

+ As such, you can click on the « + {buttonLabel} + » button below to receive {thousandsDelimiter(amount)} test + POLY in your wallet. +

+

+ To receive your Kovan Testnet POLY, you’ll need a supply of KETH + (Kovan Testnet ETH) to pay for gas fees. To receive your KETH,{' '} + + click here + {' '} + and follow the steps to receive your KETH. +

+
+ + This option is not available on the Mainnet. + +
, + () => { + const { account } = getState().network; + dispatch( + tx( + ['Receiving POLY From Faucet'], + async () => { + await PolyToken.getTokens(amount, account); + }, + 'You have successfully received ' + + thousandsDelimiter(amount) + + ' POLY', + undefined, + undefined, + undefined, + undefined, + true + ) + ); + }, + title, + buttonLabel, + 'pui-large-confirm-modal', + headerLabel + ) + ); + } else if (Number(getState().network.id) === 5) { + const buttonLabel = `REQUEST ${amount / 1000}K POLY`; + dispatch( + confirm( +
+ {intro} +

+ You are currently connected to the{' '} + Goerli Test Network. +

+

+ As such, you can click on the « + {buttonLabel} + » button below to receive {thousandsDelimiter(amount)} test + POLY in your wallet. +

+

+ To receive your Goerli Testnet POLY, you’ll need a supply of KETH + (Goerli Testnet ETH) to pay for gas fees. To receive your KETH,{' '} + + click here + {' '} + and follow the steps to receive your KETH. +

+
+ + This option is not available on the Mainnet. + +
, + () => { + const { account } = getState().network; + dispatch( + tx( + ['Receiving POLY From Faucet'], + async () => { + await PolyToken.getTokens(amount, account); + }, + 'You have successfully received ' + + thousandsDelimiter(amount) + + ' POLY', + undefined, + undefined, + undefined, + undefined, + true + ) + ); + }, + title, + buttonLabel, + 'pui-large-confirm-modal', + headerLabel + ) + ); } - - const buttonLabel = `REQUEST ${amount / 1000}K POLY`; - dispatch( - confirm( -
- {intro} -

- You are currently connected to the{' '} - Kovan Test Network. -

-

- As such, you can click on the « - {buttonLabel} - » button below to receive {thousandsDelimiter(amount)} test POLY - in your wallet. -

-

- To receive your Kovan Testnet POLY, you’ll need a supply of KETH - (Kovan Testnet ETH) to pay for gas fees. To receive your KETH,{' '} - - click here - {' '} - and follow the steps to receive your KETH. -

-
- - This option is not available on the Mainnet. - -
, - () => { - const { account } = getState().network; - dispatch( - tx( - ['Receiving POLY From Faucet'], - async () => { - await PolyToken.getTokens(amount, account); - }, - 'You have successfully received ' + - thousandsDelimiter(amount) + - ' POLY', - undefined, - undefined, - undefined, - undefined, - true - ) - ); - }, - title, - buttonLabel, - 'pui-large-confirm-modal', - headerLabel - ) - ); }; From aa6a5cc053d4a6b7008775720fd85bc5b54ecbba Mon Sep 17 00:00:00 2001 From: Remon Nashid Date: Wed, 30 Oct 2019 16:37:15 -0700 Subject: [PATCH 02/13] chore: change compliance page text --- .../src/pages/compliance/CompliancePage.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/polymath-issuer/src/pages/compliance/CompliancePage.js b/packages/polymath-issuer/src/pages/compliance/CompliancePage.js index c052e26ec..d5456f1e2 100644 --- a/packages/polymath-issuer/src/pages/compliance/CompliancePage.js +++ b/packages/polymath-issuer/src/pages/compliance/CompliancePage.js @@ -596,11 +596,12 @@ class CompliancePage extends Component { -

Token Whitelist

+

Token Compliance

- Whitelisted addresses may hold, buy, or sell the security token - and may participate into the STO.
Security token buy/sell - operations may be subject to restrictions. + Manage compliance requirements of your tokens. You can import + and export your whitelist , manage ownership percentages, add + 3rd party whitelist manager, and manage approval of token + transfer between wallets.

From 32b0c122cb600b50816344e766ef0403248e7a99 Mon Sep 17 00:00:00 2001 From: Remon Nashid Date: Wed, 30 Oct 2019 17:01:10 -0700 Subject: [PATCH 03/13] GT-94: notify users about csv changes --- .../src/pages/compliance/components/ImportWhitelistModal.js | 6 ++++++ .../src/pages/token/components/MintTokens.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/packages/polymath-issuer/src/pages/compliance/components/ImportWhitelistModal.js b/packages/polymath-issuer/src/pages/compliance/components/ImportWhitelistModal.js index dc7038a81..b59c6c26c 100644 --- a/packages/polymath-issuer/src/pages/compliance/components/ImportWhitelistModal.js +++ b/packages/polymath-issuer/src/pages/compliance/components/ImportWhitelistModal.js @@ -112,6 +112,12 @@ class ImportWhitelistModal extends Component { className="whitelist-import-modal" > Import Whitelist +

Add multiple addresses to the whitelist by uploading a comma separated .CSV file.{' '} diff --git a/packages/polymath-issuer/src/pages/token/components/MintTokens.js b/packages/polymath-issuer/src/pages/token/components/MintTokens.js index 3b66b2f74..8aff2eac0 100644 --- a/packages/polymath-issuer/src/pages/token/components/MintTokens.js +++ b/packages/polymath-issuer/src/pages/token/components/MintTokens.js @@ -259,6 +259,12 @@ class MintTokens extends Component { shareholders, affiliates or for your reserve.


+

Before you proceed, please check with your Advisor how your tokens should be distributed. Also, note that the ETH Addresses to which From 907a213a2e14eed9e78f43cca9ca3fd54172ab16 Mon Sep 17 00:00:00 2001 From: Remon Nashid Date: Wed, 30 Oct 2019 17:34:40 -0700 Subject: [PATCH 04/13] Fix typing issue --- packages/new-polymath-issuer/src/constants/network.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/new-polymath-issuer/src/constants/network.ts b/packages/new-polymath-issuer/src/constants/network.ts index 690a6342c..4dbe53ce5 100644 --- a/packages/new-polymath-issuer/src/constants/network.ts +++ b/packages/new-polymath-issuer/src/constants/network.ts @@ -34,7 +34,7 @@ if (POLYMATH_REGISTRY_ADDRESS_KOVAN) { } if (POLYMATH_REGISTRY_ADDRESS_GOERLI) { goerliConfig = { - [constants.NetworkIds.GOERLI]: { + [constants.NetworkIds.Goerli]: { polymathRegistryAddress: POLYMATH_REGISTRY_ADDRESS_GOERLI, wsProviderUrl: WS_PROVIDER_GOERLI, }, From bcf3d0a225e8cc63f4443232a444230d92f93ec4 Mon Sep 17 00:00:00 2001 From: Remon Nashid Date: Fri, 1 Nov 2019 10:26:30 -0700 Subject: [PATCH 05/13] GT-86: fix some typos --- .../polymath-issuer/src/pages/compliance/CompliancePage.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/polymath-issuer/src/pages/compliance/CompliancePage.js b/packages/polymath-issuer/src/pages/compliance/CompliancePage.js index d5456f1e2..0e3b90a18 100644 --- a/packages/polymath-issuer/src/pages/compliance/CompliancePage.js +++ b/packages/polymath-issuer/src/pages/compliance/CompliancePage.js @@ -599,9 +599,9 @@ class CompliancePage extends Component {

Token Compliance

Manage compliance requirements of your tokens. You can import - and export your whitelist , manage ownership percentages, add - 3rd party whitelist manager, and manage approval of token - transfer between wallets. + and export your whitelist, manage ownership percentages, add 3rd + party whitelist managers, and manage approval of token transfers + between wallets.

From 5183dd74b5416d71bfa9e65ee491f8da451428e5 Mon Sep 17 00:00:00 2001 From: Remon Nashid Date: Fri, 1 Nov 2019 12:36:02 -0700 Subject: [PATCH 06/13] Add coin addresses on Goerli --- packages/new-polymath-shared/src/constants/network.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/new-polymath-shared/src/constants/network.ts b/packages/new-polymath-shared/src/constants/network.ts index 20c8efa4b..e0be3001a 100644 --- a/packages/new-polymath-shared/src/constants/network.ts +++ b/packages/new-polymath-shared/src/constants/network.ts @@ -45,6 +45,16 @@ export const TokenAddresses: { [types.Tokens.Usdc]: '0xB06d72a24df50D4E2cAC133B320c5E7DE3ef94cB', [types.Tokens.Usdt]: '0xB06d72a24df50D4E2cAC133B320c5E7DE3ef94cB', }, + // Dai, USDT and Poly has a proper contract address. The rest are not deployed + // to Goerli yet so we're using USDT address for them, instead. + [NetworkIds.Goerli]: { + [types.Tokens.Dai]: '0x73967c6a0904aa032c103b4104747e88c566b1a2', + [types.Tokens.Poly]: '0x5af7f19575c1b0638994158e1137698701a18c67', + [types.Tokens.Gusd]: '0x5af7f19575c1b0638994158e1137698701a18c67', + [types.Tokens.Pax]: '0x5af7f19575c1b0638994158e1137698701a18c67', + [types.Tokens.Usdc]: '0x5af7f19575c1b0638994158e1137698701a18c67', + [types.Tokens.Usdt]: '0x509ee0d083ddf8ac028f2a56731412edd63223b9', + }, [NetworkIds.Mainnet]: { [types.Tokens.Dai]: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', [types.Tokens.Poly]: '0x9992ec3cf6a55b00978cddf2b27bc6882d88d1ec', From c2c5ebf9bcd4ae59d283f294de4c0b356d6d3f27 Mon Sep 17 00:00:00 2001 From: Fahd Date: Mon, 4 Nov 2019 13:05:20 -0500 Subject: [PATCH 07/13] update engines --- package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package.json b/package.json index 502270e62..08ee47f45 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,11 @@ "@polymathnetwork/polymath-scripts/polymath-core" ] }, + "engines": { + "node": "10.17.0", + "yarn": "1.19.1", + "npm": "6.11.3" + }, "version": "1.0.0-beta.0", "scripts": { "changelog": "node ./config/changelog.js", From ce16955d8e1e1285a4bef31c3cd77898aef37808 Mon Sep 17 00:00:00 2001 From: Fahd Date: Mon, 4 Nov 2019 18:59:16 -0500 Subject: [PATCH 08/13] update engines to sync with azure --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 08ee47f45..53150eb36 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ ] }, "engines": { - "node": "10.17.0", - "yarn": "1.19.1", + "node": "10.9.0", + "yarn": "1.12.3", "npm": "6.11.3" }, "version": "1.0.0-beta.0", From 7fe724cc4038783af82584445f54bbe7a4cf1786 Mon Sep 17 00:00:00 2001 From: Fahd Date: Mon, 4 Nov 2019 19:02:29 -0500 Subject: [PATCH 09/13] update engines --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 53150eb36..d87f9dbb3 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ ] }, "engines": { - "node": "10.9.0", + "node": "8.11.4", "yarn": "1.12.3", "npm": "6.11.3" }, From 70b30396d643abed710840d9aa471f83f351275e Mon Sep 17 00:00:00 2001 From: Remon Nashid Date: Tue, 5 Nov 2019 11:36:34 -0800 Subject: [PATCH 10/13] Remove engine requirements + add provider debugging code --- package.json | 5 ----- .../polymath-ui/src/components/EthNetworkWrapper/actions.js | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/package.json b/package.json index d87f9dbb3..502270e62 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,6 @@ "@polymathnetwork/polymath-scripts/polymath-core" ] }, - "engines": { - "node": "8.11.4", - "yarn": "1.12.3", - "npm": "6.11.3" - }, "version": "1.0.0-beta.0", "scripts": { "changelog": "node ./config/changelog.js", diff --git a/packages/polymath-ui/src/components/EthNetworkWrapper/actions.js b/packages/polymath-ui/src/components/EthNetworkWrapper/actions.js index a59006b7b..ec352ad51 100644 --- a/packages/polymath-ui/src/components/EthNetworkWrapper/actions.js +++ b/packages/polymath-ui/src/components/EthNetworkWrapper/actions.js @@ -108,6 +108,7 @@ export const init = (networks: Array) => async (dispatch: Function) => { const network = getNetworkInfo(networkId); const accounts = await web3.eth.getAccounts(); + console.log('URL', process.env.REACT_APP_NODE_WS, network.url); // Instantiate Web3 Web Socket web3WS = new Web3(process.env.REACT_APP_NODE_WS || network.url); From 283cfd109b681b879a0395c8aa92297e12d8a119 Mon Sep 17 00:00:00 2001 From: Fahd Date: Wed, 6 Nov 2019 11:08:37 -0500 Subject: [PATCH 11/13] fix engine entries --- package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package.json b/package.json index 502270e62..65f54d877 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,11 @@ "@polymathnetwork/polymath-scripts/polymath-core" ] }, + "engines": { + "node": ">=8.11.4 <10.17.0", + "yarn": ">=1.12.3 <1.19.1", + "npm": "6.11.3" + }, "version": "1.0.0-beta.0", "scripts": { "changelog": "node ./config/changelog.js", From 37d033a5eb3f6b8e4b435ec72a00b704969f84aa Mon Sep 17 00:00:00 2001 From: Fahd Date: Wed, 6 Nov 2019 11:17:57 -0500 Subject: [PATCH 12/13] fix engine --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 65f54d877..db5344bda 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ ] }, "engines": { - "node": ">=8.11.4 <10.17.0", + "node": ">=8.11.4 <=10.17.0", "yarn": ">=1.12.3 <1.19.1", "npm": "6.11.3" }, From 648eee2f0ac6868e04b6e3354c5016e403980662 Mon Sep 17 00:00:00 2001 From: Fahd Date: Wed, 6 Nov 2019 11:21:10 -0500 Subject: [PATCH 13/13] fix yarn version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index db5344bda..8147ef49c 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "engines": { "node": ">=8.11.4 <=10.17.0", - "yarn": ">=1.12.3 <1.19.1", + "yarn": ">=1.12.3 <=1.19.1", "npm": "6.11.3" }, "version": "1.0.0-beta.0",