From ca17d5cfdfd6ab3b8b5ba574074a8d99bb8acfb4 Mon Sep 17 00:00:00 2001 From: holybasil Date: Tue, 4 Apr 2023 16:26:12 +0800 Subject: [PATCH] fix: route && env --- netlify.toml | 12 +++ src/components/Header/constants.ts | 5 + src/pages/nftBridge/Header/index.tsx | 5 +- src/pages/nftFaucet/index.tsx | 135 --------------------------- src/routes/portalRoutes.tsx | 16 +--- 5 files changed, 23 insertions(+), 150 deletions(-) delete mode 100644 src/pages/nftFaucet/index.tsx diff --git a/netlify.toml b/netlify.toml index a1732b099..100772634 100644 --- a/netlify.toml +++ b/netlify.toml @@ -51,6 +51,10 @@ REACT_APP_L2_STANDARD_ERC20_GATEWAY_PROXY_ADDR = "0x56250Eaca2b77819A359a764c3B8 REACT_APP_L2_GATEWAY_ROUTER_PROXY_ADDR = "0x74B49DA8B337b470F895Ec6016c3e7ECFb095ff1" REACT_APP_L2_WETH_ADDRESS = "0x5300000000000000000000000000000000000004" REACT_APP_L2_GAS_PRICE_ORACLE = "0xCC3c9D5798Ca4095979082F62b8E29Df9BAE1Cdf" +REACT_APP_L1_ERC721_GATEWAY_PROXY_ADDR="0xC36cF1bAE96058341d8696023a8500B9C0E7b4Cc" +REACT_APP_L2_ERC721_GATEWAY_PROXY_ADDR="0x1ba1f51B9dD2B1595579a1BEE34ac5bf226870CF" +REACT_APP_L1_ERC1155_GATEWAY_PROXY_ADDR="0x2A9aCC6605C6626cB8D2D585bF19541565e17189" +REACT_APP_L2_ERC1155_GATEWAY_PROXY_ADDR="0x97EaFdF6656A522E6177e675a150a80F90B73491" [context.develop.environment] # same as deploy-preview @@ -68,6 +72,10 @@ REACT_APP_L2_STANDARD_ERC20_GATEWAY_PROXY_ADDR = "0x56250Eaca2b77819A359a764c3B8 REACT_APP_L2_GATEWAY_ROUTER_PROXY_ADDR = "0x74B49DA8B337b470F895Ec6016c3e7ECFb095ff1" REACT_APP_L2_WETH_ADDRESS = "0x5300000000000000000000000000000000000004" REACT_APP_L2_GAS_PRICE_ORACLE = "0xCC3c9D5798Ca4095979082F62b8E29Df9BAE1Cdf" +REACT_APP_L1_ERC721_GATEWAY_PROXY_ADDR="0xC36cF1bAE96058341d8696023a8500B9C0E7b4Cc" +REACT_APP_L2_ERC721_GATEWAY_PROXY_ADDR="0x1ba1f51B9dD2B1595579a1BEE34ac5bf226870CF" +REACT_APP_L1_ERC1155_GATEWAY_PROXY_ADDR="0x2A9aCC6605C6626cB8D2D585bF19541565e17189" +REACT_APP_L2_ERC1155_GATEWAY_PROXY_ADDR="0x97EaFdF6656A522E6177e675a150a80F90B73491" [context.alpha.environment] # same as main @@ -86,3 +94,7 @@ REACT_APP_ROUTER_ADDRESS = "0x79d6F4BD5267B44a3028DcF6dCD90F55ba18F2c9" REACT_APP_MULTICALL_ADDR = "0xA1281be5BfF2b4e1b25b1ACAf5B76dBA4ECDbD5C" REACT_APP_L2_WETH_ADDRESS = "0x2b17A0Da68382C4B7DEC16Ea6998057a444817e6" REACT_APP_L2_GAS_PRICE_ORACLE = "0x37D61987d0281Fb17DE079C9B8E56B367b1800c4" +REACT_APP_L1_ERC721_GATEWAY_PROXY_ADDR="0x1C441Dfc5C2eD7A2AA8636748A664E59CB029157" +REACT_APP_L1_ERC1155_GATEWAY_PROXY_ADDR="0xd1bE599aaCBC21448fD6373bbc7c1b4c7806f135" +REACT_APP_L2_ERC721_GATEWAY_PROXY_ADDR="0x8Fee20e0C0Ef16f2898a8073531a857D11b9C700" +REACT_APP_L2_ERC1155_GATEWAY_PROXY_ADDR="0xfe5Fc32777646bD123564C41f711FF708Dd48360" diff --git a/src/components/Header/constants.ts b/src/components/Header/constants.ts index 6f08bb1f9..7fe183b99 100644 --- a/src/components/Header/constants.ts +++ b/src/components/Header/constants.ts @@ -35,6 +35,11 @@ const navigations = [ key: "bridge", href: "bridge", }, + { + label: "NFT Bridge", + key: "nft-bridge", + href: "nft-bridge", + }, { label: "Ecosystem", key: "ecosystem", diff --git a/src/pages/nftBridge/Header/index.tsx b/src/pages/nftBridge/Header/index.tsx index 6fbb21f53..d30d96ba3 100644 --- a/src/pages/nftBridge/Header/index.tsx +++ b/src/pages/nftBridge/Header/index.tsx @@ -131,7 +131,10 @@ const Header = () => { - {/* */} + + coming soon! + {/* */} + diff --git a/src/pages/nftFaucet/index.tsx b/src/pages/nftFaucet/index.tsx deleted file mode 100644 index 11f6f759f..000000000 --- a/src/pages/nftFaucet/index.tsx +++ /dev/null @@ -1,135 +0,0 @@ -import { ethers } from "ethers" -import { useMemo, useState } from "react" - -import { Alert, Button, Snackbar, Typography } from "@mui/material" - -import L1_ERC721 from "@/assets/abis/L1_ERC721.json" -import ERC1155ABI from "@/assets/abis/L1_ERC1155.json" -import LoadingButton from "@/components/LoadingButton" -import { ChainId, TESTNET_NAME, addresses } from "@/constants" -import { useWeb3Context } from "@/contexts/Web3ContextProvider" -import { requireEnv, truncateAddress } from "@/utils" - -const L1_SCROLL721_ADDR = requireEnv("REACT_APP_L1_SCROLL721_ADDRESS") -const L1_SCROLL1155_ADDR = requireEnv("REACT_APP_L1_SCROLL1155_ADDRESS") - -const NFTFaucet = () => { - const { walletCurrentAddress, connectWallet, provider, chainId } = useWeb3Context() - - const [loading, setLoading] = useState(false) - const [errorMessage, setErrorMessage] = useState("") - - const networkStatus = useMemo(() => { - if (chainId === ChainId.SCROLL_LAYER_1) { - return 1 - } else if (chainId) { - return 2 - } - return 3 - }, [chainId]) - - const switchNetwork = async () => { - await window.ethereum.request({ - method: "wallet_addEthereumChain", - params: [addresses[ChainId.SCROLL_LAYER_1].autoconnect], - }) - } - - const handleRequest = async () => { - setLoading(true) - try { - const signer = await provider?.getSigner(0) - // for 721 - const instance721 = new ethers.Contract(L1_SCROLL721_ADDR, L1_ERC721, signer) - const totalCount721 = await instance721["totalSupply()"]() - const tx721 = instance721["mint(address,uint256)"](walletCurrentAddress, totalCount721.toNumber()) - - // for 1155 - // TODO: will check after Peter give staging-goerli - const instance1155 = new ethers.Contract(L1_SCROLL1155_ADDR, ERC1155ABI, signer) - const totalCount1155 = await instance1155["totalSupply()"]() - const totalCountNumber = totalCount1155.toNumber() - const tx1155 = instance1155["mintBatch(address,uint256[],uint256[],bytes)"]( - walletCurrentAddress, - [totalCountNumber, totalCountNumber + 1], - [1, 1], - "0x", - ) - - const txAll = await Promise.allSettled([tx721, tx1155]) - const txResultAll = await Promise.allSettled( - txAll.filter((item): item is PromiseFulfilledResult => item.status === "fulfilled").map(item => item.value.wait()), - ) - - console.log(txResultAll, "mint res") - } catch (e) { - setErrorMessage(e.toString()) - console.log(e, "mint error message") - } finally { - setLoading(false) - } - } - - const handleClose = () => { - setErrorMessage("") - } - - const renderOperation = () => { - if (networkStatus === 1) { - return ( - - Request Testnet Scroll NFTs - - ) - } else if (networkStatus === 2) { - return ( - - ) - } - return ( - - ) - } - - return ( - <> -
-
-
- {walletCurrentAddress ? ( - - ) : ( - - )} -
- - Request NFTs - - - Receive 1 ERC721 NFT & 2 ERC1155 NFTs per request. - - {renderOperation()} -
- - - {errorMessage} - - -
- - ) -} - -export default NFTFaucet diff --git a/src/routes/portalRoutes.tsx b/src/routes/portalRoutes.tsx index 38e0d549f..59bee6043 100644 --- a/src/routes/portalRoutes.tsx +++ b/src/routes/portalRoutes.tsx @@ -2,7 +2,6 @@ import Bridge from "@/pages/bridge" import Ecosystem from "@/pages/ecosystem" import Home from "@/pages/home" import NFTBridge from "@/pages/nftBridge" -import NFTFaucet from "@/pages/nftFaucet" import RollupScanBatch from "@/pages/rollup/batch" import RollupScanBlock from "@/pages/rollup/block" import RollupScan from "@/pages/rollup/index" @@ -15,17 +14,6 @@ const routes = [ fullPath: "/alpha", element: , }, - ...(isProduction - ? [] - : [ - { - name: "Faucet", - path: "/faucet/nft", - fullPath: "/alpha/faucet/nft", - element: , - }, - ]), - { name: "Bridge", path: "/bridge", @@ -37,8 +25,8 @@ const routes = [ : [ { name: "NFTBridge", - path: "/bridge/nft", - fullPath: "/alpha/bridge/nft", + path: "/nft-bridge", + fullPath: "/alpha/nft-bridge", element: , }, ]),