feat: 军团长

This commit is contained in:
gary 2022-04-24 14:48:09 +08:00
parent 0449882249
commit a302304845
16 changed files with 526 additions and 258 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -12,7 +12,7 @@
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!-- Meta -->
<title>PancakeSwap</title>
<title>HighCity Swap</title>
<meta
name="description"
content="Cheaper and faster than Uniswap? Discover PancakeSwap, the leading DEX on Binance Smart Chain (BSC) with the best farms in DeFi and a lottery for CAKE."
@ -27,7 +27,7 @@
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="🥞 PancakeSwap - A next evolution DeFi exchange on Binance Smart Chain (BSC)" />
<!-- GTAG -->
<script>
<!-- <script>
;(function (w, d, s, l, i) {
w[l] = w[l] || []
w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' })
@ -38,18 +38,18 @@
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl
f.parentNode.insertBefore(j, f)
})(window, document, 'script', 'dataLayer', '%REACT_APP_GTAG%')
</script>
</script> -->
</head>
<body>
<!-- GTAG (noscript) -->
<noscript>
<!-- <noscript>
<iframe
src="https://www.googletagmanager.com/ns.html?id=%REACT_APP_GTAG%"
height="0"
width="0"
style="display: none; visibility: hidden"
></iframe>
</noscript>
</noscript> -->
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<div id="portal-root"></div>

View File

@ -1,6 +1,6 @@
{
"short_name": "PancakeSwap",
"name": "PancakeSwap",
"short_name": "HighCitySwap",
"name": "HighCitySwap",
"description": "Farm CAKE with Pancake LP Tokens",
"homepage_url": "https://pancakeswap.finance",
"start_url": ".",

View File

@ -1,322 +1,403 @@
[
{
"inputs": [
{ "internalType": "address", "name": "_hccAddress", "type": "address" },
{ "internalType": "address", "name": "_otherPaymentAddress", "type": "address" },
{ "internalType": "uint256", "name": "_hccPirce", "type": "uint256" },
{ "internalType": "uint256", "name": "_otherPaymentPirce", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
{ "indexed": true, "internalType": "address", "name": "owner", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "approved", "type": "address" },
{ "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }
],
"name": "InviteReward",
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
{ "indexed": true, "internalType": "address", "name": "owner", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "operator", "type": "address" },
{ "indexed": false, "internalType": "bool", "name": "approved", "type": "bool" }
],
"name": "ApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "owner", "type": "address" },
{ "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" },
{ "indexed": true, "internalType": "uint256", "name": "code", "type": "uint256" }
],
"name": "CreateNft",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": false, "internalType": "address", "name": "newHccAddress", "type": "address" }],
"name": "HccAddressChange",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": false, "internalType": "uint256", "name": "newHccPrice", "type": "uint256" }],
"name": "HccPriceChange",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": false, "internalType": "address", "name": "newOtherPaymentAddress", "type": "address" }],
"name": "OtherPaymentAddressChange",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": false, "internalType": "uint256", "name": "newOtherPaymentPirce", "type": "uint256" }],
"name": "OtherPaymentPirceChange",
"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": "bool", "name": "pause", "type": "bool" }],
"name": "PauseEvent",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
{ "indexed": true, "internalType": "address", "name": "from", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" },
{ "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }
],
"name": "WithdrawInviteReward",
"name": "Transfer",
"type": "event"
},
{
"inputs": [],
"name": "_candy",
"outputs": [
{
"internalType": "contract ICandy",
"name": "",
"type": "address"
}
],
"name": "START_AT",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_lastTokenID",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "child",
"type": "address"
},
{
"internalType": "address",
"name": "invite",
"type": "address"
}
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "_timestamp", "type": "uint256" },
{ "internalType": "uint256", "name": "code", "type": "uint256" },
{ "internalType": "bytes", "name": "_signature", "type": "bytes" }
],
"name": "addInviteAddress",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "invite",
"type": "address"
},
{
"internalType": "uint256",
"name": "rewardNum",
"type": "uint256"
}
],
"name": "addInviteReward",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "addWhitelisted",
"name": "adminMint",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "canGetRewardMap",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }
],
"name": "approve",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "owner", "type": "address" }],
"name": "balanceOf",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "baseTokenURI",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "executorAddress",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }],
"name": "getApproved",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "hccAddress",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "hccPirce",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "findAddress",
"type": "address"
}
],
"name": "getInviteAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
{ "internalType": "address", "name": "owner", "type": "address" },
{ "internalType": "address", "name": "operator", "type": "address" }
],
"name": "isApprovedForAll",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{ "inputs": [], "name": "mint", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
{
"inputs": [],
"name": "name",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "inviteNumMap",
"outputs": [
{
"internalType": "int128",
"name": "",
"type": "int128"
}
],
"inputs": [],
"name": "otherPaymentAddress",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "inviteTotalRewardMap",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "isWhitelisted",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "leaderMap",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"inputs": [],
"name": "otherPaymentPirce",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }],
"name": "ownerOf",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }],
"name": "rawOwnerOf",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{ "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
{
"inputs": [
{ "internalType": "address", "name": "from", "type": "address" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "from", "type": "address" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" },
{ "internalType": "bytes", "name": "_data", "type": "bytes" }
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "operator", "type": "address" },
{ "internalType": "bool", "name": "approved", "type": "bool" }
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "string", "name": "baseURI", "type": "string" }],
"name": "setBaseURI",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "executor", "type": "address" }],
"name": "setExecutorAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "newHccAddress", "type": "address" }],
"name": "setHccAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "newHccPirce", "type": "uint256" }],
"name": "setHccPirce",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "newOtherPaymentAddress", "type": "address" }],
"name": "setOtherPaymentAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "newOtherPaymentPirce", "type": "uint256" }],
"name": "setOtherPaymentPirce",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "bool", "name": "_pause", "type": "bool" }],
"name": "setPause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "wallet", "type": "address" },
{ "internalType": "uint256", "name": "code", "type": "uint256" },
{ "internalType": "uint256", "name": "_timestamp", "type": "uint256" },
{ "internalType": "bytes", "name": "_signature", "type": "bytes" }
],
"name": "signatureWallet",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [{ "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" }],
"name": "supportsInterface",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "index", "type": "uint256" }],
"name": "tokenByIndex",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
{ "internalType": "address", "name": "owner", "type": "address" },
{ "internalType": "uint256", "name": "index", "type": "uint256" }
],
"name": "removeWhitelisted",
"outputs": [],
"stateMutability": "nonpayable",
"name": "tokenOfOwnerByIndex",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }],
"name": "tokenURI",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"name": "totalSupply",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalToken",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "from", "type": "address" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }
],
"name": "transferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "candy",
"type": "address"
}
],
"name": "setCandyTokenAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "withDrawReward",
"inputs": [{ "internalType": "address", "name": "_owner", "type": "address" }],
"name": "walletOfOwner",
"outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "tokenAddress", "type": "address" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "withDrawToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"

