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