From 84cad8a8f9d7e69f5fb9c58a91d51541e5710bb9 Mon Sep 17 00:00:00 2001 From: yyy <1174643184@qq.com> Date: Sat, 18 May 2024 10:07:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=94=E6=94=B6=E6=80=BB?= =?UTF-8?q?=E9=A2=9D=20=20=20=E6=8E=A8=E8=8D=90=E5=90=88=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/language/hk.json | 3 ++- src/language/zh.json | 3 ++- src/pages/invitation/index.tsx | 2 +- src/pages/pledge/index.tsx | 11 ++++++++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/language/hk.json b/src/language/hk.json index b78f155..06d7b51 100644 --- a/src/language/hk.json +++ b/src/language/hk.json @@ -128,5 +128,6 @@ "Binding Time": "綁定時間", "Contract(Rewards) Details": "合約(奖励)明細", "Days Staking": "天質押", - "Rewards Details": "收益及提取明細" + "Rewards Details": "收益及提取明細", + "Referral Contract":"推薦合約" } \ No newline at end of file diff --git a/src/language/zh.json b/src/language/zh.json index 161c893..4b3856b 100644 --- a/src/language/zh.json +++ b/src/language/zh.json @@ -128,5 +128,6 @@ "Binding Time": "绑定时间", "Contract(Rewards) Details": "合约(奖励)明细", "Days Staking": "天质押", - "Rewards Details": "收益及提取明细" + "Rewards Details": "收益及提取明细", + "Referral Contract":"推荐合约" } diff --git a/src/pages/invitation/index.tsx b/src/pages/invitation/index.tsx index b669e59..e6f4253 100644 --- a/src/pages/invitation/index.tsx +++ b/src/pages/invitation/index.tsx @@ -162,7 +162,7 @@ const Invitation = () => { > - + diff --git a/src/pages/pledge/index.tsx b/src/pages/pledge/index.tsx index 73d6a58..7042baf 100644 --- a/src/pages/pledge/index.tsx +++ b/src/pages/pledge/index.tsx @@ -20,7 +20,7 @@ const Pledge = () => { const { location } = useRouter() const { filBalance, walletAddress, contract } = store.state - const {Pledge__factory, FIL__factory, Pool__factory } = contract._contract ? contract._contract : {} as Contract_Factory + const { Pledge__factory, FIL__factory, Pool__factory } = contract._contract ? contract._contract : {} as Contract_Factory const [pledgeList, setPledgeList] = useState([ { day: 180, rate: 14 }, @@ -30,6 +30,7 @@ const Pledge = () => { const [amount, setAmount] = useState('') const [profit, setProfit] = useState('0.00') + const [totalProfit, setTotalProfit] = useState('0.00') const [tabIndex, setTabIndex] = useState(location.state ? location.state.index : 0) const [visible, setVisible] = useState(false) const [loading, setLoading] = useState(false) @@ -125,15 +126,19 @@ const Pledge = () => { const calcIncome = () => { if (amount === '') { setProfit('0.00') + setTotalProfit('0.00') return } const pledgeAmount = toWei(amount) const pledgeDay = toBigInt(pledgeList[tabIndex].day) const rate = toBigInt(pledgeList[tabIndex].rate) const year = toBigInt(365) - const total = pledgeAmount * rate / year * pledgeDay + const total = pledgeAmount * rate / year * pledgeDay; const _profit = ethers.formatUnits(total, 20) + const _totalProfit = ethers.formatUnits(toWei(toFixed2(_profit,18)) + pledgeAmount,18) + setProfit(_profit) + setTotalProfit(_totalProfit) } calcIncome() }, [amount, tabIndex]) @@ -209,7 +214,7 @@ const Pledge = () => { {t('Est. Total Receivable')}: - {toFixed2(profit, 4)} FIL + {toFixed2(totalProfit, 4)} FIL {t('STAKE')}