Browse Source

修改应收总额 推荐合约

master
yyy 6 months ago
parent
commit
84cad8a8f9
  1. 3
      src/language/hk.json
  2. 3
      src/language/zh.json
  3. 2
      src/pages/invitation/index.tsx
  4. 9
      src/pages/pledge/index.tsx

3
src/language/hk.json

@ -128,5 +128,6 @@
"Binding Time": "綁定時間",
"Contract(Rewards) Details": "合約(奖励)明細",
"Days Staking": "天質押",
"Rewards Details": "收益及提取明細"
"Rewards Details": "收益及提取明細",
"Referral Contract":"推薦合約"
}

3
src/language/zh.json

@ -128,5 +128,6 @@
"Binding Time": "绑定时间",
"Contract(Rewards) Details": "合约(奖励)明细",
"Days Staking": "天质押",
"Rewards Details": "收益及提取明细"
"Rewards Details": "收益及提取明细",
"Referral Contract":"推荐合约"
}

2
src/pages/invitation/index.tsx

@ -162,7 +162,7 @@ const Invitation = () => {
>
<Tabs.TabPane title={t('Referred')} titleClass='mr-1 fz-wb-550'>
</Tabs.TabPane>
<Tabs.TabPane title={t("Active Contracts")} titleClass='mr-1 fz-wb-550'>
<Tabs.TabPane title={t("Referral Contract")} titleClass='mr-1 fz-wb-550'>
</Tabs.TabPane>
<Tabs.TabPane title={t("Withdraw")} titleClass='fz-wb-550'>
</Tabs.TabPane>

9
src/pages/pledge/index.tsx

@ -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 = () => {
</div>
<div className='mt-1 row-between'>
<div>{t('Est. Total Receivable')}:</div>
<div>{toFixed2(profit, 4)} FIL</div>
<div>{toFixed2(totalProfit, 4)} FIL</div>
</div>
<div className='mt-3 row-center'>
<Button size='large' className='stake-button' onClick={pledge} loading={loading} loadingType="ball">{t('STAKE')}</Button>

Loading…
Cancel
Save