ido
This commit is contained in:
parent
a74ef1eff1
commit
f2cadf0c9a
|
|
@ -0,0 +1,131 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"inputs": [{ "internalType": "contract IERC20", "name": "_HCC", "type": "address" }],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "constructor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anonymous": false,
|
||||||
|
"inputs": [
|
||||||
|
{ "indexed": false, "internalType": "uint256", "name": "round", "type": "uint256" },
|
||||||
|
{ "indexed": false, "internalType": "uint256", "name": "total", "type": "uint256" },
|
||||||
|
{ "indexed": false, "internalType": "address", "name": "token", "type": "address" },
|
||||||
|
{ "indexed": false, "internalType": "uint256", "name": "price", "type": "uint256" },
|
||||||
|
{ "indexed": false, "internalType": "uint256", "name": "beginTime", "type": "uint256" },
|
||||||
|
{ "indexed": false, "internalType": "uint256", "name": "endTime", "type": "uint256" }
|
||||||
|
],
|
||||||
|
"name": "AddRound",
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anonymous": false,
|
||||||
|
"inputs": [
|
||||||
|
{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" },
|
||||||
|
{ "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }
|
||||||
|
],
|
||||||
|
"name": "OwnershipTransferred",
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anonymous": false,
|
||||||
|
"inputs": [
|
||||||
|
{ "indexed": false, "internalType": "uint256", "name": "round", "type": "uint256" },
|
||||||
|
{ "indexed": false, "internalType": "uint256", "name": "total", "type": "uint256" },
|
||||||
|
{ "indexed": false, "internalType": "address", "name": "token", "type": "address" },
|
||||||
|
{ "indexed": false, "internalType": "uint256", "name": "price", "type": "uint256" },
|
||||||
|
{ "indexed": false, "internalType": "uint256", "name": "beginTime", "type": "uint256" },
|
||||||
|
{ "indexed": false, "internalType": "uint256", "name": "endTime", "type": "uint256" }
|
||||||
|
],
|
||||||
|
"name": "SetRound",
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "HCC",
|
||||||
|
"outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{ "internalType": "uint256", "name": "round", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "total", "type": "uint256" },
|
||||||
|
{ "internalType": "address", "name": "token", "type": "address" },
|
||||||
|
{ "internalType": "uint256", "name": "price", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "beginTime", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "endTime", "type": "uint256" }
|
||||||
|
],
|
||||||
|
"name": "addRound",
|
||||||
|
"outputs": [],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [{ "internalType": "uint256", "name": "round", "type": "uint256" }],
|
||||||
|
"name": "getRound",
|
||||||
|
"outputs": [
|
||||||
|
{ "internalType": "uint256", "name": "total", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "remaining", "type": "uint256" },
|
||||||
|
{ "internalType": "address", "name": "token", "type": "address" },
|
||||||
|
{ "internalType": "uint256", "name": "price", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "beginTime", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "endTime", "type": "uint256" }
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "owner",
|
||||||
|
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{ "internalType": "uint256", "name": "round", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
|
||||||
|
],
|
||||||
|
"name": "purchase",
|
||||||
|
"outputs": [],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||||
|
"name": "purchaseInfo",
|
||||||
|
"outputs": [
|
||||||
|
{ "internalType": "uint256", "name": "total", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "purchasedAmount", "type": "uint256" },
|
||||||
|
{ "internalType": "address", "name": "token", "type": "address" },
|
||||||
|
{ "internalType": "uint256", "name": "price", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "beginTime", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "endTime", "type": "uint256" }
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{ "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
|
||||||
|
{ "inputs": [], "name": "setPause", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{ "internalType": "uint256", "name": "round", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "total", "type": "uint256" },
|
||||||
|
{ "internalType": "address", "name": "token", "type": "address" },
|
||||||
|
{ "internalType": "uint256", "name": "price", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "beginTime", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "endTime", "type": "uint256" }
|
||||||
|
],
|
||||||
|
"name": "setRound",
|
||||||
|
"outputs": [],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
|
||||||
|
"name": "transferOwnership",
|
||||||
|
"outputs": [],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
@ -31,6 +31,10 @@ export default {
|
||||||
97: '0x86a510e82aceb27ed9e9880fb981d4b42ff16cb4',
|
97: '0x86a510e82aceb27ed9e9880fb981d4b42ff16cb4',
|
||||||
56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请或则军团长收益
|
56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请或则军团长收益
|
||||||
},
|
},
|
||||||
|
idoPurchase: {
|
||||||
|
97: '0x3d437b81f8080c11d0e7c6b8a6c8185d8b92afee',
|
||||||
|
56: '0x3d437b81f8080c11d0e7c6b8a6c8185d8b92afee', // NEED CHANGE IDO兑换
|
||||||
|
},
|
||||||
lotteryV2: {
|
lotteryV2: {
|
||||||
97: '0x5790c3534F30437641541a0FA04C992799602998',
|
97: '0x5790c3534F30437641541a0FA04C992799602998',
|
||||||
56: '0x5aF6D33DE2ccEC94efb1bDF8f92Bd58085432d2c',
|
56: '0x5aF6D33DE2ccEC94efb1bDF8f92Bd58085432d2c',
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import {
|
||||||
getReferralchefContract,
|
getReferralchefContract,
|
||||||
getBoardchefContract,
|
getBoardchefContract,
|
||||||
getReferralRewardchefContract,
|
getReferralRewardchefContract,
|
||||||
|
getIdoPurchaseContract,
|
||||||
} from 'utils/contractHelpers'
|
} from 'utils/contractHelpers'
|
||||||
|
|
||||||
// Imports below migrated from Exchange useContract.ts
|
// Imports below migrated from Exchange useContract.ts
|
||||||
|
|
@ -109,6 +110,10 @@ export const useReferralchef = () => {
|
||||||
const { library } = useActiveWeb3React()
|
const { library } = useActiveWeb3React()
|
||||||
return useMemo(() => getReferralchefContract(library.getSigner()), [library])
|
return useMemo(() => getReferralchefContract(library.getSigner()), [library])
|
||||||
}
|
}
|
||||||
|
export const useIdoPurchase = () => {
|
||||||
|
const { library } = useActiveWeb3React()
|
||||||
|
return useMemo(() => getIdoPurchaseContract(library.getSigner()), [library])
|
||||||
|
}
|
||||||
export const useReferralRewardchef = () => {
|
export const useReferralRewardchef = () => {
|
||||||
const { library } = useActiveWeb3React()
|
const { library } = useActiveWeb3React()
|
||||||
return useMemo(() => getReferralRewardchefContract(library.getSigner()), [library])
|
return useMemo(() => getReferralRewardchefContract(library.getSigner()), [library])
|
||||||
|
|
|
||||||
|
|
@ -74,3 +74,6 @@ export const getBunnySpecialCakeVaultAddress = () => {
|
||||||
export const getBunnySpecialPredictionAddress = () => {
|
export const getBunnySpecialPredictionAddress = () => {
|
||||||
return getAddress(addresses.bunnySpecialPrediction)
|
return getAddress(addresses.bunnySpecialPrediction)
|
||||||
}
|
}
|
||||||
|
export const getIdoPurchaseAddress = () => {
|
||||||
|
return getAddress(addresses.idoPurchase)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import {
|
||||||
getBoardAddress,
|
getBoardAddress,
|
||||||
getReferralAddress,
|
getReferralAddress,
|
||||||
getReferralRewardAddress,
|
getReferralRewardAddress,
|
||||||
|
getIdoPurchaseAddress,
|
||||||
} from 'utils/addressHelpers'
|
} from 'utils/addressHelpers'
|
||||||
|
|
||||||
// ABI
|
// ABI
|
||||||
|
|
@ -59,6 +60,7 @@ import chainlinkOracleAbi from 'config/abi/chainlinkOracle.json'
|
||||||
import MultiCallAbi from 'config/abi/Multicall.json'
|
import MultiCallAbi from 'config/abi/Multicall.json'
|
||||||
import bunnySpecialCakeVaultAbi from 'config/abi/bunnySpecialCakeVault.json'
|
import bunnySpecialCakeVaultAbi from 'config/abi/bunnySpecialCakeVault.json'
|
||||||
import bunnySpecialPredictionAbi from 'config/abi/bunnySpecialPrediction.json'
|
import bunnySpecialPredictionAbi from 'config/abi/bunnySpecialPrediction.json'
|
||||||
|
import idoPurchase from 'config/abi/purchase.json'
|
||||||
import { ChainLinkOracleContract, PredictionsContract } from './types'
|
import { ChainLinkOracleContract, PredictionsContract } from './types'
|
||||||
|
|
||||||
const getContract = (abi: any, address: string, signer?: ethers.Signer | ethers.providers.Provider) => {
|
const getContract = (abi: any, address: string, signer?: ethers.Signer | ethers.providers.Provider) => {
|
||||||
|
|
@ -156,3 +158,6 @@ export const getBunnySpecialCakeVaultContract = (signer?: ethers.Signer | ethers
|
||||||
export const getBunnySpecialPredictionContract = (signer?: ethers.Signer | ethers.providers.Provider) => {
|
export const getBunnySpecialPredictionContract = (signer?: ethers.Signer | ethers.providers.Provider) => {
|
||||||
return getContract(bunnySpecialPredictionAbi, getBunnySpecialPredictionAddress(), signer)
|
return getContract(bunnySpecialPredictionAbi, getBunnySpecialPredictionAddress(), signer)
|
||||||
}
|
}
|
||||||
|
export const getIdoPurchaseContract = (signer?: ethers.Signer | ethers.providers.Provider) => {
|
||||||
|
return getContract(idoPurchase, getIdoPurchaseAddress(), signer)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import React, { useMemo, useState, useEffect } from 'react'
|
||||||
import styled, { keyframes } from 'styled-components'
|
import styled, { keyframes } from 'styled-components'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
import { Flex, Text, Button } from '@pancakeswap/uikit'
|
import { Flex, Text, Button } from '@pancakeswap/uikit'
|
||||||
|
import { useIdoPurchase } from 'hooks/useContract'
|
||||||
|
|
||||||
import { useAccount } from 'state/userInfo/hooks'
|
import { useAccount } from 'state/userInfo/hooks'
|
||||||
import UnlockButton from 'components/UnlockButton'
|
import UnlockButton from 'components/UnlockButton'
|
||||||
|
|
@ -48,6 +49,12 @@ const ExchangeCard: React.FC = () => {
|
||||||
|
|
||||||
const account = useAccount()
|
const account = useAccount()
|
||||||
|
|
||||||
|
const useBuyTransaction = () => {
|
||||||
|
return useIdoPurchase()
|
||||||
|
}
|
||||||
|
console.log(useBuyTransaction())
|
||||||
|
// useEffect(() => {}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FCard>
|
<FCard>
|
||||||
<HeaderText>{t('IDO exchange in the first phase')}</HeaderText>
|
<HeaderText>{t('IDO exchange in the first phase')}</HeaderText>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue