feat: 获取hcc价格

This commit is contained in:
gary 2022-04-28 14:02:05 +08:00
parent 4ac60dc05f
commit cd064ce668
9 changed files with 304 additions and 4476 deletions

View File

@ -1,8 +1,2 @@
# 🥞 Pancake Frontend #
1. https://pancake.kiemtienonline360.com/#/add/BNB pancake测试服
[![Netlify Status](https://api.netlify.com/api/v1/badges/7bebf1a3-be7b-4165-afd1-446256acd5e3/deploy-status)](https://app.netlify.com/sites/pancake-prod/deploys)
This project contains the main features of the pancake application.
If you want to contribute, please refer to the [contributing guidelines](./CONTRIBUTING.md) of this project.
test2

View File

@ -6,7 +6,7 @@ import { useTranslation } from 'contexts/Localization'
import useTheme from 'hooks/useTheme' import useTheme from 'hooks/useTheme'
import useAuth from 'hooks/useAuth' import useAuth from 'hooks/useAuth'
import { useDispatch } from 'react-redux' import { useDispatch } from 'react-redux'
import { usePriceCakeBusd, useProfile } from 'state/hooks' import { usePriceHccUsdt, useProfile } from 'state/hooks'
import { useUnactiveAccount, useSignLogin, useAccount, useUserInfo } from 'state/userInfo/hooks' import { useUnactiveAccount, useSignLogin, useAccount, useUserInfo } from 'state/userInfo/hooks'
import useWeb3Provider from 'hooks/useActiveWeb3React' import useWeb3Provider from 'hooks/useActiveWeb3React'
import { clearUserInfo } from 'state/actions' import { clearUserInfo } from 'state/actions'
@ -17,7 +17,7 @@ const Menu = (props) => {
const { login, logout } = useAuth() const { login, logout } = useAuth()
const [hasWalletLogin, setHasWalletLogin] = useState(false) const [hasWalletLogin, setHasWalletLogin] = useState(false)
const { isDark, toggleTheme } = useTheme() const { isDark, toggleTheme } = useTheme()
const cakePriceUsd = usePriceCakeBusd() const hccPriceUsdt = usePriceHccUsdt()
const { library } = useWeb3Provider() const { library } = useWeb3Provider()
const unActiveAccount = useUnactiveAccount() const unActiveAccount = useUnactiveAccount()
const dispatch = useDispatch() const dispatch = useDispatch()
@ -54,7 +54,7 @@ const Menu = (props) => {
currentLang={currentLanguage.code} currentLang={currentLanguage.code}
langs={languageList} langs={languageList}
setLang={setLanguage} setLang={setLanguage}
cakePriceUsd={cakePriceUsd.toNumber()} cakePriceUsd={hccPriceUsdt.toNumber()}
links={config(t)} links={config(t)}
{...props} {...props}
/> />

File diff suppressed because it is too large Load Diff

View File

@ -2,240 +2,240 @@ import tokens from './tokens'
import farms from './farms' import farms from './farms'
import { Ifo, Token } from './types' import { Ifo, Token } from './types'
const cakeBnbLpToken: Token = { // const cakeBnbLpToken: Token = {
symbol: farms[1].lpSymbol, // symbol: farms[1].lpSymbol,
address: farms[1].lpAddresses, // address: farms[1].lpAddresses,
decimals: 18, // decimals: 18,
} // }
const ifos: Ifo[] = [ const ifos: Ifo[] = [
{ // {
id: 'kalmar', // id: 'kalmar',
address: '0x1aFB32b76696CdF05593Ca3f3957AEFB23a220FB', // address: '0x1aFB32b76696CdF05593Ca3f3957AEFB23a220FB',
isActive: true, // isActive: true,
name: 'Kalmar (KALM)', // name: 'Kalmar (KALM)',
poolBasic: { // poolBasic: {
saleAmount: '375,000 KALM', // saleAmount: '375,000 KALM',
raiseAmount: '$750,000', // raiseAmount: '$750,000',
cakeToBurn: '$375,000', // cakeToBurn: '$375,000',
distributionRatio: 0.3, // distributionRatio: 0.3,
}, // },
poolUnlimited: { // poolUnlimited: {
saleAmount: '875,000 KALM', // saleAmount: '875,000 KALM',
raiseAmount: '$2,500,000', // raiseAmount: '$2,500,000',
cakeToBurn: '$1,250,000', // cakeToBurn: '$1,250,000',
distributionRatio: 0.7, // distributionRatio: 0.7,
}, // },
currency: cakeBnbLpToken, // currency: cakeBnbLpToken,
token: tokens.kalm, // token: tokens.kalm,
releaseBlockNumber: 7707736, // releaseBlockNumber: 7707736,
campaignId: '511110000', // campaignId: '511110000',
articleUrl: 'https://pancakeswap.medium.com/kalmar-kalm-ifo-to-be-hosted-on-pancakeswap-4540059753e4', // articleUrl: 'https://pancakeswap.medium.com/kalmar-kalm-ifo-to-be-hosted-on-pancakeswap-4540059753e4',
tokenOfferingPrice: 2.0, // tokenOfferingPrice: 2.0,
version: 2, // version: 2,
}, // },
{ // {
id: 'hotcross', // id: 'hotcross',
address: '0xb664cdbe385656F8c54031c0CB12Cea55b584b63', // address: '0xb664cdbe385656F8c54031c0CB12Cea55b584b63',
isActive: false, // isActive: false,
name: 'Hot Cross (HOTCROSS)', // name: 'Hot Cross (HOTCROSS)',
poolBasic: { // poolBasic: {
saleAmount: '15,000,000 HOTCROSS', // saleAmount: '15,000,000 HOTCROSS',
raiseAmount: '$750,000', // raiseAmount: '$750,000',
cakeToBurn: '$375,000', // cakeToBurn: '$375,000',
distributionRatio: 0.3, // distributionRatio: 0.3,
}, // },
poolUnlimited: { // poolUnlimited: {
saleAmount: '35,000,000 HOTCROSS', // saleAmount: '35,000,000 HOTCROSS',
raiseAmount: '$1,750,000', // raiseAmount: '$1,750,000',
cakeToBurn: '$875,000', // cakeToBurn: '$875,000',
distributionRatio: 0.7, // distributionRatio: 0.7,
}, // },
currency: cakeBnbLpToken, // currency: cakeBnbLpToken,
token: tokens.hotcross, // token: tokens.hotcross,
releaseBlockNumber: 7477900, // releaseBlockNumber: 7477900,
campaignId: '511100000', // campaignId: '511100000',
articleUrl: 'https://pancakeswap.medium.com/hot-cross-hotcross-ifo-to-be-hosted-on-pancakeswap-10e70f1f6841', // articleUrl: 'https://pancakeswap.medium.com/hot-cross-hotcross-ifo-to-be-hosted-on-pancakeswap-10e70f1f6841',
tokenOfferingPrice: 0.05, // tokenOfferingPrice: 0.05,
version: 2, // version: 2,
}, // },
{ // {
id: 'horizon', // id: 'horizon',
address: '0x6137B571f7F1E44839ae10310a08be86D1A4D03B', // address: '0x6137B571f7F1E44839ae10310a08be86D1A4D03B',
isActive: false, // isActive: false,
name: 'Horizon Protocol (HZN)', // name: 'Horizon Protocol (HZN)',
poolBasic: { // poolBasic: {
saleAmount: '3,000,000 HZN', // saleAmount: '3,000,000 HZN',
raiseAmount: '$750,000', // raiseAmount: '$750,000',
cakeToBurn: '$375,000', // cakeToBurn: '$375,000',
distributionRatio: 0.3, // distributionRatio: 0.3,
}, // },
poolUnlimited: { // poolUnlimited: {
saleAmount: '7,000,000 HZN', // saleAmount: '7,000,000 HZN',
raiseAmount: '$1,750,000', // raiseAmount: '$1,750,000',
cakeToBurn: '$875,000', // cakeToBurn: '$875,000',
distributionRatio: 0.7, // distributionRatio: 0.7,
}, // },
currency: cakeBnbLpToken, // currency: cakeBnbLpToken,
token: tokens.hzn, // token: tokens.hzn,
releaseBlockNumber: 6581111, // releaseBlockNumber: 6581111,
campaignId: '511090000', // campaignId: '511090000',
articleUrl: 'https://pancakeswap.medium.com/horizon-protocol-hzn-ifo-to-be-hosted-on-pancakeswap-51f79601c9d8', // articleUrl: 'https://pancakeswap.medium.com/horizon-protocol-hzn-ifo-to-be-hosted-on-pancakeswap-51f79601c9d8',
tokenOfferingPrice: 0.25, // tokenOfferingPrice: 0.25,
version: 2, // version: 2,
}, // },
{ // {
id: 'belt', // id: 'belt',
address: '0xc9FBedC033a1c479a6AD451ffE463025E92a1d38', // address: '0xc9FBedC033a1c479a6AD451ffE463025E92a1d38',
isActive: false, // isActive: false,
name: 'Belt (BELT)', // name: 'Belt (BELT)',
poolUnlimited: { // poolUnlimited: {
saleAmount: '150,000 BELT', // saleAmount: '150,000 BELT',
raiseAmount: '$3,000,000', // raiseAmount: '$3,000,000',
cakeToBurn: '$1,500,000', // cakeToBurn: '$1,500,000',
distributionRatio: 1, // distributionRatio: 1,
}, // },
currency: cakeBnbLpToken, // currency: cakeBnbLpToken,
token: tokens.belt, // token: tokens.belt,
releaseBlockNumber: 5493919, // releaseBlockNumber: 5493919,
campaignId: '511080000', // campaignId: '511080000',
articleUrl: 'https://pancakeswap.medium.com/belt-fi-belt-ifo-to-be-hosted-on-pancakeswap-353585117e32', // articleUrl: 'https://pancakeswap.medium.com/belt-fi-belt-ifo-to-be-hosted-on-pancakeswap-353585117e32',
tokenOfferingPrice: null, // tokenOfferingPrice: null,
version: 1, // version: 1,
}, // },
{ // {
id: 'watch', // id: 'watch',
address: '0x55344b55C71Ad8834C397E6e08dF5195cF84fe6d', // address: '0x55344b55C71Ad8834C397E6e08dF5195cF84fe6d',
isActive: false, // isActive: false,
name: 'Yieldwatch (WATCH)', // name: 'Yieldwatch (WATCH)',
poolUnlimited: { // poolUnlimited: {
saleAmount: '8,000,000 WATCH', // saleAmount: '8,000,000 WATCH',
raiseAmount: '$800,000', // raiseAmount: '$800,000',
cakeToBurn: '$400,000', // cakeToBurn: '$400,000',
distributionRatio: 1, // distributionRatio: 1,
}, // },
currency: cakeBnbLpToken, // currency: cakeBnbLpToken,
token: tokens.watch, // token: tokens.watch,
releaseBlockNumber: 5294924, // releaseBlockNumber: 5294924,
campaignId: '511070000', // campaignId: '511070000',
articleUrl: 'https://pancakeswap.medium.com/yieldwatch-watch-ifo-to-be-hosted-on-pancakeswap-d24301f17241', // articleUrl: 'https://pancakeswap.medium.com/yieldwatch-watch-ifo-to-be-hosted-on-pancakeswap-d24301f17241',
tokenOfferingPrice: null, // tokenOfferingPrice: null,
version: 1, // version: 1,
}, // },
{ // {
id: 'berry', // id: 'berry',
address: '0x5d028cE3435B2bB9AceBfaC599EEbA1ccD63d7dd', // address: '0x5d028cE3435B2bB9AceBfaC599EEbA1ccD63d7dd',
isActive: false, // isActive: false,
name: 'Berry (BRY)', // name: 'Berry (BRY)',
poolUnlimited: { // poolUnlimited: {
saleAmount: '2,000,000 BRY', // saleAmount: '2,000,000 BRY',
raiseAmount: '$1,000,000', // raiseAmount: '$1,000,000',
cakeToBurn: '$500,000', // cakeToBurn: '$500,000',
distributionRatio: 1, // distributionRatio: 1,
}, // },
currency: cakeBnbLpToken, // currency: cakeBnbLpToken,
token: tokens.bry, // token: tokens.bry,
releaseBlockNumber: 4750968, // releaseBlockNumber: 4750968,
campaignId: '511060000', // campaignId: '511060000',
articleUrl: 'https://pancakeswap.medium.com/berry-bry-ifo-to-be-hosted-on-pancakeswap-b4f9095e9cdb', // articleUrl: 'https://pancakeswap.medium.com/berry-bry-ifo-to-be-hosted-on-pancakeswap-b4f9095e9cdb',
tokenOfferingPrice: null, // tokenOfferingPrice: null,
version: 1, // version: 1,
}, // },
{ // {
id: 'soteria', // id: 'soteria',
address: '0x9C21123D94b93361a29B2C2EFB3d5CD8B17e0A9e', // address: '0x9C21123D94b93361a29B2C2EFB3d5CD8B17e0A9e',
isActive: false, // isActive: false,
name: 'Soteria (wSOTE)', // name: 'Soteria (wSOTE)',
poolUnlimited: { // poolUnlimited: {
saleAmount: '1,500,000 wSOTE', // saleAmount: '1,500,000 wSOTE',
raiseAmount: '$525,000', // raiseAmount: '$525,000',
cakeToBurn: '$262,500', // cakeToBurn: '$262,500',
distributionRatio: 1, // distributionRatio: 1,
}, // },
currency: cakeBnbLpToken, // currency: cakeBnbLpToken,
token: tokens.wsote, // token: tokens.wsote,
releaseBlockNumber: 4086064, // releaseBlockNumber: 4086064,
campaignId: '511050000', // campaignId: '511050000',
articleUrl: 'https://pancakeswap.medium.com/soteria-sota-ifo-to-be-hosted-on-pancakeswap-64b727c272ae', // articleUrl: 'https://pancakeswap.medium.com/soteria-sota-ifo-to-be-hosted-on-pancakeswap-64b727c272ae',
tokenOfferingPrice: null, // tokenOfferingPrice: null,
version: 1, // version: 1,
}, // },
{ // {
id: 'helmet', // id: 'helmet',
address: '0xa32509d760ee47Eb2Be96D338b5d69B5FBa4eFEB', // address: '0xa32509d760ee47Eb2Be96D338b5d69B5FBa4eFEB',
isActive: false, // isActive: false,
name: 'Helmet.insure (Helmet)', // name: 'Helmet.insure (Helmet)',
poolUnlimited: { // poolUnlimited: {
saleAmount: '10,000,000 Helmet', // saleAmount: '10,000,000 Helmet',
raiseAmount: '$1,000,000', // raiseAmount: '$1,000,000',
cakeToBurn: '$500,000', // cakeToBurn: '$500,000',
distributionRatio: 1, // distributionRatio: 1,
}, // },
currency: cakeBnbLpToken, // currency: cakeBnbLpToken,
token: tokens.helmet, // token: tokens.helmet,
releaseBlockNumber: 3771926, // releaseBlockNumber: 3771926,
campaignId: '511040000', // campaignId: '511040000',
articleUrl: 'https://pancakeswap.medium.com/1-000-000-helmet-helmet-ifo-to-be-hosted-on-pancakeswap-3379a2a89a67', // articleUrl: 'https://pancakeswap.medium.com/1-000-000-helmet-helmet-ifo-to-be-hosted-on-pancakeswap-3379a2a89a67',
tokenOfferingPrice: null, // tokenOfferingPrice: null,
version: 1, // version: 1,
}, // },
{ // {
id: 'tenet', // id: 'tenet',
address: '0xB922aA19A2603A07C6C9ED6c236618C9bac51f06', // address: '0xB922aA19A2603A07C6C9ED6c236618C9bac51f06',
isActive: false, // isActive: false,
name: 'Tenet (TEN)', // name: 'Tenet (TEN)',
poolUnlimited: { // poolUnlimited: {
saleAmount: '1,000,000 TEN', // saleAmount: '1,000,000 TEN',
raiseAmount: '$1,000,000', // raiseAmount: '$1,000,000',
cakeToBurn: '$500,000', // cakeToBurn: '$500,000',
distributionRatio: 1, // distributionRatio: 1,
}, // },
currency: cakeBnbLpToken, // currency: cakeBnbLpToken,
token: tokens.ten, // token: tokens.ten,
releaseBlockNumber: 3483883, // releaseBlockNumber: 3483883,
campaignId: '511030000', // campaignId: '511030000',
articleUrl: 'https://pancakeswap.medium.com/tenet-ten-ifo-to-be-hosted-on-pancakeswap-b7e1eb4cb272', // articleUrl: 'https://pancakeswap.medium.com/tenet-ten-ifo-to-be-hosted-on-pancakeswap-b7e1eb4cb272',
tokenOfferingPrice: null, // tokenOfferingPrice: null,
version: 1, // version: 1,
}, // },
{ // {
id: 'ditto', // id: 'ditto',
address: '0x570c9eB19553526Fb35895a531928E19C7D20788', // address: '0x570c9eB19553526Fb35895a531928E19C7D20788',
isActive: false, // isActive: false,
name: 'Ditto (DITTO)', // name: 'Ditto (DITTO)',
poolUnlimited: { // poolUnlimited: {
saleAmount: '700,000 DITTO', // saleAmount: '700,000 DITTO',
raiseAmount: '$630,000', // raiseAmount: '$630,000',
cakeToBurn: '$315,000', // cakeToBurn: '$315,000',
distributionRatio: 1, // distributionRatio: 1,
}, // },
currency: cakeBnbLpToken, // currency: cakeBnbLpToken,
token: tokens.ditto, // token: tokens.ditto,
releaseBlockNumber: 3279767, // releaseBlockNumber: 3279767,
campaignId: '511020000', // campaignId: '511020000',
articleUrl: 'https://pancakeswap.medium.com/ditto-money-ditto-ifo-to-be-hosted-on-pancakeswap-342da3059a66', // articleUrl: 'https://pancakeswap.medium.com/ditto-money-ditto-ifo-to-be-hosted-on-pancakeswap-342da3059a66',
tokenOfferingPrice: null, // tokenOfferingPrice: null,
version: 1, // version: 1,
}, // },
{ // {
id: 'blink', // id: 'blink',
address: '0x44a9Cc8463EC00937242b660BF65B10365d99baD', // address: '0x44a9Cc8463EC00937242b660BF65B10365d99baD',
isActive: false, // isActive: false,
name: 'BLINk (BLK)', // name: 'BLINk (BLK)',
poolUnlimited: { // poolUnlimited: {
saleAmount: '100,000,000 BLINK', // saleAmount: '100,000,000 BLINK',
raiseAmount: '$1,000,000', // raiseAmount: '$1,000,000',
cakeToBurn: '$500,000', // cakeToBurn: '$500,000',
distributionRatio: 1, // distributionRatio: 1,
}, // },
currency: cakeBnbLpToken, // currency: cakeBnbLpToken,
token: tokens.blink, // token: tokens.blink,
releaseBlockNumber: 3279767, // releaseBlockNumber: 3279767,
campaignId: '511010000', // campaignId: '511010000',
articleUrl: 'https://medium.com/pancakeswap/1-000-000-ifo-blink-joins-pancakeswap-15841800bdd8', // articleUrl: 'https://medium.com/pancakeswap/1-000-000-ifo-blink-joins-pancakeswap-15841800bdd8',
tokenOfferingPrice: null, // tokenOfferingPrice: null,
version: 1, // version: 1,
}, // },
] ]
export default ifos export default ifos

View File

@ -9,16 +9,16 @@ const priceHelperLps: FarmConfig[] = [
* Prices are then fetched for all farms (masterchef + priceHelperLps). * Prices are then fetched for all farms (masterchef + priceHelperLps).
* Before storing to redux, farms without a PID are filtered out. * Before storing to redux, farms without a PID are filtered out.
*/ */
{ // {
pid: null, // pid: null,
lpSymbol: 'QSD-BNB LP', // lpSymbol: 'QSD-BNB LP',
lpAddresses: { // lpAddresses: {
97: '', // 97: '',
56: '0x7b3ae32eE8C532016f3E31C8941D937c59e055B9', // 56: '0x7b3ae32eE8C532016f3E31C8941D937c59e055B9',
}, // },
token: tokens.qsd, // token: tokens.qsd,
quoteToken: tokens.wbnb, // quoteToken: tokens.wbnb,
}, // },
] ]
export default priceHelperLps export default priceHelperLps

View File

@ -12,7 +12,7 @@ const getFarmFromTokenSymbol = (farms: Farm[], tokenSymbol: string, preferredQuo
const getFarmBaseTokenPrice = (farm: Farm, quoteTokenFarm: Farm, bnbPriceBusd: BigNumber): BigNumber => { const getFarmBaseTokenPrice = (farm: Farm, quoteTokenFarm: Farm, bnbPriceBusd: BigNumber): BigNumber => {
const hasTokenPriceVsQuote = Boolean(farm.tokenPriceVsQuote) const hasTokenPriceVsQuote = Boolean(farm.tokenPriceVsQuote)
if (farm.quoteToken.symbol === 'BUSD') { if (farm.quoteToken.symbol === 'BUSD' || farm.quoteToken.symbol === 'USDT') {
return hasTokenPriceVsQuote ? new BigNumber(farm.tokenPriceVsQuote) : BIG_ZERO return hasTokenPriceVsQuote ? new BigNumber(farm.tokenPriceVsQuote) : BIG_ZERO
} }
@ -37,7 +37,7 @@ const getFarmBaseTokenPrice = (farm: Farm, quoteTokenFarm: Farm, bnbPriceBusd: B
: BIG_ZERO : BIG_ZERO
} }
if (quoteTokenFarm.quoteToken.symbol === 'BUSD') { if (quoteTokenFarm.quoteToken.symbol === 'BUSD' || farm.quoteToken.symbol === 'USDT') {
const quoteTokenInBusd = quoteTokenFarm.tokenPriceVsQuote const quoteTokenInBusd = quoteTokenFarm.tokenPriceVsQuote
return hasTokenPriceVsQuote && quoteTokenInBusd return hasTokenPriceVsQuote && quoteTokenInBusd
? new BigNumber(farm.tokenPriceVsQuote).times(quoteTokenInBusd) ? new BigNumber(farm.tokenPriceVsQuote).times(quoteTokenInBusd)
@ -49,7 +49,7 @@ const getFarmBaseTokenPrice = (farm: Farm, quoteTokenFarm: Farm, bnbPriceBusd: B
} }
const getFarmQuoteTokenPrice = (farm: Farm, quoteTokenFarm: Farm, bnbPriceBusd: BigNumber): BigNumber => { const getFarmQuoteTokenPrice = (farm: Farm, quoteTokenFarm: Farm, bnbPriceBusd: BigNumber): BigNumber => {
if (farm.quoteToken.symbol === 'BUSD') { if (farm.quoteToken.symbol === 'BUSD' || farm.quoteToken.symbol === 'USDT') {
return BIG_ONE return BIG_ONE
} }
@ -65,7 +65,7 @@ const getFarmQuoteTokenPrice = (farm: Farm, quoteTokenFarm: Farm, bnbPriceBusd:
return quoteTokenFarm.tokenPriceVsQuote ? bnbPriceBusd.times(quoteTokenFarm.tokenPriceVsQuote) : BIG_ZERO return quoteTokenFarm.tokenPriceVsQuote ? bnbPriceBusd.times(quoteTokenFarm.tokenPriceVsQuote) : BIG_ZERO
} }
if (quoteTokenFarm.quoteToken.symbol === 'BUSD') { if (quoteTokenFarm.quoteToken.symbol === 'BUSD' || farm.quoteToken.symbol === 'USDT') {
return quoteTokenFarm.tokenPriceVsQuote ? new BigNumber(quoteTokenFarm.tokenPriceVsQuote) : BIG_ZERO return quoteTokenFarm.tokenPriceVsQuote ? new BigNumber(quoteTokenFarm.tokenPriceVsQuote) : BIG_ZERO
} }
@ -73,8 +73,8 @@ const getFarmQuoteTokenPrice = (farm: Farm, quoteTokenFarm: Farm, bnbPriceBusd:
} }
const fetchFarmsPrices = async (farms) => { const fetchFarmsPrices = async (farms) => {
const bnbBusdFarm = farms.find((farm: Farm) => farm.pid === 252) const bnbBusdFarm = farms.find((farm: Farm) => farm.pid === 252) // NEED CHANGE
const bnbPriceBusd = bnbBusdFarm.tokenPriceVsQuote ? BIG_ONE.div(bnbBusdFarm.tokenPriceVsQuote) : BIG_ZERO const bnbPriceBusd = bnbBusdFarm?.tokenPriceVsQuote ? BIG_ONE.div(bnbBusdFarm.tokenPriceVsQuote) : BIG_ZERO
const farmsWithPrices = farms.map((farm) => { const farmsWithPrices = farms.map((farm) => {
const quoteTokenFarm = getFarmFromTokenSymbol(farms, farm.quoteToken.symbol) const quoteTokenFarm = getFarmFromTokenSymbol(farms, farm.quoteToken.symbol)

View File

@ -56,7 +56,6 @@ const fetchFarm = async (farm: Farm): Promise<PublicFarmData> => {
name: 'decimals', name: 'decimals',
}, },
] ]
const [tokenBalanceLP, quoteTokenBalanceLP, lpTokenBalanceMC, lpTotalSupply, tokenDecimals, quoteTokenDecimals] = const [tokenBalanceLP, quoteTokenBalanceLP, lpTokenBalanceMC, lpTotalSupply, tokenDecimals, quoteTokenDecimals] =
await multicall(erc20, calls) await multicall(erc20, calls)
@ -75,24 +74,23 @@ const fetchFarm = async (farm: Farm): Promise<PublicFarmData> => {
const lpTotalInQuoteToken = quoteTokenAmountMc.times(new BigNumber(2)) const lpTotalInQuoteToken = quoteTokenAmountMc.times(new BigNumber(2))
// Only make masterchef calls if farm has pid // Only make masterchef calls if farm has pid
const [info, totalAllocPoint] = const [info, totalAllocPoint] = [null, null]
pid || pid === 0 // (pid || pid === 0) // NEED CHANGE
? await multicall(masterchefABI, [ // ? await multicall(masterchefABI, [
{ // {
address: getMasterChefAddress(), // address: getMasterChefAddress(),
name: 'poolInfo', // name: 'poolInfo',
params: [pid], // params: [pid],
}, // },
{ // {
address: getMasterChefAddress(), // address: getMasterChefAddress(),
name: 'totalAllocPoint', // name: 'totalAllocPoint',
}, // },
]) // ])
: [null, null] // : [null, null]
const allocPoint = info ? new BigNumber(info.allocPoint?._hex) : BIG_ZERO const allocPoint = info ? new BigNumber(info.allocPoint?._hex) : BIG_ZERO
const poolWeight = totalAllocPoint ? allocPoint.div(new BigNumber(totalAllocPoint)) : BIG_ZERO const poolWeight = totalAllocPoint ? allocPoint.div(new BigNumber(totalAllocPoint)) : BIG_ZERO
return { return {
tokenAmountMc: tokenAmountMc.toJSON(), tokenAmountMc: tokenAmountMc.toJSON(),
quoteTokenAmountMc: quoteTokenAmountMc.toJSON(), quoteTokenAmountMc: quoteTokenAmountMc.toJSON(),

View File

@ -79,7 +79,7 @@ export const usePollCoreFarmData = () => {
const { fastRefresh } = useRefresh() const { fastRefresh } = useRefresh()
useEffect(() => { useEffect(() => {
dispatch(fetchFarmsPublicDataAsync([251, 252])) dispatch(fetchFarmsPublicDataAsync([251, 252, 1000])) // NEED CHANGE
}, [dispatch, fastRefresh]) }, [dispatch, fastRefresh])
} }
@ -373,6 +373,10 @@ export const usePriceCakeBusd = (): BigNumber => {
const cakeBnbFarm = useFarmFromPid(251) const cakeBnbFarm = useFarmFromPid(251)
return new BigNumber(cakeBnbFarm.token.busdPrice) return new BigNumber(cakeBnbFarm.token.busdPrice)
} }
export const usePriceHccUsdt = (): BigNumber => {
const hccUsdtFarm = useFarmFromPid(1000) // NEED CHANGE
return new BigNumber(hccUsdtFarm.token.busdPrice)
}
// Block // Block
export const useBlock = () => { export const useBlock = () => {

View File

@ -42,14 +42,15 @@ const ImageDiv = styled(Image)`
height: 300px; height: 300px;
} }
` `
interface BuyNftModalProps {
const BuyNftModal: React.FC = () => { onDismiss?: () => void
}
const BuyNftModal: React.FC<BuyNftModalProps> = ({ onDismiss }) => {
const { t } = useTranslation() const { t } = useTranslation()
const referralCommanderConfigInfo = useReferralCommanderConfigInfo() const referralCommanderConfigInfo = useReferralCommanderConfigInfo()
const referralRewardInfo = useReferralNormalConfigInfo() const referralRewardInfo = useReferralNormalConfigInfo()
// const onDismiss = () => {}
return ( return (
<ModalDiv title={`${t('purchase')}${referralCommanderConfigInfo.properties.name}`}> <ModalDiv title={`${t('purchase')}${referralCommanderConfigInfo.properties.name}`} onDismiss={onDismiss}>
<Flex alignItems="center" flexWrap="wrap" justifyContent="center"> <Flex alignItems="center" flexWrap="wrap" justifyContent="center">
<ImageDiv <ImageDiv
src={referralCommanderConfigInfo.properties.cover as string} src={referralCommanderConfigInfo.properties.cover as string}