调整ido

This commit is contained in:
myf 2022-05-23 22:08:15 +08:00
parent 3a4c81deb7
commit 01f06ff183
8 changed files with 22 additions and 20 deletions

BIN
build.zip Normal file

Binary file not shown.

View File

@ -1118,7 +1118,7 @@
"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": "使用页面右上方的邀请,可邀请新用户进入,并在用户购买币后获得",
"The commission": "的提成!", "The commission": "的提成!",
"footer %number% text": "使用页面右上方的邀请,可邀请新用户进入,并在用户购买币后获得 %number% 的提成!", "footer %number% text": "使用页面右上方的邀请,可邀请新用户进入,并在用户购买币后获得 %number% 的提成!",
"market value": "市值", "market value": "市值(24h)",
"Loaded all": "已加载全部", "Loaded all": "已加载全部",
"Insufficient Balance": "余额不足", "Insufficient Balance": "余额不足",
"HCC Currency amount": "HCC币总量", "HCC Currency amount": "HCC币总量",

View File

@ -8,11 +8,11 @@ export default {
56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95', 56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95',
}, },
boardChef: { boardChef: {
97: '0x2D807e54A07e3B404823359eeD854Aa54AC4F237', 97: '0x4ECC687D67138694729433e77cD95eEE9a858E40',
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约 56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约
}, },
boardRewardChef: { boardRewardChef: {
97: '0x2937a050705009270c9b5bc096d57d519ab7c39b', 97: '0xbCb980b6A4CD67d81B63B0bFA734B4116B218700',
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会分红合约 56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会分红合约
}, },
holderChef: { holderChef: {
@ -20,20 +20,20 @@ export default {
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 持币人 56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 持币人
}, },
holderRewardChef: { holderRewardChef: {
97: '0x46271393dd6f2c8798a44f857888aa6a85af3527', 97: '0x61FB526924c6BAC9A08E146Da103B19c0DFA1899',
56: '0x46271393dd6f2c8798a44f857888aa6a85af3527', // NEED CHANGE 持币人分红 56: '0x46271393dd6f2c8798a44f857888aa6a85af3527', // NEED CHANGE 持币人分红
}, },
referralChef: { referralChef: {
97: '0x16ed5C884a0aA02c2E0FA9064F3EB5A8Da58B659', 97: '0xe94282DA5166AD3FEB82F7aE299b2D5DFDF392Ae',
56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请或则军团长 56: '0xf42D1e1883C2FAA058dfa0D301556EB2d964859a', // NEED CHANGE 邀请或则军团长
}, },
referralRewardChef: { referralRewardChef: {
97: '0x86a510e82aceb27ed9e9880fb981d4b42ff16cb4', 97: '0xf42D1e1883C2FAA058dfa0D301556EB2d964859a',
56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请或则军团长收益 56: '0xf42D1e1883C2FAA058dfa0D301556EB2d964859a', // NEED CHANGE 邀请或则军团长收益
}, },
idoPurchase: { idoPurchase: {
97: '0x7657AF82EA0A59Cdc697d2c7b7b67E376ed36ec2', 97: '0xCCFD5B33774a1568A322FCa262D3378Ff8CcdeCB',
56: '0x7657AF82EA0A59Cdc697d2c7b7b67E376ed36ec2', // NEED CHANGE IDO兑换 56: '0xCCFD5B33774a1568A322FCa262D3378Ff8CcdeCB', // NEED CHANGE IDO兑换
}, },
lotteryV2: { lotteryV2: {
97: '0x5790c3534F30437641541a0FA04C992799602998', 97: '0x5790c3534F30437641541a0FA04C992799602998',

View File

@ -73,7 +73,7 @@ const tokens = {
symbol: 'HCC', symbol: 'HCC',
address: { address: {
56: '0x20de22029ab63cf9A7Cf5fEB2b737Ca1eE4c82A6', 56: '0x20de22029ab63cf9A7Cf5fEB2b737Ca1eE4c82A6',
97: '0x6F9B2c66BbefE35a364280A2E8B51b255eC51678', 97: '0xE7619D544bD06f4d7362c8aA06a4ca0Ea73ce8c2',
}, },
decimals: 18, decimals: 18,
projectLink: 'https://tranchess.com/', projectLink: 'https://tranchess.com/',

View File

@ -1247,7 +1247,7 @@
"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", "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",
"The commission": "The commission", "The commission": "The commission",
"footer %number% text": "By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins %number% The commission", "footer %number% text": "By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins %number% The commission",
"market value": "market value", "market value": "market value(24h)",
"Loaded all": "Loaded all", "Loaded all": "Loaded all",
"HCC Currency amount": "HCC Currency amount", "HCC Currency amount": "HCC Currency amount",
"Lock up time": "Lock up time", "Lock up time": "Lock up time",

View File

@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react' import React, { useState, useEffect } from 'react'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import styled from 'styled-components' import styled from 'styled-components'
import BigNumber from 'bignumber.js'
import { useTranslation } from 'contexts/Localization' import { useTranslation } from 'contexts/Localization'
import { Text, Button, useModal } from '@pancakeswap/uikit' import { Text, Button, useModal } from '@pancakeswap/uikit'
import { getAddress } from 'utils/addressHelpers' import { getAddress } from 'utils/addressHelpers'
@ -8,6 +9,7 @@ import { getPurchaseActivity } from 'services/idoPurchase'
import { fetchIdoUserAllowances } from 'state/ido' import { fetchIdoUserAllowances } from 'state/ido'
import { useERC20 } from 'hooks/useContract' import { useERC20 } from 'hooks/useContract'
import useToast from 'hooks/useToast' import useToast from 'hooks/useToast'
import { getDecimalAmountNumber, formatDivNumber } from 'utils/formatBalance'
import tokens from 'config/constants/tokens' import tokens from 'config/constants/tokens'
import { useAccount } from 'state/userInfo/hooks' import { useAccount } from 'state/userInfo/hooks'
@ -113,12 +115,12 @@ const ExchangeCard: React.FC<Props> = ({ status, roundDetail, time }) => {
const [hccPrice, setHccPrice] = useState('') const [hccPrice, setHccPrice] = useState('')
const handleUsdtChange = (e: React.FormEvent<HTMLInputElement>) => { const handleUsdtChange = (e: React.FormEvent<HTMLInputElement>) => {
const price = Number(e.currentTarget.value) * roundDetail?.price const price = new BigNumber(e.currentTarget.value).multipliedBy(roundDetail?.price)
setUsdtPrice(e.currentTarget.value) setUsdtPrice(e.currentTarget.value)
e.currentTarget.value ? setHccPrice(price.toString()) : setHccPrice('') e.currentTarget.value ? setHccPrice(price.toString()) : setHccPrice('')
} }
const handleHccChange = (e: React.FormEvent<HTMLInputElement>) => { const handleHccChange = (e: React.FormEvent<HTMLInputElement>) => {
const price = Number(e.currentTarget.value) / roundDetail?.price const price = new BigNumber(e.currentTarget.value).div(roundDetail?.price).toNumber()
setHccPrice(e.currentTarget.value) setHccPrice(e.currentTarget.value)
e.currentTarget.value ? setUsdtPrice(price.toString()) : setUsdtPrice('') e.currentTarget.value ? setUsdtPrice(price.toString()) : setUsdtPrice('')
} }
@ -127,7 +129,7 @@ const ExchangeCard: React.FC<Props> = ({ status, roundDetail, time }) => {
// 立即兑换 // 立即兑换
const immediatelyChange = async () => { const immediatelyChange = async () => {
try { try {
const enoughBalance = onCheckBalance(hccPrice) const enoughBalance = onCheckBalance(usdtPrice)
if (enoughBalance) { if (enoughBalance) {
const res = await buyTransaction(hccPrice) const res = await buyTransaction(hccPrice)
} }

View File

@ -62,10 +62,10 @@ const RateCom: React.FC<Props> = ({ status, roundDetail }) => {
</FlexRowCenter> </FlexRowCenter>
<FlexCenter> <FlexCenter>
<Text color="textSubtle"> <Text color="textSubtle">
{t('gross')}{status === 'none' ? ' -------- ' : roundDetail?.total}HCC {t('gross')}{status === 'none' ? ' -------- ' : `${roundDetail?.total}HCC`}
</Text> </Text>
<Text color="textSubtle" marginLeft={20}> <Text color="textSubtle" marginLeft={20}>
{t('remaining quantity')}{status === 'none' ? ' -------- ' : roundDetail?.remaining}HCC {t('remaining quantity')}{status === 'none' ? ' -------- ' : `${roundDetail?.remaining}HCC`}
</Text> </Text>
</FlexCenter> </FlexCenter>
</> </>

View File

@ -51,9 +51,8 @@ export const useBuyTransaction = () => {
const transaction = async (amount) => { const transaction = async (amount) => {
const data = await getPurchaseActivity() const data = await getPurchaseActivity()
const { id } = data const { id } = data
const params = [id, new BigNumber(amount).times(18).toString()] const params = [id, new BigNumber(amount).times(new BigNumber(10).pow(18)).toString()]
const res = await idoPurchase.purchaseWithLock(...params) const res = await idoPurchase.purchaseWithLock(...params)
console.log(res)
return res return res
} }
return transaction return transaction
@ -82,7 +81,9 @@ export const useGetRound = () => {
endTime: new BigNumber(item?.endTime._hex).toNumber() * 1000, endTime: new BigNumber(item?.endTime._hex).toNumber() * 1000,
price: 1 / formatDivNumber(item?.price._hex, 18), price: 1 / formatDivNumber(item?.price._hex, 18),
remaining: formatDivNumber(item?.remaining._hex, 18), remaining: formatDivNumber(item?.remaining._hex, 18),
// remaining: new BigNumber(item?.remaining._hex).toString(),
token: item?.token, token: item?.token,
// total: new BigNumber(item?.total._hex).toString(),
total: formatDivNumber(item?.total._hex, 18), total: formatDivNumber(item?.total._hex, 18),
} }
}) })
@ -129,7 +130,6 @@ export const useHarvest = () => {
const idoPurchase = useIdoPurchase() const idoPurchase = useIdoPurchase()
const transaction = async () => { const transaction = async () => {
const res = await idoPurchase.harvest() const res = await idoPurchase.harvest()
console.log(res)
return res return res
} }
return transaction return transaction