diff --git a/.env b/.env index 3cd8f18..9f00483 100644 --- a/.env +++ b/.env @@ -1,2 +1,5 @@ -REACT_APP_CHAIN_ID="5167003" -REACT_APP_NETWORK_URL="https://wannsee-rpc.mxc.com" \ No newline at end of file +REACT_APP_CHAIN_ID="18686" +REACT_APP_CHAIN_ID_HEX="0x48fe" +REACT_APP_CHAIN_NAME="zkEVM Mainnet" +REACT_APP_CHAIN_EXPLORER="https://explorer.mxc.com/" +REACT_APP_NETWORK_URL="https://rpc.mxc.com/" \ No newline at end of file diff --git a/.env.mainnet b/.env.mainnet new file mode 100644 index 0000000..9f00483 --- /dev/null +++ b/.env.mainnet @@ -0,0 +1,5 @@ +REACT_APP_CHAIN_ID="18686" +REACT_APP_CHAIN_ID_HEX="0x48fe" +REACT_APP_CHAIN_NAME="zkEVM Mainnet" +REACT_APP_CHAIN_EXPLORER="https://explorer.mxc.com/" +REACT_APP_NETWORK_URL="https://rpc.mxc.com/" \ No newline at end of file diff --git a/.env.testnet b/.env.testnet new file mode 100644 index 0000000..37f7b93 --- /dev/null +++ b/.env.testnet @@ -0,0 +1,5 @@ +REACT_APP_CHAIN_ID="5167003" +REACT_APP_CHAIN_ID_HEX="0x4ed79b" +REACT_APP_CHAIN_NAME="Wannsee" +REACT_APP_CHAIN_EXPLORER="https://wannsee-explorer.mxc.com/" +REACT_APP_NETWORK_URL="https://wannsee-rpc.mxc.com" diff --git a/.gitignore b/.gitignore index 8d715af..24d95bf 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ cypress/videos cypress/screenshots cypress/fixtures/example.json .vercel +vercel.* diff --git a/package.json b/package.json index cf92389..0ce6401 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,9 @@ "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'", - "integration-test": "start-server-and-test 'serve build -l 3000' http://localhost:3000 'cypress run'" + "integration-test": "start-server-and-test 'serve build -l 3000' http://localhost:3000 'cypress run'", + "vercel:mainnet": "cp vercel.mainnet.json .vercel/project.json && cp .env.mainnet .env && vercel --prod", + "vercel:testnet": "cp vercel.testnet.json .vercel/project.json && cp .env.testnet .env && vercel --prod" }, "eslintConfig": { "extends": "react-app" diff --git a/public/index.html b/public/index.html index b61ee13..36368da 100644 --- a/public/index.html +++ b/public/index.html @@ -1,8 +1,7 @@ - + @@ -27,7 +26,7 @@ Learn how to configure a non-root public URL by running `npm run build`. --> - Wannsee Swap + MXC Swap diff --git a/src/components/AccountDetails/index.tsx b/src/components/AccountDetails/index.tsx index 9f818eb..cb6ce04 100644 --- a/src/components/AccountDetails/index.tsx +++ b/src/components/AccountDetails/index.tsx @@ -21,6 +21,7 @@ import Identicon from '../Identicon' import { ButtonSecondary } from '../Button' import { ExternalLink as LinkIcon } from 'react-feather' import { ExternalLink, LinkStyledButton, TYPE } from '../../theme' +const chainName = process.env.REACT_APP_CHAIN_NAME const HeaderRow = styled.div` ${({ theme }) => theme.flexRowNoWrap}; @@ -358,7 +359,7 @@ export default function AccountDetails({ href={chainId && getEtherscanLink(chainId, ENSName, 'address')} > - View on Wannsee Explorer + View on {chainName} Explorer )} @@ -380,7 +381,7 @@ export default function AccountDetails({ href={getEtherscanLink(chainId, account, 'address')} > - View on Wannsee Explorer + View on {chainName} Explorer )} diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index e260a08..929171d 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -133,7 +133,9 @@ const NETWORK_LABELS: { [chainId in ChainId]: string | null } = { [ChainId.GÖRLI]: 'Görli', [ChainId.KOVAN]: 'Kovan', [ChainId.WANNSEE]: 'Wannsee', - [ChainId.GANACHE]: 'Ganache' + [ChainId.WANNSEEMAINNET]: 'zkEVM Mainnet', + [ChainId.GANACHE]: 'Ganache', + [ChainId.HARDHAT]: 'Hardhat' } export default function Header() { diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 321a079..e70f638 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -110,7 +110,11 @@ export default function Menu() { Discord - + {/* + + Analytics + */} + Analytics diff --git a/src/components/WalletModal/index.tsx b/src/components/WalletModal/index.tsx index 2bcef5e..b191ecf 100644 --- a/src/components/WalletModal/index.tsx +++ b/src/components/WalletModal/index.tsx @@ -20,6 +20,11 @@ import { OVERLAY_READY } from '../../connectors/Fortmatic' import { WalletConnectConnector } from '@web3-react/walletconnect-connector' import { AbstractConnector } from '@web3-react/abstract-connector' +const chainName = process.env.REACT_APP_CHAIN_NAME || '' +const chainIDHex = process.env.REACT_APP_CHAIN_ID_HEX || '' +const chainRPC = process.env.REACT_APP_NETWORK_URL || '' +const explorer = process.env.REACT_APP_CHAIN_EXPLORER || '' + const CloseIcon = styled.div` position: absolute; right: 1rem; @@ -295,7 +300,7 @@ export default function WalletModal({ method: 'wallet_switchEthereumChain', params: [ { - chainId: '0x4ed79b' + chainId: chainIDHex } ] }) @@ -311,15 +316,15 @@ export default function WalletModal({ method: 'wallet_addEthereumChain', params: [ { - chainId: '0x4ed79b', - rpcUrls: ['https://wannsee-rpc.mxc.com/'], - chainName: 'wannsee', + chainId: chainIDHex, + rpcUrls: [chainRPC], + chainName, nativeCurrency: { name: 'MXC', symbol: 'MXC', decimals: 18 }, - blockExplorerUrls: ['https://wannsee-explorer.mxc.com/'] + blockExplorerUrls: [explorer] } ] }) @@ -338,12 +343,12 @@ export default function WalletModal({ {error instanceof UnsupportedChainIdError ? ( //
Please connect to the appropriate Ethereum network.
<> -
Please connect to the appropriate Wannsee network.
+
Please connect to the appropriate {chainName} network.
- Switch MXC Network + Switch {chainName} Network - Add MXC Network + Add {chainName} Network ) : ( diff --git a/src/connectors/index.ts b/src/connectors/index.ts index e5df1f3..ee1f592 100644 --- a/src/connectors/index.ts +++ b/src/connectors/index.ts @@ -28,7 +28,7 @@ export function getNetworkLibrary(): Web3Provider { export const injected = new InjectedConnector({ // supportedChainIds: [1, 3, 4, 5, 42] - supportedChainIds: [5167003, 1337] + supportedChainIds: [5167003, 1337, 31337, 18686] }) // mainnet only diff --git a/src/constants/index.ts b/src/constants/index.ts index f56b99a..eae7da6 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -3,7 +3,13 @@ import { AbstractConnector } from '@web3-react/abstract-connector' import { fortmatic, injected, portis, walletconnect, walletlink } from '../connectors' -export const ROUTER_ADDRESS = '0xCaf6FE52B3b2948EFe7EA72C1ffd0B49C5FB030E' +// wannsee +// export const ROUTER_ADDRESS = '0xCaf6FE52B3b2948EFe7EA72C1ffd0B49C5FB030E' +// hardhat +// export const ROUTER_ADDRESS = '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9' +// wannsee-mainnet +export const ROUTER_ADDRESS = '0x757e5af94fC9b3d4035C2e6Cb1fD304F43c0A1A4' + // a list of tokens by chain type ChainTokenList = { @@ -24,7 +30,9 @@ const WETH_ONLY: ChainTokenList = { [ChainId.GÖRLI]: [WETH[ChainId.GÖRLI]], [ChainId.KOVAN]: [WETH[ChainId.KOVAN]], [ChainId.WANNSEE]: [WETH[ChainId.WANNSEE]], - [ChainId.GANACHE]: [WETH[ChainId.GANACHE]] + [ChainId.WANNSEEMAINNET]: [WETH[ChainId.WANNSEEMAINNET]], + [ChainId.GANACHE]: [WETH[ChainId.GANACHE]], + [ChainId.HARDHAT]: [WETH[ChainId.HARDHAT]] } // used to construct intermediary pairs for trading diff --git a/src/constants/lists.ts b/src/constants/lists.ts index 49b333e..f076cbe 100644 --- a/src/constants/lists.ts +++ b/src/constants/lists.ts @@ -1,7 +1,8 @@ // the Uniswap Default token list lives here // export const DEFAULT_TOKEN_LIST_URL = 'tokens.uniswap.eth' export const DEFAULT_TOKEN_LIST_URL = - 'https://raw.githubusercontent.com/MXCzkEVM/wannseeswap-tokenlist/main/tokenlist.json?version=7' + 'https://raw.githubusercontent.com/MXCzkEVM/wannseeswap-tokenlist/main/tokenlist-mainnet.json?version=1' +// 'https://raw.githubusercontent.com/MXCzkEVM/wannseeswap-tokenlist/main/tokenlist.json?version=7' // https://raw.githubusercontent.com/compound-finance/token-list/master/compound.tokenlist.json // export const DEFAULT_LIST_OF_LISTS: string[] = [ diff --git a/src/constants/multicall/index.ts b/src/constants/multicall/index.ts index 8900167..7e99fb2 100644 --- a/src/constants/multicall/index.ts +++ b/src/constants/multicall/index.ts @@ -8,7 +8,9 @@ const MULTICALL_NETWORKS: { [chainId in ChainId]: string } = { [ChainId.RINKEBY]: '0x42Ad527de7d4e9d9d011aC45B31D8551f8Fe9821', [ChainId.GÖRLI]: '0x77dCa2C955b15e9dE4dbBCf1246B4B85b651e50e', [ChainId.WANNSEE]: '0x8aE2B89eA3d9fe8E214698D78aCce5614F492087', - [ChainId.GANACHE]: '0xad34a1e01f26250894FC463e68De7ffcE83DE2aF' + [ChainId.GANACHE]: '0xad34a1e01f26250894FC463e68De7ffcE83DE2aF', + [ChainId.HARDHAT]: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0', + [ChainId.WANNSEEMAINNET]: '0xbf5c081C000a02c07BC9a6141a7bfC6E85259946' } export { MULTICALL_ABI, MULTICALL_NETWORKS } diff --git a/src/constants/v1/index.ts b/src/constants/v1/index.ts index 0279409..94b797d 100644 --- a/src/constants/v1/index.ts +++ b/src/constants/v1/index.ts @@ -10,7 +10,9 @@ const V1_FACTORY_ADDRESSES: { [chainId in ChainId]: string } = { [ChainId.GÖRLI]: '0x6Ce570d02D73d4c384b46135E87f8C592A8c86dA', [ChainId.KOVAN]: '0xD3E51Ef092B2845f10401a0159B2B96e8B6c3D30', [ChainId.WANNSEE]: '0x86f515845c3451742d1dB85B77Fd53f83fA1D393', + [ChainId.WANNSEEMAINNET]: '0x8bC7cf83f5F83781Ec85B78d866222987Ae24657', [ChainId.GANACHE]: '0x6FA34D533Ed090ED1Bb76f4ed9FBB201D51Dc25D', + [ChainId.HARDHAT]: '0x5FbDB2315678afecb367f032d93F642f64180aa3', } const V1_FACTORY_INTERFACE = new Interface(V1_FACTORY_ABI) diff --git a/src/pages/RemoveLiquidity/index.tsx b/src/pages/RemoveLiquidity/index.tsx index afbfa1e..abf772f 100644 --- a/src/pages/RemoveLiquidity/index.tsx +++ b/src/pages/RemoveLiquidity/index.tsx @@ -115,7 +115,7 @@ export default function RemoveLiquidity({ { name: 'verifyingContract', type: 'address' } ] const domain = { - name: 'Uniswap V2', + name: 'Wannsee LPs', version: '1', chainId: chainId, verifyingContract: pair.liquidityToken.address diff --git a/src/state/lists/hooks.ts b/src/state/lists/hooks.ts index 9f9daf1..d8ba674 100644 --- a/src/state/lists/hooks.ts +++ b/src/state/lists/hooks.ts @@ -37,7 +37,9 @@ const EMPTY_LIST: TokenAddressMap = { [ChainId.GÖRLI]: {}, [ChainId.MAINNET]: {}, [ChainId.WANNSEE]: {}, - [ChainId.GANACHE]: {} + [ChainId.WANNSEEMAINNET]: {}, + [ChainId.GANACHE]: {}, + [ChainId.HARDHAT]: {} } const listCache: WeakMap | null = diff --git a/src/utils/index.ts b/src/utils/index.ts index 84772ff..a275479 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -24,7 +24,9 @@ const ETHERSCAN_PREFIXES: { [chainId in ChainId]: string } = { 5: 'goerli.', 42: 'kovan.', 5167003: 'wannsee-explorer.mxc.com', - 1337: 'ganache' + 18686: 'explorer.mxc.com', + 1337: 'ganache', + 31337: 'hardhat' } export function getEtherscanLink(chainId: ChainId, data: string, type: 'transaction' | 'token' | 'address'): string { diff --git a/yarn.lock b/yarn.lock index 9e8dc48..5b61b08 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2575,9 +2575,9 @@ integrity sha512-2yK7sLpKIT91TiS5sewHtOa7YuM8IuBXVl4GZv2jZFys4D2sY7K5vZh6MqD25TPA95Od+0YzCVq6cTF2IKrOmg== "@uniswap/sdk@npm:mxcswap-sdk": - version "1.0.5" - resolved "https://registry.npmmirror.com/mxcswap-sdk/-/mxcswap-sdk-1.0.5.tgz#bed43be3d277562ea342e17bc5fc4dda7b37a079" - integrity sha512-BC/QdHwE6zuWrVHo1ZiKEVrHzyCEsZtnnqnuqSIvpyGntfXI3BdqTXDG4RjCs5KEvkUy8iSOq/odNudwLqJtyA== + version "1.0.6" + resolved "https://registry.npmjs.org/mxcswap-sdk/-/mxcswap-sdk-1.0.6.tgz#d9747609c9efd4928059bbaaa121c8e0ae3cfee8" + integrity sha512-us3I51mwok/VWPuhXf0leQvFimKQhRuSJRliqLxa81K79Ov7Y3l6XjJJueAr0AOnvGZ3VlX4P36JfORlYn9i1g== dependencies: "@uniswap/v2-core" "^1.0.0" big.js "^5.2.2"