View File

@ -0,0 +1,99 @@
[
{
"inputs": [
{ "internalType": "contract IERC20", "name": "_HCC", "type": "address" },
{ "internalType": "address", "name": "_executorAddress", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"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": true, "internalType": "address", "name": "sender", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" },
{ "indexed": false, "internalType": "bytes", "name": "_signature", "type": "bytes" }
],
"name": "WithDrawEvnet",
"type": "event"
},
{
"inputs": [],
"name": "HCC",
"outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "executorAddress",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{ "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
{
"inputs": [{ "internalType": "address", "name": "_executorAddress", "type": "address" }],
"name": "setExecutor",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
{ "internalType": "uint256", "name": "_expiredTime", "type": "uint256" },
{ "internalType": "bytes", "name": "_signature", "type": "bytes" }
],
"name": "signatureWallet",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "_amount", "type": "uint256" },
{ "internalType": "uint256", "name": "_expiredTime", "type": "uint256" },
{ "internalType": "bytes", "name": "_signature", "type": "bytes" }
],
"name": "withDrawReward",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "withDrawToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]

View File

@ -8,17 +8,21 @@ export default {
56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95',
},
boardChef: {
97: '0x88fd1e29160f6d498038254f1bd0f7729f812fa1',
97: '0xfe73bcc71c1e8f41f29c07ee921777ff8232eba7',
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约
},
holderChef: {
97: '0x0373aa1d09d58bb789db694d6b944b052ff26d91',
97: '0xc49ef97410f495164604be0de2baae908913c4cc',
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 持币人
},
referralChef: {
97: '0xE79D28722220fcC13833476E327DEA3a663f64DB',
97: '0x2f2aec0ee0da9f81e28e78a072cfbea6f35b1e06',
56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请或则军团长
},
referralRewardChef: {
97: '0xe031cf7053ea3b7605bb289efe2307356f6ace6d',
56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请或则军团长收益
},
lotteryV2: {
97: '0x5790c3534F30437641541a0FA04C992799602998',
56: '0x5aF6D33DE2ccEC94efb1bDF8f92Bd58085432d2c',

View File

@ -2,7 +2,7 @@ import { ContextApi } from 'contexts/Localization/types'
import { PageMeta } from './types'
export const DEFAULT_META: PageMeta = {
title: 'PancakeSwap',
title: 'HighCitySwap',
description:
'The most popular AMM on BSC by user count! Earn CAKE through yield farming or win it in the Lottery, then stake it in Syrup Pools to earn more tokens! Initial Farm Offerings (new token launch model pioneered by PancakeSwap), NFTs, and more, on a platform you can trust.',
image: 'https://pancakeswap.finance/images/hero.png',

View File

@ -26,6 +26,7 @@ import {
getBunnySpecialPredictionContract,
getReferralchefContract,
getBoardchefContract,
getReferralRewardchefContract,
} from 'utils/contractHelpers'
// Imports below migrated from Exchange useContract.ts
@ -108,6 +109,10 @@ export const useReferralchef = () => {
const { library } = useActiveWeb3React()
return useMemo(() => getReferralchefContract(library.getSigner()), [library])
}
export const useReferralRewardchef = () => {
const { library } = useActiveWeb3React()
return useMemo(() => getReferralRewardchefContract(library.getSigner()), [library])
}
export const useSousChef = (id) => {
const { library } = useActiveWeb3React()
return useMemo(() => getSouschefContract(id, library.getSigner()), [id, library])

View File

@ -5,7 +5,7 @@ const useGetDocumentTitlePrice = () => {
const cakePriceBusd = useCakeBusdPrice()
useEffect(() => {
const cakePriceBusdString = cakePriceBusd ? cakePriceBusd.toFixed(2) : ''
document.title = `Pancake Swap - ${cakePriceBusdString}`
document.title = `HighCity Swap - ${cakePriceBusdString}`
}, [cakePriceBusd])
}
export default useGetDocumentTitlePrice

View File

@ -7,4 +7,11 @@ export const getReferralInfo = () => {
})
}
export const withdrawReward = () => {
return request.request({
url: '/high_city/app/api/invite/reward/receive',
method: 'get',
})
}
export default getReferralInfo

View File

@ -26,6 +26,9 @@ export const getBoardAddress = () => {
export const getReferralAddress = () => {
return getAddress(addresses.referralChef)
}
export const getReferralRewardAddress = () => {
return getAddress(addresses.referralRewardChef)
}
export const getWbnbAddress = () => {
return getAddress(tokens.wbnb.address)
}

View File

@ -26,6 +26,7 @@ import {
getBunnySpecialPredictionAddress,
getBoardAddress,
getReferralAddress,
getReferralRewardAddress,
} from 'utils/addressHelpers'
// ABI
@ -44,6 +45,7 @@ import pointCenterIfo from 'config/abi/pointCenterIfo.json'
import lotteryV2Abi from 'config/abi/lotteryV2.json'
import masterChef from 'config/abi/masterchef.json'
import referralChef from 'config/abi/referral.json'
import referralRewardChef from 'config/abi/referralReward.json'
import boardChef from 'config/abi/board.json'
import sousChef from 'config/abi/sousChef.json'
import sousChefV2 from 'config/abi/sousChefV2.json'
@ -122,6 +124,9 @@ export const getBoardchefContract = (id: number, signer?: ethers.Signer | ethers
export const getReferralchefContract = (signer?: ethers.Signer | ethers.providers.Provider) => {
return getContract(referralChef, getReferralAddress(), signer)
}
export const getReferralRewardchefContract = (signer?: ethers.Signer | ethers.providers.Provider) => {
return getContract(referralRewardChef, getReferralRewardAddress(), signer)
}
export const getClaimRefundContract = (signer?: ethers.Signer | ethers.providers.Provider) => {
return getContract(claimRefundAbi, getClaimRefundAddress(), signer)
}

View File

@ -9,6 +9,9 @@ import { BIG_TEN } from './bigNumber'
export const getDecimalAmount = (amount: BigNumber, decimals = 18) => {
return new BigNumber(amount).times(BIG_TEN.pow(decimals))
}
export const getDecimalAmountNumber = (amount: BigNumber | number, decimals = 18) => {
return new BigNumber(amount).times(BIG_TEN.pow(decimals)).toNumber()
}
export const getBalanceAmount = (amount: BigNumber | number, decimals = 18) => {
return new BigNumber(amount).dividedBy(BIG_TEN.pow(decimals))

View File

@ -4,6 +4,7 @@ import { useTranslation } from 'contexts/Localization'
import { Flex, Button, Modal, Image } from '@pancakeswap/uikit'
import TextFlex from './TextFlex'
import FlexCom from './FlexCom'
import { useBuyTransaction } from '../hooks'
const ModalDiv = styled(Modal)`
width: 80%;
@ -49,8 +50,11 @@ const ImageDiv = styled(Image)`
const BuyNftModal: React.FC = () => {
const { t } = useTranslation()
const sendBuyTransaction = useBuyTransaction()
// const onDismiss = () => {}
const handleBuy = () => {
sendBuyTransaction()
}
return (
<ModalDiv title={t('Buy commander NFT')}>
<Flex alignItems="center" flexWrap="wrap" justifyContent="center">
@ -71,7 +75,7 @@ const BuyNftModal: React.FC = () => {
</Flex>
<Flex>
<UpBtn>{t('Buy It Now')}</UpBtn>
<UpBtn onClick={handleBuy}>{t('Buy It Now')}</UpBtn>
</Flex>
</ModalDiv>
)

View File

@ -0,0 +1,57 @@
import { useState, useCallback } from 'react'
import { useReferralchef, useReferralRewardchef } from 'hooks/useContract'
import useTokenBalance, { useGetBnbBalance } from 'hooks/useTokenBalance'
import { getAddress } from 'utils/addressHelpers'
import tokensList from 'config/constants/tokens'
import useToast from 'hooks/useToast'
import { useTranslation } from 'contexts/Localization'
import { getBalanceNumber, getDecimalAmountNumber } from 'utils/formatBalance'
import { withdrawReward } from 'services/referral'
const useCheckTokenBalance = ({ isBnb, isHcc, isUsdt }) => {
const { balance: bnbTokenBalance } = useGetBnbBalance()
const { balance: usdtTokenBalance } = useTokenBalance(getAddress(tokensList.usdt.address))
const { balance: hccTokenBalance } = useTokenBalance(getAddress(tokensList.hcc.address))
const { toastWarning } = useToast()
const { t } = useTranslation()
const onCheck = useCallback(() => {
if (
(isBnb && getBalanceNumber(bnbTokenBalance) === 0) ||
(isHcc && getBalanceNumber(hccTokenBalance) === 0) ||
(isUsdt && getBalanceNumber(usdtTokenBalance) === 0)
) {
toastWarning(t('Insufficient Balance'))
}
}, [isBnb, isHcc, isUsdt])
return [onCheck]
}
export const useBuyTransaction = () => {
const referralContract = useReferralchef()
const transaction = async () => {
const data = await withdrawReward()
const { to, amount, code, signature } = data
console.log(data)
const params = [to, amount, code, signature]
const price = getDecimalAmountNumber(amount)
const res = await referralContract.adminMint(...params, { value: price })
return res
}
return transaction
}
export const useWithdraw = () => {
const referralRewardContract = useReferralRewardchef()
const transaction = async () => {
const data = await withdrawReward()
const { to, amount, expiredTime, signature } = data
console.log(data)
const params = [to, amount, expiredTime, signature]
const price = getDecimalAmountNumber(amount)
const res = await referralRewardContract.withDrawReward(...params, { value: price })
return res
}
return transaction
}
export default useCheckTokenBalance

View File

@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'
import styled from 'styled-components'
import { fetchReferralInfoAsync } from 'state/actions'
import { useAccount } from 'state/userInfo/hooks'
import { useReferralConfigInfo } from 'state/referral/hooks'
import { useReferralCommanderConfigInfo } from 'state/referral/hooks'
import { useDispatch } from 'react-redux'
import UnunitedCom from './components/UnunitedCom'
import ConnectedCom from './components/Connected'
@ -42,7 +42,7 @@ const Nft: React.FC = () => {
const dispatch = useDispatch()
const account = useAccount()
const referralConfigInfo = useReferralConfigInfo()
const referralConfigInfo = useReferralCommanderConfigInfo()
console.log(referralConfigInfo)
useEffect(() => {
dispatch(fetchReferralInfoAsync(account))