Merge branch 'dev' into myf-dev
This commit is contained in:
commit
54c0498f8b
|
|
@ -1053,15 +1053,10 @@
|
||||||
"Community Auctions": "Community Auctions",
|
"Community Auctions": "Community Auctions",
|
||||||
"FAQs": "FAQs",
|
"FAQs": "FAQs",
|
||||||
"Auction duration": "Auction duration",
|
"Auction duration": "Auction duration",
|
||||||
"Terms & Conditions": "Terms & Conditions",
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"Hcc Info":"HighCityCoin",
|
|
||||||
"Hcc Nft":"其作用主要是在HighCitySwap上购买NFT、NFT盒子与其他可交易产品。",
|
|
||||||
"Hcc BTC":"同时,HCC与BTC、ETH具有相同属性,可以进行自由交易。",
|
|
||||||
"Bazaar":"NFT市场"
|
|
||||||
|
|
||||||
|
|
||||||
|
"Hcc Info": "HighCityCoin",
|
||||||
|
"Hcc Nft": "其作用主要是在HighCitySwap上购买NFT、NFT盒子与其他可交易产品。",
|
||||||
|
"Hcc BTC": "同时,HCC与BTC、ETH具有相同属性,可以进行自由交易。",
|
||||||
|
"Bazaar": "NFT市场",
|
||||||
|
"Insufficient Balance": "余额不足"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1055,70 +1055,69 @@
|
||||||
"Auction duration": "Auction duration",
|
"Auction duration": "Auction duration",
|
||||||
"Terms & Conditions": "Terms & Conditions",
|
"Terms & Conditions": "Terms & Conditions",
|
||||||
|
|
||||||
|
"Hcc Info": "HighCityCoin简称HCC,由HighCityTM铸造,",
|
||||||
|
"Hcc Nft": "其作用主要是在HighCitySwap上购买NFT、NFT盒子与其他可交易产品。",
|
||||||
"Hcc Info":"HighCityCoin简称HCC,由HighCityTM铸造,",
|
"Hcc BTC": "同时,HCC与BTC、ETH具有相同属性,可以进行自由交易。",
|
||||||
"Hcc Nft":"其作用主要是在HighCitySwap上购买NFT、NFT盒子与其他可交易产品。",
|
"Bazaar": "NFT市场",
|
||||||
"Hcc BTC":"同时,HCC与BTC、ETH具有相同属性,可以进行自由交易。",
|
"HlighCitySwapInfo": "HIighCitySwap的诞生,源于创始人Liu Bus对区块链技术的狂热追求,他始终相信区块链技术能够得到更广泛的应用。为此,他做了一个勇敢的决定,放弃在其他领域的投资,身心专注投入到区块链技术实践应用当中去,将自己所熟悉的领域——互联网社交,与区块链技术融合,HighCitySwap由此诞生。这就是我们的开始,感谢你们的支持,HighCity团队将永远前行。",
|
||||||
"Bazaar":"NFT市场",
|
"Stage one: Origin": "第一阶段:起源",
|
||||||
"HlighCitySwapInfo":"HIighCitySwap的诞生,源于创始人Liu Bus对区块链技术的狂热追求,他始终相信区块链技术能够得到更广泛的应用。为此,他做了一个勇敢的决定,放弃在其他领域的投资,身心专注投入到区块链技术实践应用当中去,将自己所熟悉的领域——互联网社交,与区块链技术融合,HighCitySwap由此诞生。这就是我们的开始,感谢你们的支持,HighCity团队将永远前行。",
|
"Stage two: Action": "第二阶段:行动",
|
||||||
"Stage one: Origin":"第一阶段:起源",
|
"Stage three: Creation": "第三阶段:创造",
|
||||||
"Stage two: Action":"第二阶段:行动",
|
"Stage four: Integration": "第四阶段:融合",
|
||||||
"Stage three: Creation":"第三阶段:创造",
|
"Stage five: Closing the curtain": "第五阶段:落幕",
|
||||||
"Stage four: Integration":"第四阶段:融合",
|
"The project concept was born in May 2021": "2021年5月项目概念的诞生;",
|
||||||
"Stage five: Closing the curtain":"第五阶段:落幕",
|
"Set up HighClty team in June 2021": "2021年6月搭建HighClty团队;",
|
||||||
"The project concept was born in May 2021":"2021年5月项目概念的诞生;",
|
"May 2021 -- January 2022 Team run-in": "2021年5月~2022年1月团队磨合;",
|
||||||
"Set up HighClty team in June 2021":"2021年6月搭建HighClty团队;",
|
"In April 2022, social networking and media release activities, HighCity coin started and dividend mechanism went online": "2022年4月社交建社,交媒体发布活动,HighCity铸币开始,分红机制上线;",
|
||||||
"May 2021 -- January 2022 Team run-in":"2021年5月~2022年1月团队磨合;",
|
"In March 2022, project approval, web design, roadmap announcement, smart contract development": "2022年3月项目立项,网页设计,路线图公布,智能合约开发;",
|
||||||
"In April 2022, social networking and media release activities, HighCity coin started and dividend mechanism went online":"2022年4月社交建社,交媒体发布活动,HighCity铸币开始,分红机制上线;",
|
"Launch of social software in December 2022": "2022年12月社交软件落地;",
|
||||||
"In March 2022, project approval, web design, roadmap announcement, smart contract development":"2022年3月项目立项,网页设计,路线图公布,智能合约开发;",
|
"Created by NFT in May 2022": "2022年5月NFT创造;",
|
||||||
"Launch of social software in December 2022":"2022年12月社交软件落地;",
|
"June 2022 social software development": "2022年6月社交软件开发;",
|
||||||
"Created by NFT in May 2022":"2022年5月NFT创造;",
|
"December 2022 NFT bonus binding social software": "2022年12月NFT分红绑定社交软件;",
|
||||||
"June 2022 social software development":"2022年6月社交软件开发;",
|
"In December 2022, HighCity Ecology was preliminarily completed": "2022年12月HighCity生态初步建成;",
|
||||||
"December 2022 NFT bonus binding social software":"2022年12月NFT分红绑定社交软件;",
|
"HighCity Ecology completed in December 2022": "2022年12月HighCity生态建成;",
|
||||||
"In December 2022, HighCity Ecology was preliminarily completed":"2022年12月HighCity生态初步建成;",
|
"Maintain dividend income growth in December 2022": "2022年12月保持分红收益增长;",
|
||||||
"HighCity Ecology completed in December 2022":"2022年12月HighCity生态建成;",
|
"Buy commander NFT": "购买军团长NFT",
|
||||||
"Maintain dividend income growth in December 2022":"2022年12月保持分红收益增长;",
|
"Upgrade recommendation rights, can enjoy the share of secondary recommendation": "升级推荐权益,可享有二级推荐的分成",
|
||||||
"Buy commander NFT":"购买军团长NFT",
|
"Enjoy a higher percentage than ordinary users": "享有比普通用户更高的分成比例",
|
||||||
"Upgrade recommendation rights, can enjoy the share of secondary recommendation":"升级推荐权益,可享有二级推荐的分成",
|
"Commander NFT can be traded in the NFT market": "军团长NFT可在NFT市场内进行交易",
|
||||||
"Enjoy a higher percentage than ordinary users":"享有比普通用户更高的分成比例",
|
"First stage sharing ratio": "一级分成比例",
|
||||||
"Commander NFT can be traded in the NFT market":"军团长NFT可在NFT市场内进行交易",
|
"Secondary split ratio": "二级分成比例",
|
||||||
"First stage sharing ratio":"一级分成比例",
|
"Buy It Now": "立即购买",
|
||||||
"Secondary split ratio":"二级分成比例",
|
"recommend": "推荐",
|
||||||
"Buy It Now":"立即购买",
|
"The lower the number of": "下级数量",
|
||||||
"recommend":"推荐",
|
"NFT total revenue": "NFT总收益",
|
||||||
"The lower the number of":"下级数量",
|
"HCC total revenue": "HCC总收益",
|
||||||
"NFT total revenue":"NFT总收益",
|
"To get profit": "待领收益",
|
||||||
"HCC total revenue":"HCC总收益",
|
"No income is received temporarily": "暂无收益领取",
|
||||||
"To get profit":"待领收益",
|
"Upgrade commander": "升级军团长",
|
||||||
"No income is received temporarily":"暂无收益领取",
|
"Regimental recommendation": "军团长推荐",
|
||||||
"Upgrade commander":"升级军团长",
|
"Number of secondary subordinates": "二级下级人数",
|
||||||
"Regimental recommendation":"军团长推荐",
|
"Number of first-level subordinates": "一级下级人数",
|
||||||
"Number of secondary subordinates":"二级下级人数",
|
"Immediately to receive": "立即领取",
|
||||||
"Number of first-level subordinates":"一级下级人数",
|
"buy again": "再次购买",
|
||||||
"Immediately to receive":"立即领取",
|
"Connect the purse": "连接钱包",
|
||||||
"buy again":"再次购买",
|
"HCC total revenue percentage :10%": "HCC总收益(分成比例:10%)",
|
||||||
"Connect the purse":"连接钱包",
|
"Contract address": "合约地址",
|
||||||
"HCC total revenue percentage :10%":"HCC总收益(分成比例:10%)",
|
"Assets agreement": "资产协议",
|
||||||
"Contract address":"合约地址",
|
"Assets and chain": "资产公链",
|
||||||
"Assets agreement":"资产协议",
|
"each time": "1.当倒计时少于1小时时,每次加价增加倒计时时间1小时",
|
||||||
"Assets and chain":"资产公链",
|
"last bid": "2.拍卖每次固定加价10%,倒计时结束后,拍卖品由最后出价的出价人获得",
|
||||||
"each time":"1.当倒计时少于1小时时,每次加价增加倒计时时间1小时",
|
"commission fee": "3.拍卖成功后,平台将收取发布人收益的6%作为手续费",
|
||||||
"last bid":"2.拍卖每次固定加价10%,倒计时结束后,拍卖品由最后出价的出价人获得",
|
"announcement": "公告",
|
||||||
"commission fee":"3.拍卖成功后,平台将收取发布人收益的6%作为手续费",
|
"return": "返回",
|
||||||
"announcement":"公告",
|
"Total capital pool": "资金池总额",
|
||||||
"return":"返回",
|
"The total amount of dividends": "分红总额",
|
||||||
"Total capital pool":"资金池总额",
|
"Pending dividend": "待领取分红",
|
||||||
"The total amount of dividends":"分红总额",
|
"Number of boards": "董事会数量",
|
||||||
"Pending dividend":"待领取分红",
|
"Number of holders": "持有人数量",
|
||||||
"Number of boards":"董事会数量",
|
"total revenue": "总收益",
|
||||||
"Number of holders":"持有人数量",
|
"revenue": "收益",
|
||||||
"total revenue":"总收益",
|
"purchase": "购买",
|
||||||
"revenue":"收益",
|
"Enter a keyword search": "输入关键字搜索",
|
||||||
"purchase":"购买",
|
"By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins": "使用页面右上方的邀请,可邀请新用户进入,并在用户购买币后获得",
|
||||||
"Enter a keyword search":"输入关键字搜索",
|
"The commission": "的提成!",
|
||||||
"By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins":"使用页面右上方的邀请,可邀请新用户进入,并在用户购买币后获得",
|
"market value": "市值",
|
||||||
"The commission":"的提成!",
|
"Loaded all": "已加载全部",
|
||||||
"market value":"市值",
|
"Insufficient Balance": "余额不足"
|
||||||
"Loaded all":"已加载全部"
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { usePollCoreFarmData, useFetchProfile, usePollBlockNumber } from 'state/
|
||||||
import { DatePickerPortal } from 'components/DatePicker'
|
import { DatePickerPortal } from 'components/DatePicker'
|
||||||
import { initAxios } from 'utils/request'
|
import { initAxios } from 'utils/request'
|
||||||
import useToast from 'hooks/useToast'
|
import useToast from 'hooks/useToast'
|
||||||
import { fetchUserInfo } from 'state/actions'
|
import { fetchUserInfo, clearUserInfo } from 'state/actions'
|
||||||
import { useAccount } from 'state/userInfo/hooks'
|
import { useAccount } from 'state/userInfo/hooks'
|
||||||
import GlobalStyle from './style/Global'
|
import GlobalStyle from './style/Global'
|
||||||
import Menu from './components/Menu'
|
import Menu from './components/Menu'
|
||||||
|
|
@ -70,7 +70,9 @@ const App: React.FC = () => {
|
||||||
const account = useAccount()
|
const account = useAccount()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initAxios(dispatch, toast)
|
initAxios(() => {
|
||||||
|
dispatch(clearUserInfo)
|
||||||
|
}, toast)
|
||||||
}, [])
|
}, [])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
account && dispatch(fetchUserInfo())
|
account && dispatch(fetchUserInfo())
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@
|
||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "internalType": "address", "name": "_hccAddress", "type": "address" },
|
{ "internalType": "address", "name": "_hccAddress", "type": "address" },
|
||||||
{ "internalType": "address", "name": "_otherPaymentAddress", "type": "address" },
|
{ "internalType": "address", "name": "_otherPaymentAddress", "type": "address" }
|
||||||
{ "internalType": "uint256", "name": "_hccPirce", "type": "uint256" },
|
|
||||||
{ "internalType": "uint256", "name": "_otherPaymentPirce", "type": "uint256" }
|
|
||||||
],
|
],
|
||||||
"stateMutability": "nonpayable",
|
"stateMutability": "nonpayable",
|
||||||
"type": "constructor"
|
"type": "constructor"
|
||||||
|
|
@ -159,13 +157,6 @@
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"inputs": [],
|
|
||||||
"name": "hccPirce",
|
|
||||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
||||||
"stateMutability": "view",
|
|
||||||
"type": "function"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "internalType": "address", "name": "owner", "type": "address" },
|
{ "internalType": "address", "name": "owner", "type": "address" },
|
||||||
|
|
@ -176,7 +167,20 @@
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{ "inputs": [], "name": "mint", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
|
{
|
||||||
|
"inputs": [
|
||||||
|
{ "internalType": "address", "name": "to", "type": "address" },
|
||||||
|
{ "internalType": "uint256", "name": "hccPirce", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "otherPaymentPirce", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "_timestamp", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "code", "type": "uint256" },
|
||||||
|
{ "internalType": "bytes", "name": "_signature", "type": "bytes" }
|
||||||
|
],
|
||||||
|
"name": "mint",
|
||||||
|
"outputs": [],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "name",
|
"name": "name",
|
||||||
|
|
@ -191,13 +195,6 @@
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"inputs": [],
|
|
||||||
"name": "otherPaymentPirce",
|
|
||||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
||||||
"stateMutability": "view",
|
|
||||||
"type": "function"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "owner",
|
"name": "owner",
|
||||||
|
|
@ -274,13 +271,6 @@
|
||||||
"stateMutability": "nonpayable",
|
"stateMutability": "nonpayable",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"inputs": [{ "internalType": "uint256", "name": "newHccPirce", "type": "uint256" }],
|
|
||||||
"name": "setHccPirce",
|
|
||||||
"outputs": [],
|
|
||||||
"stateMutability": "nonpayable",
|
|
||||||
"type": "function"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"inputs": [{ "internalType": "address", "name": "newOtherPaymentAddress", "type": "address" }],
|
"inputs": [{ "internalType": "address", "name": "newOtherPaymentAddress", "type": "address" }],
|
||||||
"name": "setOtherPaymentAddress",
|
"name": "setOtherPaymentAddress",
|
||||||
|
|
@ -288,13 +278,6 @@
|
||||||
"stateMutability": "nonpayable",
|
"stateMutability": "nonpayable",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"inputs": [{ "internalType": "uint256", "name": "newOtherPaymentPirce", "type": "uint256" }],
|
|
||||||
"name": "setOtherPaymentPirce",
|
|
||||||
"outputs": [],
|
|
||||||
"stateMutability": "nonpayable",
|
|
||||||
"type": "function"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"inputs": [{ "internalType": "bool", "name": "_pause", "type": "bool" }],
|
"inputs": [{ "internalType": "bool", "name": "_pause", "type": "bool" }],
|
||||||
"name": "setPause",
|
"name": "setPause",
|
||||||
|
|
@ -302,6 +285,20 @@
|
||||||
"stateMutability": "nonpayable",
|
"stateMutability": "nonpayable",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{ "internalType": "address", "name": "to", "type": "address" },
|
||||||
|
{ "internalType": "uint256", "name": "hccPirce", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "otherPaymentPirce", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "_timestamp", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "code", "type": "uint256" },
|
||||||
|
{ "internalType": "bytes", "name": "_signature", "type": "bytes" }
|
||||||
|
],
|
||||||
|
"name": "signatureMint",
|
||||||
|
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||||
|
"stateMutability": "pure",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "internalType": "address", "name": "wallet", "type": "address" },
|
{ "internalType": "address", "name": "wallet", "type": "address" },
|
||||||
|
|
|
||||||
|
|
@ -8,19 +8,19 @@ export default {
|
||||||
56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95',
|
56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95',
|
||||||
},
|
},
|
||||||
boardChef: {
|
boardChef: {
|
||||||
97: '0xfe73bcc71c1e8f41f29c07ee921777ff8232eba7',
|
97: '0x7e64aac0806597cb2efddf7c001e59d6b4e9cb15',
|
||||||
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约
|
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约
|
||||||
},
|
},
|
||||||
holderChef: {
|
holderChef: {
|
||||||
97: '0xc49ef97410f495164604be0de2baae908913c4cc',
|
97: '0x4cbbb9e9569a208c9975574675ba24eccea342b3',
|
||||||
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 持币人
|
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 持币人
|
||||||
},
|
},
|
||||||
referralChef: {
|
referralChef: {
|
||||||
97: '0x2f2aec0ee0da9f81e28e78a072cfbea6f35b1e06',
|
97: '0x86a510e82aceb27ed9e9880fb981d4b42ff16cb4',
|
||||||
56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请或则军团长
|
56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请或则军团长
|
||||||
},
|
},
|
||||||
referralRewardChef: {
|
referralRewardChef: {
|
||||||
97: '0xe031cf7053ea3b7605bb289efe2307356f6ace6d',
|
97: '0x86a510e82aceb27ed9e9880fb981d4b42ff16cb4',
|
||||||
56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请或则军团长收益
|
56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请或则军团长收益
|
||||||
},
|
},
|
||||||
lotteryV2: {
|
lotteryV2: {
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ const tokens = {
|
||||||
symbol: 'HCC',
|
symbol: 'HCC',
|
||||||
address: {
|
address: {
|
||||||
56: '0x20de22029ab63cf9A7Cf5fEB2b737Ca1eE4c82A6',
|
56: '0x20de22029ab63cf9A7Cf5fEB2b737Ca1eE4c82A6',
|
||||||
97: '0xbdd6c43fb8e97a73e464fca5ab6f3d2f402be20c',
|
97: '0x77f2efa78c1c2798ad3c753330aa4e1babcaeff8',
|
||||||
},
|
},
|
||||||
decimals: 18,
|
decimals: 18,
|
||||||
projectLink: 'https://tranchess.com/',
|
projectLink: 'https://tranchess.com/',
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,39 @@
|
||||||
import request from 'utils/request'
|
import request from 'utils/request'
|
||||||
|
|
||||||
export const getReferralInfo = () => {
|
export const getReferralRewardInfo = () => {
|
||||||
return request.request({
|
return request.request({
|
||||||
url: '/high_city/app/api/invite/reward',
|
url: '/high_city/app/api/invite/reward',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const withdrawReward = () => {
|
export const getReferralConfigInfo = () => {
|
||||||
|
return request.request({
|
||||||
|
url: '/high_city/app/api/invite/config',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getBuyReferralParams = () => {
|
||||||
|
return request.request({
|
||||||
|
url: '/high_city/app/api/invite/commander/purchase',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getWithdrawRewardParams = () => {
|
||||||
return request.request({
|
return request.request({
|
||||||
url: '/high_city/app/api/invite/reward/receive',
|
url: '/high_city/app/api/invite/reward/receive',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export const checkBuyResult = (params) => {
|
||||||
|
return request.request({
|
||||||
|
url: '/high_city/app/api/invite/commander/tx',
|
||||||
|
method: 'post',
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export const inviteReceive = () => {
|
export const inviteReceive = () => {
|
||||||
return request.request({
|
return request.request({
|
||||||
|
|
@ -21,4 +42,4 @@ export const inviteReceive = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getReferralInfo
|
export default getReferralRewardInfo
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ import { getAddress, getBoardAddress } from 'utils/addressHelpers'
|
||||||
export const fetchBoardUserAllowances = async (account: string) => {
|
export const fetchBoardUserAllowances = async (account: string) => {
|
||||||
const calls = boardsConfig.map((board) => {
|
const calls = boardsConfig.map((board) => {
|
||||||
const tokenAddresses = getAddress(board.tokenAddresses)
|
const tokenAddresses = getAddress(board.tokenAddresses)
|
||||||
const boardChefAdress = getAddress(board.contractAddress)
|
const boardChefAddress = getAddress(board.contractAddress)
|
||||||
return { address: tokenAddresses, name: 'allowance', params: [account, boardChefAdress] }
|
return { address: tokenAddresses, name: 'allowance', params: [account, boardChefAddress] }
|
||||||
})
|
})
|
||||||
|
|
||||||
const rawLpAllowances = await multicall(erc20ABI, calls)
|
const rawLpAllowances = await multicall(erc20ABI, calls)
|
||||||
|
|
@ -53,7 +53,6 @@ export const fetchBoardUserInfo = async (account: string) => {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
const [userInfo, estimatedProfit] = await multicall(board.abi, calls)
|
const [userInfo, estimatedProfit] = await multicall(board.abi, calls)
|
||||||
console.log(estimatedProfit)
|
|
||||||
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,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { createSlice } from '@reduxjs/toolkit'
|
import { createSlice } from '@reduxjs/toolkit'
|
||||||
import { getReferralInfo } from 'services/referral'
|
import { getReferralRewardInfo, getReferralConfigInfo } from 'services/referral'
|
||||||
import { ReferralInfo, ReferralConfigType } from 'types/referral'
|
import { ReferralInfo, ReferralConfigType, ReferralConfigInfo } from 'types/referral'
|
||||||
|
import BigNumber from 'bignumber.js'
|
||||||
|
import erc20ABI from 'config/abi/erc20.json'
|
||||||
|
import multicall from 'utils/multicall'
|
||||||
|
import tokens from 'config/constants/tokens'
|
||||||
|
import { getAddress, getReferralAddress } from 'utils/addressHelpers'
|
||||||
import { ReferralState } from '../types'
|
import { ReferralState } from '../types'
|
||||||
|
|
||||||
const initialState: ReferralState = {
|
const initialState: ReferralState = {
|
||||||
|
|
@ -9,6 +14,10 @@ const initialState: ReferralState = {
|
||||||
isCommander: false,
|
isCommander: false,
|
||||||
rewardInfo: {},
|
rewardInfo: {},
|
||||||
}
|
}
|
||||||
|
const payWayList = {
|
||||||
|
usdt: tokens.usdt,
|
||||||
|
hcc: tokens.hcc,
|
||||||
|
}
|
||||||
export const referralSlice = createSlice({
|
export const referralSlice = createSlice({
|
||||||
name: 'Referral',
|
name: 'Referral',
|
||||||
initialState,
|
initialState,
|
||||||
|
|
@ -30,15 +39,33 @@ export const fetchReferralInfoAsync = (account) => async (dispatch) => {
|
||||||
dispatch(setReferralInfo({}))
|
dispatch(setReferralInfo({}))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const data: ReferralInfo = await getReferralInfo()
|
const data: ReferralInfo = await getReferralRewardInfo()
|
||||||
|
const configInfo: ReferralConfigInfo[] = await getReferralConfigInfo()
|
||||||
dispatch(
|
dispatch(
|
||||||
setReferralInfo({
|
setReferralInfo({
|
||||||
commanderConfigInfo: data.inviteConfigList?.find((item) => item.type === ReferralConfigType.COMMANDER),
|
commanderConfigInfo: configInfo?.find((item) => item.type === ReferralConfigType.COMMANDER),
|
||||||
normalConfigInfo: data.inviteConfigList?.find((item) => item.type === ReferralConfigType.NORMAL),
|
normalConfigInfo: configInfo?.find((item) => item.type === ReferralConfigType.NORMAL),
|
||||||
isCommander: data.isCommander,
|
isCommander: data.isCommander,
|
||||||
rewardInfo: data.reward,
|
rewardInfo: data.reward || {},
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const fetchReferralUserAllowances = async (account: string) => {
|
||||||
|
const calls = Object.values(payWayList).map((payWayItem) => {
|
||||||
|
const tokenAddresses = getAddress(payWayItem.address)
|
||||||
|
const referralChefAddress = getReferralAddress()
|
||||||
|
return { address: tokenAddresses, name: 'allowance', params: [account, referralChefAddress] }
|
||||||
|
})
|
||||||
|
|
||||||
|
const rawLpAllowances = await multicall(erc20ABI, calls)
|
||||||
|
const parsedLpAllowances = rawLpAllowances.map((balance) => {
|
||||||
|
return new BigNumber(balance).toNumber()
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
usdt: parsedLpAllowances[0],
|
||||||
|
hcc: parsedLpAllowances[1],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default referralSlice.reducer
|
export default referralSlice.reducer
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import { Dispatch } from 'react'
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
// import { clearUserInfo } from 'state/actions'
|
|
||||||
import { CACHE_TOKEN } from 'config/constants/cacheKey'
|
import { CACHE_TOKEN } from 'config/constants/cacheKey'
|
||||||
|
|
||||||
// create an axios instance
|
// create an axios instance
|
||||||
|
|
@ -9,7 +7,7 @@ const request = axios.create({
|
||||||
timeout: 50000, // request timeout
|
timeout: 50000, // request timeout
|
||||||
})
|
})
|
||||||
let hasInit = false
|
let hasInit = false
|
||||||
export const initAxios = (dispatch: Dispatch<any>, toast) => {
|
export const initAxios = (clearUserInfo, toast) => {
|
||||||
if (hasInit) return
|
if (hasInit) return
|
||||||
hasInit = true
|
hasInit = true
|
||||||
request.interceptors.request.use(
|
request.interceptors.request.use(
|
||||||
|
|
@ -28,7 +26,7 @@ export const initAxios = (dispatch: Dispatch<any>, toast) => {
|
||||||
const res: any = response.data
|
const res: any = response.data
|
||||||
if (res.code !== 200) {
|
if (res.code !== 200) {
|
||||||
if (res.code === 401) {
|
if (res.code === 401) {
|
||||||
// dispatch(clearUserInfo())
|
clearUserInfo()
|
||||||
toast.toastError('Login expiration')
|
toast.toastError('Login expiration')
|
||||||
return Promise.reject(new Error('Login expiration'))
|
return Promise.reject(new Error('Login expiration'))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
import React, { useState, useEffect } from 'react'
|
||||||
|
import { Flex, Button, Modal, Image } from '@pancakeswap/uikit'
|
||||||
|
import styled from 'styled-components'
|
||||||
|
import { useTranslation } from 'contexts/Localization'
|
||||||
|
import { useAccount } from 'state/userInfo/hooks'
|
||||||
|
import { fetchReferralUserAllowances } from 'state/referral'
|
||||||
|
import { useERC20 } from 'hooks/useContract'
|
||||||
|
import { getAddress } from 'utils/addressHelpers'
|
||||||
|
import useToast from 'hooks/useToast'
|
||||||
|
import { checkBuyResult } from 'services/referral'
|
||||||
|
import useRefresh from 'hooks/useRefresh'
|
||||||
|
import tokens from 'config/constants/tokens'
|
||||||
|
import { useCheckTokenBalance, useApproveReferral, useBuyTransaction } from '../hooks'
|
||||||
|
|
||||||
|
// interface BuyActionsProps {
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
const Btn = styled(Button)`
|
||||||
|
width: 50%;
|
||||||
|
margin: 20px auto 0px auto;
|
||||||
|
border-radius: 50px;
|
||||||
|
background: linear-gradient(180deg, #7be0fc 0%, #ac7bf1 100%);
|
||||||
|
border: none;
|
||||||
|
`
|
||||||
|
const BuyActions: React.FC = () => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
const account = useAccount()
|
||||||
|
const [allowanceList, setAllowanceList] = useState({ usdt: 0, hcc: 0 })
|
||||||
|
const usdtContract = useERC20(getAddress(tokens.usdt.address))
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
const [txId, setTxId] = useState()
|
||||||
|
const { toastSuccess } = useToast()
|
||||||
|
const { fastRefresh } = useRefresh()
|
||||||
|
const hccContract = useERC20(getAddress(tokens.hcc.address))
|
||||||
|
const { onApprove: onUsdtApprove } = useApproveReferral(usdtContract)
|
||||||
|
const { onApprove: onHccApprove } = useApproveReferral(hccContract)
|
||||||
|
const buyTransaction = useBuyTransaction()
|
||||||
|
const handleApprove = async (approve) => {
|
||||||
|
try {
|
||||||
|
setLoading(true)
|
||||||
|
await approve()
|
||||||
|
setLoading(false)
|
||||||
|
getAllowances()
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const getAllowances = async () => {
|
||||||
|
const allowances = await fetchReferralUserAllowances(account)
|
||||||
|
setAllowanceList({
|
||||||
|
usdt: allowances.usdt,
|
||||||
|
hcc: allowances.hcc,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const handleBuy = async () => {
|
||||||
|
await buyTransaction()
|
||||||
|
}
|
||||||
|
const getTransactionResult = async () => {
|
||||||
|
const res = await checkBuyResult({ tx: txId })
|
||||||
|
if (res?.success) {
|
||||||
|
setLoading(false)
|
||||||
|
setTxId(undefined)
|
||||||
|
toastSuccess('Buy Success')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (txId && loading) {
|
||||||
|
getTransactionResult()
|
||||||
|
}
|
||||||
|
}, [fastRefresh])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (account) {
|
||||||
|
getAllowances()
|
||||||
|
} else {
|
||||||
|
setAllowanceList({ usdt: 0, hcc: 0 })
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Flex>
|
||||||
|
{!allowanceList.usdt && (
|
||||||
|
<Btn
|
||||||
|
disabled={loading}
|
||||||
|
onClick={() => {
|
||||||
|
handleApprove(onUsdtApprove)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t('Approve %coin% Contract', { coin: 'usdt' })}
|
||||||
|
</Btn>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!allowanceList.hcc && (
|
||||||
|
<Btn
|
||||||
|
disabled={loading}
|
||||||
|
onClick={() => {
|
||||||
|
handleApprove(onHccApprove)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t('Approve %coin% Contract', { coin: 'hcc' })}
|
||||||
|
</Btn>
|
||||||
|
)}
|
||||||
|
{allowanceList?.usdt && allowanceList.hcc ? <Btn onClick={handleBuy}>{t('Buy It Now')}</Btn> : null}
|
||||||
|
</Flex>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BuyActions
|
||||||
|
|
@ -3,6 +3,7 @@ import styled from 'styled-components'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
import { useReferralNormalConfigInfo, useReferralCommanderConfigInfo } from 'state/referral/hooks'
|
import { useReferralNormalConfigInfo, useReferralCommanderConfigInfo } from 'state/referral/hooks'
|
||||||
import { Flex, Button, Modal, Image } from '@pancakeswap/uikit'
|
import { Flex, Button, Modal, Image } from '@pancakeswap/uikit'
|
||||||
|
import BuyActions from './BuyActions'
|
||||||
import TextFlex from './TextFlex'
|
import TextFlex from './TextFlex'
|
||||||
import FlexCom from './FlexCom'
|
import FlexCom from './FlexCom'
|
||||||
|
|
||||||
|
|
@ -27,13 +28,7 @@ const InfoDiv = styled.div`
|
||||||
margin-left: 60px;
|
margin-left: 60px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
const UpBtn = styled(Button)`
|
|
||||||
width: 50%;
|
|
||||||
margin: 20px auto 0px auto;
|
|
||||||
border-radius: 50px;
|
|
||||||
background: linear-gradient(180deg, #7be0fc 0%, #ac7bf1 100%);
|
|
||||||
border: none;
|
|
||||||
`
|
|
||||||
const ImageDiv = styled(Image)`
|
const ImageDiv = styled(Image)`
|
||||||
width: 300px;
|
width: 300px;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
|
|
@ -77,10 +72,10 @@ const BuyNftModal: React.FC = () => {
|
||||||
<FlexCom name={t('Assets and chain')} value={t('Assets and chain')} />
|
<FlexCom name={t('Assets and chain')} value={t('Assets and chain')} />
|
||||||
</InfoDiv>
|
</InfoDiv>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
<BuyActions />
|
||||||
<Flex>
|
{/* <Flex>
|
||||||
<UpBtn>{t('Buy It Now')}</UpBtn>
|
<UpBtn>{t('Buy It Now')}</UpBtn>
|
||||||
</Flex>
|
</Flex> */}
|
||||||
</ModalDiv>
|
</ModalDiv>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,9 +55,7 @@ const ConnectedCom: React.FC = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [onBuyModal] = useModal(<BuyNftModal />)
|
const [onBuyModal] = useModal(<BuyNftModal />)
|
||||||
const referralNormalConfigInfo = useReferralNormalConfigInfo()
|
const referralNormalConfigInfo = useReferralNormalConfigInfo()
|
||||||
console.log('referralNormalConfigInfo:', referralNormalConfigInfo)
|
|
||||||
const referralRewardInfo = useReferralRewardInfo()
|
const referralRewardInfo = useReferralRewardInfo()
|
||||||
console.log('referralRewardInfo:', referralRewardInfo)
|
|
||||||
const referralCommanderConfigInfo = useReferralCommanderConfigInfo()
|
const referralCommanderConfigInfo = useReferralCommanderConfigInfo()
|
||||||
const getInviteReceive = async () => {
|
const getInviteReceive = async () => {
|
||||||
await inviteReceive()
|
await inviteReceive()
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,41 @@
|
||||||
import { useState, useCallback } from 'react'
|
import { useState, useCallback } from 'react'
|
||||||
import { useReferralchef, useReferralRewardchef } from 'hooks/useContract'
|
import { useReferralchef, useReferralRewardchef } from 'hooks/useContract'
|
||||||
import useTokenBalance, { useGetBnbBalance } from 'hooks/useTokenBalance'
|
import useTokenBalance from 'hooks/useTokenBalance'
|
||||||
import { getAddress } from 'utils/addressHelpers'
|
import { getAddress, getReferralAddress } from 'utils/addressHelpers'
|
||||||
import tokensList from 'config/constants/tokens'
|
import tokensList from 'config/constants/tokens'
|
||||||
import useToast from 'hooks/useToast'
|
import useToast from 'hooks/useToast'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
|
import { ethers, Contract } from 'ethers'
|
||||||
import { getBalanceNumber, getDecimalAmountNumber } from 'utils/formatBalance'
|
import { getBalanceNumber, getDecimalAmountNumber } from 'utils/formatBalance'
|
||||||
import { withdrawReward } from 'services/referral'
|
import { getWithdrawRewardParams, getBuyReferralParams } from 'services/referral'
|
||||||
|
|
||||||
const useCheckTokenBalance = ({ isBnb, isHcc, isUsdt }) => {
|
export const useCheckTokenBalance = ({ isBnb, isHcc, isUsdt }) => {
|
||||||
const { balance: bnbTokenBalance } = useGetBnbBalance()
|
|
||||||
const { balance: usdtTokenBalance } = useTokenBalance(getAddress(tokensList.usdt.address))
|
const { balance: usdtTokenBalance } = useTokenBalance(getAddress(tokensList.usdt.address))
|
||||||
const { balance: hccTokenBalance } = useTokenBalance(getAddress(tokensList.hcc.address))
|
const { balance: hccTokenBalance } = useTokenBalance(getAddress(tokensList.hcc.address))
|
||||||
const { toastWarning } = useToast()
|
const { toastWarning } = useToast()
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const onCheck = useCallback(() => {
|
const onCheck = useCallback(
|
||||||
if (
|
(hccAmount, usdtAmount) => {
|
||||||
(isBnb && getBalanceNumber(bnbTokenBalance) === 0) ||
|
if (
|
||||||
(isHcc && getBalanceNumber(hccTokenBalance) === 0) ||
|
(isHcc && getBalanceNumber(hccTokenBalance) === hccAmount) ||
|
||||||
(isUsdt && getBalanceNumber(usdtTokenBalance) === 0)
|
(isUsdt && getBalanceNumber(usdtTokenBalance) === usdtAmount)
|
||||||
) {
|
) {
|
||||||
toastWarning(t('Insufficient Balance'))
|
toastWarning(t('Insufficient Balance'))
|
||||||
}
|
}
|
||||||
}, [isBnb, isHcc, isUsdt])
|
},
|
||||||
|
[isBnb, isHcc, isUsdt],
|
||||||
|
)
|
||||||
return [onCheck]
|
return [onCheck]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useBuyTransaction = () => {
|
export const useBuyTransaction = () => {
|
||||||
const referralContract = useReferralchef()
|
const referralContract = useReferralchef()
|
||||||
const transaction = async () => {
|
const transaction = async () => {
|
||||||
const data = await withdrawReward()
|
const data = await getBuyReferralParams()
|
||||||
const { to, amount, code, signature } = data
|
const { address, hccPrice, otherPaymentPirce, code, timestamp, sign } = data
|
||||||
console.log(data)
|
const params = [address, hccPrice, otherPaymentPirce, code, timestamp, sign]
|
||||||
const params = [to, amount, code, signature]
|
// const price = getDecimalAmountNumber(receive)
|
||||||
const price = getDecimalAmountNumber(amount)
|
const res = await referralContract.mint(...params)
|
||||||
const res = await referralContract.adminMint(...params, { value: price })
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
return transaction
|
return transaction
|
||||||
|
|
@ -43,15 +44,28 @@ export const useBuyTransaction = () => {
|
||||||
export const useWithdraw = () => {
|
export const useWithdraw = () => {
|
||||||
const referralRewardContract = useReferralRewardchef()
|
const referralRewardContract = useReferralRewardchef()
|
||||||
const transaction = async () => {
|
const transaction = async () => {
|
||||||
const data = await withdrawReward()
|
const data = await getWithdrawRewardParams()
|
||||||
const { to, amount, expiredTime, signature } = data
|
const { address, receive, timestamp, sign } = data
|
||||||
console.log(data)
|
const params = [address, receive, timestamp, sign]
|
||||||
const params = [to, amount, expiredTime, signature]
|
const price = getDecimalAmountNumber(receive)
|
||||||
const price = getDecimalAmountNumber(amount)
|
|
||||||
const res = await referralRewardContract.withDrawReward(...params, { value: price })
|
const res = await referralRewardContract.withDrawReward(...params, { value: price })
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
return transaction
|
return transaction
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const useApproveReferral = (tokenContract: Contract) => {
|
||||||
|
const handleApprove = useCallback(async () => {
|
||||||
|
try {
|
||||||
|
const tx = await tokenContract.approve(getReferralAddress(), ethers.constants.MaxUint256)
|
||||||
|
const receipt = await tx.wait()
|
||||||
|
return receipt.status
|
||||||
|
} catch (e) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}, [tokenContract])
|
||||||
|
|
||||||
|
return { onApprove: handleApprove }
|
||||||
|
}
|
||||||
|
|
||||||
export default useCheckTokenBalance
|
export default useCheckTokenBalance
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue