部分董事会
This commit is contained in:
parent
3841c754f2
commit
b2fb877052
|
|
@ -25,6 +25,16 @@ const config: (t: ContextApi['t']) => MenuEntry[] = (t) => [
|
|||
// // },
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
label: t('Exchange'),
|
||||
icon: 'FarmIcon',
|
||||
href: 'https://pancake.kiemtienonline360.com/#/swap',
|
||||
},
|
||||
{
|
||||
label: t('Liquidity'),
|
||||
icon: 'FarmIcon',
|
||||
href: 'https://pancake.kiemtienonline360.com/#/pool',
|
||||
},
|
||||
{
|
||||
label: t('Farms'),
|
||||
icon: 'FarmIcon',
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import boardABI from 'config/abi/board.json'
|
|||
import multicall from 'utils/multicall'
|
||||
import boardsConfig from 'config/constants/boards'
|
||||
import { getAddress, getBoardAddress } from 'utils/addressHelpers'
|
||||
import { getBalanceAmount } from 'utils/formatBalance'
|
||||
|
||||
export const fetchBoardUserAllowances = async (account: string) => {
|
||||
const calls = boardsConfig.map((board) => {
|
||||
|
|
@ -53,13 +54,17 @@ export const fetchBoardUserInfo = async (account: string) => {
|
|||
},
|
||||
]
|
||||
const [userInfo, estimatedProfit] = await multicall(board.abi, calls)
|
||||
console.log(userInfo)
|
||||
return {
|
||||
stakedBalance: new BigNumber(userInfo.amount._hex).toJSON(),
|
||||
unLockTime: userInfo.unLockTime ? new BigNumber(userInfo.unLockTime._hex).toNumber() : 0,
|
||||
estimatedProfit: new BigNumber(estimatedProfit).toJSON(),
|
||||
name: board.name,
|
||||
amount: getBalanceAmount(new BigNumber(userInfo.amount?._hex)).toNumber(),
|
||||
rewardDebt: getBalanceAmount(new BigNumber(userInfo.rewardDebt?._hex)).toNumber(),
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
console.log('data:', data)
|
||||
return data
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,12 @@ export const fetchBoardUserDataAsync = (account) => async (dispatch) => {
|
|||
stakedBalance: userInfo[index].stakedBalance,
|
||||
unlockTime: userInfo[index].unLockTime,
|
||||
estimatedProfit: userInfo[index].estimatedProfit,
|
||||
name: userInfo[index].name,
|
||||
amount: userInfo[index].amount,
|
||||
rewardDebt: userInfo[index].rewardDebt,
|
||||
}
|
||||
})
|
||||
|
||||
console.log(arrayOfUserDataObjects)
|
||||
dispatch(setBoardsUserData({ arrayOfUserDataObjects }))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import BigNumber from 'bignumber.js'
|
|||
import styled, { keyframes } from 'styled-components'
|
||||
import { Flex, Text, Skeleton } from '@pancakeswap/uikit'
|
||||
import { provider as ProviderType } from 'web3-core'
|
||||
import { getDecimalAmountNumber } from 'utils/formatBalance'
|
||||
import { getBoardAddress } from 'utils/addressHelpers'
|
||||
import { useTranslation } from 'contexts/Localization'
|
||||
import ExpandableSectionButton from 'components/ExpandableSectionButton'
|
||||
|
|
@ -61,6 +62,7 @@ const FCard = styled.div`
|
|||
padding: 24px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
min-height: 310px;
|
||||
`
|
||||
|
||||
const Divider = styled.div`
|
||||
|
|
@ -80,33 +82,23 @@ interface NodeCardProps {
|
|||
removed: boolean
|
||||
provider?: ProviderType
|
||||
account?: string
|
||||
list?: any
|
||||
}
|
||||
|
||||
const NodeCard: React.FC<NodeCardProps> = ({ board, account, list }) => {
|
||||
const NodeCard: React.FC<NodeCardProps> = ({ board, account }) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const [showExpandableSection, setShowExpandableSection] = useState(false)
|
||||
|
||||
return (
|
||||
<FCard>
|
||||
<CardHeading name={t(board.name)} img={board.img} tokenSymbol={board.tokenSymbol} />
|
||||
<div>
|
||||
{list.map((item) => {
|
||||
return (
|
||||
<div key={item.name}>
|
||||
{board.name === item.name ? (
|
||||
<>
|
||||
<FlexText name={t('HCC Currency amount')} value={item.amount} />
|
||||
{item.name === 'Board' ? <FlexText name={t('Lock up time')} value={item.unLockTime} /> : ''}
|
||||
<FlexText name={t('possess LP')} value={item.rewardDebt} />
|
||||
</>
|
||||
<FlexText name={t('HCC Currency amount')} value={board.userData?.amount} />
|
||||
{board.userData?.name === 'Board' ? (
|
||||
<FlexText name={t('Lock up time')} value={board.userData?.unlockTime} />
|
||||
) : (
|
||||
<></>
|
||||
''
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
<FlexText name={t('possess LP')} value={board.userData?.rewardDebt} />
|
||||
</div>
|
||||
<CardActionsContainer board={board} account={account} />
|
||||
{/* <Divider />
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import Page from 'components/Layout/Page'
|
|||
import { useBoards } from 'state/hooks'
|
||||
import useRefresh from 'hooks/useRefresh'
|
||||
import { fetchBoardUserDataAsync, fetchBoardsPublicDataAsync } from 'state/actions'
|
||||
import { fetchBoardUserInfo } from 'state/boards/fetchBoardsUser'
|
||||
import { useTranslation } from 'contexts/Localization'
|
||||
import BoardCard from './components/BoardCard/BoardCard'
|
||||
import HeaderItem from './components/HeaderItem'
|
||||
|
|
@ -55,9 +56,6 @@ const Boards: React.FC = () => {
|
|||
const [boardNum, setBoardNum] = useState(0)
|
||||
const [holderNum, setHolder] = useState(0)
|
||||
|
||||
const [withdrawAmount, setWithdrawAmount] = useState(0)
|
||||
|
||||
const [boardsDataList, setBoardsDataList] = useState([])
|
||||
// // 获取资金池总额
|
||||
// const getCapital = async () => {
|
||||
// const calls = boardsConfig.map((board) => {
|
||||
|
|
@ -99,7 +97,6 @@ const Boards: React.FC = () => {
|
|||
}
|
||||
}),
|
||||
)
|
||||
console.log(boardsData)
|
||||
let total = 0
|
||||
let waitWithdrawAmountValue = 0
|
||||
boardsData.forEach((item) => {
|
||||
|
|
@ -115,31 +112,32 @@ const Boards: React.FC = () => {
|
|||
setShareOutBonus(waitWithdrawAmountValue)
|
||||
}
|
||||
// 获取信息
|
||||
const fetchInfo = async () => {
|
||||
const boardsData = await Promise.all(
|
||||
boardsConfig.map(async (boardConfig) => {
|
||||
const [boardUserInfo] = await multicall(boardConfig.poolAbi, [
|
||||
{
|
||||
address: getAddress(boardConfig.contractAddress),
|
||||
name: 'userInfo',
|
||||
params: [account],
|
||||
},
|
||||
])
|
||||
return {
|
||||
name: boardConfig.name,
|
||||
amount: getBalanceAmount(new BigNumber(boardUserInfo.amount?._hex)).toNumber(),
|
||||
rewardDebt: getBalanceAmount(new BigNumber(boardUserInfo.rewardDebt?._hex)).toNumber(),
|
||||
unLockTime: new BigNumber(boardUserInfo?.unLockTime?._hex).toNumber(),
|
||||
}
|
||||
}),
|
||||
)
|
||||
setBoardsDataList(boardsData)
|
||||
}
|
||||
// const fetchInfo = async () => {
|
||||
// const boardsData = await Promise.all(
|
||||
// boardsConfig.map(async (boardConfig) => {
|
||||
// const [boardUserInfo] = await multicall(boardConfig.poolAbi, [
|
||||
// {
|
||||
// address: getAddress(boardConfig.contractAddress),
|
||||
// name: 'userInfo',
|
||||
// params: [account],
|
||||
// },
|
||||
// ])
|
||||
// return {
|
||||
// name: boardConfig.name,
|
||||
// amount: getBalanceAmount(new BigNumber(boardUserInfo.amount?._hex)).toNumber(),
|
||||
// rewardDebt: getBalanceAmount(new BigNumber(boardUserInfo.rewardDebt?._hex)).toNumber(),
|
||||
// unLockTime: new BigNumber(boardUserInfo?.unLockTime?._hex).toNumber(),
|
||||
// }
|
||||
// }),
|
||||
// )
|
||||
// setBoardsDataList(boardsData)
|
||||
// }
|
||||
useEffect(() => {
|
||||
dispatch(fetchBoardsPublicDataAsync())
|
||||
fetchBoardShares()
|
||||
if (account) {
|
||||
fetchInfo()
|
||||
// fetchInfo()
|
||||
// const userInfo = fetchBoardUserInfo(account)
|
||||
dispatch(fetchBoardUserDataAsync(account))
|
||||
}
|
||||
}, [account, dispatch, fastRefresh])
|
||||
|
|
@ -149,7 +147,7 @@ const Boards: React.FC = () => {
|
|||
<div>
|
||||
<FlexLayout>
|
||||
{boardsList.map((board) => (
|
||||
<BoardCard list={boardsDataList} key={board.pid} board={board} account={account} removed />
|
||||
<BoardCard key={board.pid} board={board} account={account} removed />
|
||||
))}
|
||||
</FlexLayout>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -162,8 +162,10 @@ const FristCom: React.FC = () => {
|
|||
<Text> {t('Hcc Nft')}</Text>
|
||||
<Text>{t('Hcc BTC')}</Text>
|
||||
<BtnFlex>
|
||||
<RadiusBtn variant="primary">{t('Exchange')}</RadiusBtn>
|
||||
<WhiteBtn variant="secondary">{t('Bazaar')}</WhiteBtn>
|
||||
<RadiusBtn variant="primary" onClick={() => openLink('https://pancake.kiemtienonline360.com/#/swap')}>
|
||||
{t('Exchange')}
|
||||
</RadiusBtn>
|
||||
{/* <WhiteBtn variant="secondary">{t('Bazaar')}</WhiteBtn> */}
|
||||
<Flex>
|
||||
{detail.outsideChainVos.map((item) => {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -67,16 +67,16 @@ const ConnectedCom: React.FC = () => {
|
|||
<MainDiv>
|
||||
<HeaderMain title={t('recommend')} />
|
||||
<>
|
||||
<FlexCom name={t('The lower the number of')} value={`${referralRewardInfo.inviteNum}(人)`} />
|
||||
<FlexCom name={t('HCC total revenue')} value={`${referralRewardInfo.inviteReward}(HCC)`} />
|
||||
<FlexCom name={t('The lower the number of')} value={`${referralRewardInfo?.inviteNum}(人)`} />
|
||||
<FlexCom name={t('HCC total revenue')} value={`${referralRewardInfo?.inviteReward}(HCC)`} />
|
||||
<FlexCom
|
||||
name={t('To get profit')}
|
||||
value={`${referralRewardInfo.inviteReward - referralRewardInfo.inviteRewardReceive}(HCC)`}
|
||||
value={`${referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive}(HCC)`}
|
||||
/>
|
||||
</>
|
||||
<FooterBtn>
|
||||
{referralNormalConfigInfo.receiveLimit <=
|
||||
referralRewardInfo.inviteReward - referralRewardInfo.inviteRewardReceive ? (
|
||||
{referralNormalConfigInfo?.receiveLimit <=
|
||||
referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive ? (
|
||||
<ButtonGet onClick={getInviteReceive} variant="secondary">
|
||||
{t('Claim now')}
|
||||
</ButtonGet>
|
||||
|
|
@ -89,7 +89,7 @@ const ConnectedCom: React.FC = () => {
|
|||
<FooterDiv>
|
||||
<TextDiv>{`${t(
|
||||
'By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins',
|
||||
)}${formatDivNumber(referralCommanderConfigInfo.dividendFirst)}%${t('The commission')}`}</TextDiv>
|
||||
)}${formatDivNumber(referralCommanderConfigInfo?.dividendFirst)}%${t('The commission')}`}</TextDiv>
|
||||
{/* <TextDiv color="textSubtle">{t('each time')}</TextDiv>
|
||||
<TextDiv color="textSubtle">{t('last bid')}</TextDiv>
|
||||
<TextDiv color="textSubtle">{t('commission fee')}</TextDiv> */}
|
||||
|
|
|
|||
Loading…
Reference in New Issue