From 34934d8ba5677b520a264ae0d2b82ea1f0dc7c0b Mon Sep 17 00:00:00 2001 From: myf <> Date: Tue, 24 May 2022 10:32:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Menu/index.tsx | 4 +--- src/state/ido/index.ts | 13 +++---------- .../components/BoardCard/CardActionsContainer.tsx | 7 +------ src/views/Home/components/FristCom.tsx | 4 +--- 4 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 05c6fda..3d6d002 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -57,10 +57,8 @@ const Menu = (props) => { sign() } }, [unActiveAccount, hasWalletLogin, library]) - const [price, setPrice] = useState(0) useEffect(() => { getDetails() - setPrice(hccPriceUsdt) }, []) return ( { currentLang={currentLanguage.code} langs={languageList} setLang={setLanguage} - cakePriceUsd={price} + cakePriceUsd={hccPriceUsdt} links={config(t)} socialLink={socialLink} {...props} diff --git a/src/state/ido/index.ts b/src/state/ido/index.ts index b059604..b682be9 100644 --- a/src/state/ido/index.ts +++ b/src/state/ido/index.ts @@ -5,17 +5,10 @@ import multicall from 'utils/multicall' import tokens from 'config/constants/tokens' import { getAddress, getIdoPurchaseAddress } from 'utils/addressHelpers' -const payWayList = { - usdt: tokens.usdt, -} - export const fetchIdoUserAllowances = async (account: string) => { - const calls = Object.values(payWayList).map((payWayItem) => { - const tokenAddresses = getAddress(payWayItem.address) - const idoPurchaseAddress = getIdoPurchaseAddress() - return { address: tokenAddresses, name: 'allowance', params: [account, idoPurchaseAddress] } - }) - + const tokenAddresses = getAddress(tokens.usdt.address) + const idoPurchaseAddress = getIdoPurchaseAddress() + const calls = [{ address: tokenAddresses, name: 'allowance', params: [account, idoPurchaseAddress] }] const rawLpAllowances = await multicall(erc20ABI, calls) const parsedLpAllowances = rawLpAllowances.map((balance) => { return new BigNumber(balance).toNumber() diff --git a/src/views/Board/components/BoardCard/CardActionsContainer.tsx b/src/views/Board/components/BoardCard/CardActionsContainer.tsx index c977fa0..135293b 100644 --- a/src/views/Board/components/BoardCard/CardActionsContainer.tsx +++ b/src/views/Board/components/BoardCard/CardActionsContainer.tsx @@ -50,11 +50,6 @@ const CardActions: React.FC = ({ board, account }) => { const displayBalance = rawEarningsBalance.toFixed(3, BigNumber.ROUND_DOWN) const hccPriceUsdt = usePriceHccUsdt() - const [price, setPrice] = useState(0) - useEffect(() => { - setPrice(hccPriceUsdt) - }, []) - const handleApprove = useCallback(async () => { try { setRequestedApproval(true) @@ -81,7 +76,7 @@ const CardActions: React.FC = ({ board, account }) => { {displayBalance} - {price ? (price * Number(displayBalance)).toFixed(3) : 0} USDT + {hccPriceUsdt ? (hccPriceUsdt * Number(displayBalance)).toFixed(3) : 0} USDT diff --git a/src/views/Home/components/FristCom.tsx b/src/views/Home/components/FristCom.tsx index 35949fe..8e4cc20 100644 --- a/src/views/Home/components/FristCom.tsx +++ b/src/views/Home/components/FristCom.tsx @@ -141,7 +141,6 @@ const FristCom: React.FC = () => { market: 0, }) const hccPriceUsdt = usePriceHccUsdt() - const [price, setPrice] = useState(0) const [linkList, setLinkList] = useState([]) const getDetail = async () => { @@ -156,7 +155,6 @@ const FristCom: React.FC = () => { setDetail(data) } useEffect(() => { - setPrice(hccPriceUsdt) getDetail() }, []) const openLink = (link) => { @@ -203,7 +201,7 @@ const FristCom: React.FC = () => { - + {/* {burned.map((item) => { return })} */}