feat: 修改董事会

This commit is contained in:
gary 2022-04-23 17:21:47 +08:00
parent 196f9a8119
commit 1bff22307b
31 changed files with 943 additions and 608 deletions

View File

@ -1,14 +1,14 @@
REACT_APP_CHAIN_ID = "56" REACT_APP_CHAIN_ID = "97"
REACT_APP_GTAG = "GTM-PXLD3XW" REACT_APP_GTAG = "GTM-PXLD3XW"
# 10+ nodes balanced, US/EU # 10+ nodes balanced, US/EU
REACT_APP_NODE_1 = "https://bsc-dataseed1.ninicoin.io" REACT_APP_NODE_1 = "https://data-seed-prebsc-1-s1.binance.org:8545"
# 10+ nodes balanced, US/EU # 10+ nodes balanced, US/EU
REACT_APP_NODE_2 = "https://bsc-dataseed1.defibit.io" REACT_APP_NODE_2 = "https://data-seed-prebsc-1-s1.binance.org:8545"
# 10+ nodes balanced in each region, global # 10+ nodes balanced in each region, global
REACT_APP_NODE_3 = "https://bsc-dataseed.binance.org" REACT_APP_NODE_3 = "https://data-seed-prebsc-1-s1.binance.org:8545"
REACT_APP_GRAPH_API_PROFILE = "https://api.thegraph.com/subgraphs/name/pancakeswap/profile" REACT_APP_GRAPH_API_PROFILE = "https://api.thegraph.com/subgraphs/name/pancakeswap/profile"
REACT_APP_GRAPH_API_PREDICTION = "https://api.thegraph.com/subgraphs/name/pancakeswap/prediction" REACT_APP_GRAPH_API_PREDICTION = "https://api.thegraph.com/subgraphs/name/pancakeswap/prediction"

View File

@ -56,6 +56,7 @@
"canvas-confetti": "^1.3.3", "canvas-confetti": "^1.3.3",
"cids": "^1.0.0", "cids": "^1.0.0",
"date-fns": "^2.21.3", "date-fns": "^2.21.3",
"dayjs": "^1.11.1",
"easymde": "^2.15.0", "easymde": "^2.15.0",
"ethers": "^5.1.4", "ethers": "^5.1.4",
"graphql": "^15.5.0", "graphql": "^15.5.0",

View File

@ -93,6 +93,7 @@ const App: React.FC = () => {
</Route> </Route>
<Route path="/board"> <Route path="/board">
<Board /> <Board />
</Route>
<Route path="/nft"> <Route path="/nft">
<Nft /> <Nft />
</Route> </Route>

View File

@ -45,6 +45,11 @@ const config: (t: ContextApi['t']) => MenuEntry[] = (t) => [
icon: 'TicketIcon', icon: 'TicketIcon',
href: '/nft', href: '/nft',
}, },
{
label: t('Board'),
icon: 'TicketIcon',
href: '/board',
},
// { // {
// label: t('Prediction (BETA)'), // label: t('Prediction (BETA)'),
// icon: 'PredictionsIcon', // icon: 'PredictionsIcon',

View File

@ -2,19 +2,19 @@
{ {
"inputs": [ "inputs": [
{ {
"internalType": "address", "internalType": "contract IERC20",
"name": "_candy", "name": "_HCC",
"type": "address" "type": "address"
}, },
{ {
"internalType": "address", "internalType": "address",
"name": "_xCandy", "name": "_HCCBODReawardPool",
"type": "address" "type": "address"
}, },
{ {
"internalType": "bool", "internalType": "uint256",
"name": "_turnOnCondition", "name": "_minStakeAmount",
"type": "bool" "type": "uint256"
} }
], ],
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
@ -32,7 +32,7 @@
{ {
"indexed": false, "indexed": false,
"internalType": "uint256", "internalType": "uint256",
"name": "amount", "name": "value",
"type": "uint256" "type": "uint256"
} }
], ],
@ -58,25 +58,6 @@
"name": "EmergencyWithdraw", "name": "EmergencyWithdraw",
"type": "event" "type": "event"
}, },
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "NodeReward",
"type": "event"
},
{ {
"anonymous": false, "anonymous": false,
"inputs": [ "inputs": [
@ -96,6 +77,45 @@
"name": "OwnershipTransferred", "name": "OwnershipTransferred",
"type": "event" "type": "event"
}, },
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "newHCCBODReawardPool",
"type": "address"
}
],
"name": "SetHCCBODReawardPoolEvent",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "newLockTime",
"type": "uint256"
}
],
"name": "SetLockTimeEvent",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "newMinStakeAmount",
"type": "uint256"
}
],
"name": "SetMinStakeAmontEvent",
"type": "event"
},
{ {
"anonymous": false, "anonymous": false,
"inputs": [ "inputs": [
@ -115,31 +135,12 @@
"name": "Withdraw", "name": "Withdraw",
"type": "event" "type": "event"
}, },
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "WithdrawNodeReward",
"type": "event"
},
{ {
"inputs": [], "inputs": [],
"name": "Candy", "name": "HCC",
"outputs": [ "outputs": [
{ {
"internalType": "contract IHRC20", "internalType": "contract IERC20",
"name": "", "name": "",
"type": "address" "type": "address"
} }
@ -149,10 +150,10 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "XCandy", "name": "HCCBODReawardPool",
"outputs": [ "outputs": [
{ {
"internalType": "contract IHRC20", "internalType": "address",
"name": "", "name": "",
"type": "address" "type": "address"
} }
@ -160,83 +161,19 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "uint256",
"name": "rewardNum",
"type": "uint256"
}
],
"name": "addNodeReward",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "addWhitelisted",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "canGetRewardMap",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_thresholdDivider",
"type": "uint256"
}
],
"name": "changeThresholdDivider",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "conditionTurnOn", "name": "_poolInfo",
"outputs": [ "outputs": [
{ {
"internalType": "bool", "internalType": "uint256",
"name": "", "name": "accHCCPerShare",
"type": "bool" "type": "uint256"
},
{
"internalType": "uint256",
"name": "totalAmount",
"type": "uint256"
} }
], ],
"stateMutability": "view", "stateMutability": "view",
@ -248,16 +185,28 @@
"internalType": "uint256", "internalType": "uint256",
"name": "_amount", "name": "_amount",
"type": "uint256" "type": "uint256"
},
{
"internalType": "address",
"name": "_userAddress",
"type": "address"
} }
], ],
"name": "enterStake", "name": "deposit",
"outputs": [], "outputs": [],
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{ {
"inputs": [], "inputs": [],
"name": "firstStakeThreshold", "name": "emergencyWithdrawHCC",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "lockTime",
"outputs": [ "outputs": [
{ {
"internalType": "uint256", "internalType": "uint256",
@ -268,86 +217,9 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "_findAddress",
"type": "address"
}
],
"name": "getIsNodeMembers",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "isWhitelisted",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "leaveStake", "name": "minStakeAmount",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "leaveStakePrecheck",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "nodeMembers",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "nodeToPeriod",
"outputs": [ "outputs": [
{ {
"internalType": "uint256", "internalType": "uint256",
@ -371,17 +243,36 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "paused",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
"internalType": "address", "internalType": "address",
"name": "account", "name": "_user",
"type": "address" "type": "address"
} }
], ],
"name": "removeWhitelisted", "name": "pendingHCC",
"outputs": [], "outputs": [
"stateMutability": "nonpayable", {
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function" "type": "function"
}, },
{ {
@ -394,27 +285,47 @@
{ {
"inputs": [ "inputs": [
{ {
"internalType": "bool", "internalType": "address",
"name": "_turnOn", "name": "_HCCBODReawardPool",
"type": "bool" "type": "address"
} }
], ],
"name": "switchCondition", "name": "setHCCBODReawardPool",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_lockTime",
"type": "uint256"
}
],
"name": "setLockTime",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_minStakeAmount",
"type": "uint256"
}
],
"name": "setMinStakeAmount",
"outputs": [], "outputs": [],
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{ {
"inputs": [], "inputs": [],
"name": "thresholdDivider", "name": "setPause",
"outputs": [ "outputs": [],
{ "stateMutability": "nonpayable",
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function" "type": "function"
}, },
{ {
@ -430,6 +341,13 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "updatePool",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
@ -447,7 +365,12 @@
}, },
{ {
"internalType": "uint256", "internalType": "uint256",
"name": "stakeTs", "name": "rewardDebt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "unLockTime",
"type": "uint256" "type": "uint256"
} }
], ],
@ -456,7 +379,7 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "withDrawReward", "name": "withdrawHCC",
"outputs": [], "outputs": [],
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"

View File

@ -0,0 +1,405 @@
[
{
"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": "owner", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "approved", "type": "address" },
{ "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "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": true, "internalType": "address", "name": "to", "type": "address" },
{ "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [],
"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": "to", "type": "address" },
{ "internalType": "uint256", "name": "_timestamp", "type": "uint256" },
{ "internalType": "uint256", "name": "code", "type": "uint256" },
{ "internalType": "bytes", "name": "_signature", "type": "bytes" }
],
"name": "adminMint",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "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": "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": [],
"name": "otherPaymentAddress",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "otherPaymentPirce",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"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": "owner", "type": "address" },
{ "internalType": "uint256", "name": "index", "type": "uint256" }
],
"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": "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": "newOwner", "type": "address" }],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"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

@ -1,17 +1,19 @@
import contracts from './contracts' import addresses from 'config/constants/contracts'
import boardChef from 'config/abi/board.json'
import tokens from './tokens' import tokens from './tokens'
import { BoardConfig } from './types' import { BoardConfig } from './types'
const BoardList: BoardConfig[] = [ const bordsList: BoardConfig[] = [
{ {
pid: 1, pid: 1,
name: 'Nodes', name: 'Board',
img: 'nodes', img: 'nodes',
stringId: 100004,
tokenSymbol: tokens.hcc.symbol, tokenSymbol: tokens.hcc.symbol,
tokenAddresses: tokens.hcc.address, tokenAddresses: tokens.hcc.address,
tokenDecimals: 18, tokenDecimals: 18,
contractAddress: addresses.boardChef,
abi: boardChef,
}, },
] ]
export default BoardList export default bordsList

View File

@ -8,12 +8,12 @@ export default {
56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95', 56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95',
}, },
boardChef: { boardChef: {
97: '0x4BC67bBC22a245035fDd1F00DCa7d4F2E1e8f636', 97: '0x0dF74009bF2b85b2B19FC7aF67DD5AAF2cde4Ce0',
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约 56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约
}, },
referralChef: { referralChef: {
97: '0x3Dcf2586519a25719658Afb2cDB4CEf0DD647Ea3', 97: '0xE79D28722220fcC13833476E327DEA3a663f64DB',
56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请合约 56: '0x88F46EF2Ee08494D84942DCA3bd24cDEf7C88Ae2', // NEED CHANGE 邀请或则军团长
}, },
lotteryV2: { lotteryV2: {
97: '0x5790c3534F30437641541a0FA04C992799602998', 97: '0x5790c3534F30437641541a0FA04C992799602998',

View File

@ -91,3 +91,4 @@ export const BLOCKED_ADDRESSES: string[] = [
export { default as farmsConfig } from './farms' export { default as farmsConfig } from './farms'
export { default as poolsConfig } from './pools' export { default as poolsConfig } from './pools'
export { default as ifosConfig } from './ifo' export { default as ifosConfig } from './ifo'
export { default as boardConfig } from './boards'

View File

@ -60,11 +60,20 @@ export const USDC = new Token(
) )
const tokens = { const tokens = {
usdt: {
symbol: 'USDT',
address: {
56: '0x55d398326f99059fF775485246999027B3197955',
97: '0xaC893B498E2005Af4cb8b03D710F187EC23a8f5f',
},
decimals: 18,
projectLink: 'https://tether.to/',
},
hcc: { hcc: {
symbol: 'HCC', symbol: 'HCC',
address: { address: {
56: '0x20de22029ab63cf9A7Cf5fEB2b737Ca1eE4c82A6', 56: '0x20de22029ab63cf9A7Cf5fEB2b737Ca1eE4c82A6',
97: '0x71D239B4564DC00d994AbF6E6cD7582dd873649E', 97: '0xbdd6c43fb8e97a73e464fca5ab6f3d2f402be20c',
}, },
decimals: 18, decimals: 18,
projectLink: 'https://tranchess.com/', projectLink: 'https://tranchess.com/',
@ -902,15 +911,7 @@ const tokens = {
decimals: 18, decimals: 18,
projectLink: 'https://chain.link/', projectLink: 'https://chain.link/',
}, },
usdt: {
symbol: 'USDT',
address: {
56: '0x55d398326f99059fF775485246999027B3197955',
97: '0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5',
},
decimals: 18,
projectLink: 'https://tether.to/',
},
btcb: { btcb: {
symbol: 'BTCB', symbol: 'BTCB',
address: { address: {

View File

@ -185,4 +185,6 @@ export interface BoardConfig {
tokenSymbol: string tokenSymbol: string
tokenAddresses: Address tokenAddresses: Address
tokenDecimals: number tokenDecimals: number
contractAddress: Address
abi: any
} }

View File

@ -27,7 +27,7 @@ export const CAKE_PER_YEAR = CAKE_PER_BLOCK.times(BLOCKS_PER_YEAR)
export const BASE_URL = 'https://pancakeswap.finance' export const BASE_URL = 'https://pancakeswap.finance'
export const BASE_ADD_LIQUIDITY_URL = `${BASE_URL}/add` export const BASE_ADD_LIQUIDITY_URL = `${BASE_URL}/add`
export const BASE_LIQUIDITY_POOL_URL = `${BASE_URL}/pool` export const BASE_LIQUIDITY_POOL_URL = `${BASE_URL}/pool`
export const BASE_BSC_SCAN_URL = BASE_BSC_SCAN_URLS[ChainId.MAINNET] export const BASE_BSC_SCAN_URL = BASE_BSC_SCAN_URLS[ChainId.TESTNET]
export const LOTTERY_MAX_NUMBER_OF_TICKETS = 50 export const LOTTERY_MAX_NUMBER_OF_TICKETS = 50
export const LOTTERY_TICKET_PRICE = 1 export const LOTTERY_TICKET_PRICE = 1
export const DEFAULT_TOKEN_DECIMAL = BIG_TEN.pow(18) export const DEFAULT_TOKEN_DECIMAL = BIG_TEN.pow(18)

View File

@ -100,9 +100,9 @@ export const useMasterchef = () => {
const { library } = useActiveWeb3React() const { library } = useActiveWeb3React()
return useMemo(() => getMasterchefContract(library.getSigner()), [library]) return useMemo(() => getMasterchefContract(library.getSigner()), [library])
} }
export const useBoardchef = () => { export const useBoardchef = (id: number) => {
const { library } = useActiveWeb3React() const { library } = useActiveWeb3React()
return useMemo(() => getBoardchefContract(library.getSigner()), [library]) return useMemo(() => getBoardchefContract(id, library.getSigner()), [library])
} }
export const useReferralchef = () => { export const useReferralchef = () => {
const { library } = useActiveWeb3React() const { library } = useActiveWeb3React()

View File

@ -9,7 +9,7 @@ const fetchBoards = async () => {
const data = await Promise.all( const data = await Promise.all(
boardsConfig.map(async (boardConfig) => { boardsConfig.map(async (boardConfig) => {
const tokenAddress = getAddress(boardConfig.tokenAddresses) const tokenAddress = getAddress(boardConfig.tokenAddresses)
const BoardChefAddress = getBoardAddress() const BoardChefAddress = getAddress(boardConfig.contractAddress)
const calls = [ const calls = [
// 查节点的代币数量 // 查节点的代币数量
{ {
@ -26,18 +26,27 @@ const fetchBoards = async () => {
// eslint-disable-next-line prefer-const // eslint-disable-next-line prefer-const
let [tokenBalance, tokenDecimals] = await multicall(erc20, calls) let [tokenBalance, tokenDecimals] = await multicall(erc20, calls)
tokenBalance = new BigNumber(tokenBalance).div(new BigNumber(10).pow(tokenDecimals)) tokenBalance = new BigNumber(tokenBalance).div(new BigNumber(10).pow(tokenDecimals))
let [minStakeAmount] = await multicall(boardchefABI, [ // eslint-disable-next-line prefer-const
let [minStakeAmount, lockTime] = await multicall(boardConfig.abi, [
// 最低质押额度 // 最低质押额度
{ {
address: BoardChefAddress, address: BoardChefAddress,
name: 'firstStakeThreshold', name: 'minStakeAmount',
},
// 最低质押额度
{
address: BoardChefAddress,
name: 'lockTime',
}, },
]) ])
lockTime = new BigNumber(lockTime).toJSON()
console.log(lockTime)
minStakeAmount = new BigNumber(minStakeAmount).div(new BigNumber(10).pow(tokenDecimals)).toJSON() minStakeAmount = new BigNumber(minStakeAmount).div(new BigNumber(10).pow(tokenDecimals)).toJSON()
return { return {
...boardConfig, ...boardConfig,
tokenBalance: tokenBalance.toJSON(), tokenBalance: tokenBalance.toJSON(),
minStakeAmount, minStakeAmount,
lockTime,
} }
}), }),
) )

View File

@ -4,13 +4,11 @@ import boardABI from 'config/abi/board.json'
import multicall from 'utils/multicall' import multicall from 'utils/multicall'
import boardsConfig from 'config/constants/boards' import boardsConfig from 'config/constants/boards'
import { getAddress, getBoardAddress } from 'utils/addressHelpers' import { getAddress, getBoardAddress } from 'utils/addressHelpers'
import contracts from 'config/constants/contracts'
import tokens from 'config/constants/tokens'
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 = getBoardAddress() const boardChefAdress = getAddress(board.contractAddress)
return { address: tokenAddresses, name: 'allowance', params: [account, boardChefAdress] } return { address: tokenAddresses, name: 'allowance', params: [account, boardChefAdress] }
}) })
@ -38,54 +36,30 @@ export const fetchBoardUserTokenBalances = async (account: string) => {
return parsedTokenBalances return parsedTokenBalances
} }
export const fetchBoardUserStakedBalances = async (account: string) => { export const fetchBoardUserInfo = async (account: string) => {
const calls = boardsConfig.map((board) => { const data = await Promise.all(
const boardChefAdress = getBoardAddress() boardsConfig.map(async (board) => {
return { const boardChefAdress = getAddress(board.contractAddress)
const calls = [
{
address: boardChefAdress, address: boardChefAdress,
name: 'userInfo', name: 'userInfo',
params: [account], params: [account],
} },
}) {
const rawStakedBalances = await multicall(boardABI, calls)
const parsedStakedBalances = rawStakedBalances.map((stakedBalance) => {
return {
stakedBalance: new BigNumber(stakedBalance[0]._hex).toJSON(),
stakedTime: new BigNumber(stakedBalance[1]._hex).toNumber(),
}
})
return parsedStakedBalances
}
export const fetchBoardUserUnlockTime = async (account: string) => {
const calls = boardsConfig.map((board) => {
const boardChefAdress = getBoardAddress()
return {
address: boardChefAdress, address: boardChefAdress,
name: 'boardToPeriod', name: 'pendingHCC',
}
})
const rawUnlockTime = await multicall(boardABI, calls)
const parsedUnlockTime = rawUnlockTime.map((time) => {
return new BigNumber(time[0]._hex).toNumber()
})
return parsedUnlockTime
}
export const fetchUserXCandyBalance = async (account: string) => {
const calls = boardsConfig.map((board) => {
return {
address: getAddress(tokens.hcc.address),
name: 'balanceOf',
params: [account], params: [account],
},
]
const [userInfo, estimatedProfit] = await multicall(boardABI, calls)
return {
stakedBalance: new BigNumber(userInfo.amount._hex).toJSON(),
unLockTime: new BigNumber(userInfo.unLockTime._hex).toNumber(),
estimatedProfit: new BigNumber(estimatedProfit).toJSON(),
} }
}) }),
)
const rawXTokenBalance = await multicall(erc20ABI, calls) return data
const parsedXTokenBalance = rawXTokenBalance.map((item) => {
return new BigNumber(item[0]._hex).toJSON()
})
return parsedXTokenBalance
} }

View File

@ -3,13 +3,7 @@ import { createSlice } from '@reduxjs/toolkit'
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import boardsConfig from 'config/constants/boards' import boardsConfig from 'config/constants/boards'
import fetchBoards from './fetchBoards' import fetchBoards from './fetchBoards'
import { import { fetchBoardUserAllowances, fetchBoardUserTokenBalances, fetchBoardUserInfo } from './fetchBoardsUser'
fetchBoardUserAllowances,
fetchBoardUserTokenBalances,
fetchBoardUserStakedBalances,
fetchBoardUserUnlockTime,
fetchUserXCandyBalance,
} from './fetchBoardsUser'
import { BoardsState, Boards } from '../types' import { BoardsState, Boards } from '../types'
const initialState: BoardsState = { data: [...boardsConfig] } const initialState: BoardsState = { data: [...boardsConfig] }
@ -46,17 +40,15 @@ export const fetchBoardsPublicDataAsync = () => async (dispatch) => {
export const fetchBoardUserDataAsync = (account) => async (dispatch) => { export const fetchBoardUserDataAsync = (account) => async (dispatch) => {
const userBoardAllowances = await fetchBoardUserAllowances(account) const userBoardAllowances = await fetchBoardUserAllowances(account)
const userBoardTokenBalances = await fetchBoardUserTokenBalances(account) const userBoardTokenBalances = await fetchBoardUserTokenBalances(account)
const userStakedBalances = await fetchBoardUserStakedBalances(account) const userInfo = await fetchBoardUserInfo(account)
const userUnlockTimes = await fetchBoardUserUnlockTime(account)
const userXCandyBalances = await fetchUserXCandyBalance(account)
const arrayOfUserDataObjects = userBoardAllowances.map((nodeAllowance, index) => { const arrayOfUserDataObjects = userBoardAllowances.map((nodeAllowance, index) => {
return { return {
index, index,
allowance: userBoardAllowances[index], allowance: userBoardAllowances[index],
tokenBalance: userBoardTokenBalances[index], tokenBalance: userBoardTokenBalances[index],
stakedBalance: userStakedBalances[index].stakedBalance, stakedBalance: userInfo[index].stakedBalance,
xCandyBalance: userXCandyBalances[index], unlockTime: userInfo[index].unLockTime,
unlockTime: userUnlockTimes[index] + userStakedBalances[index].stakedTime, estimatedProfit: userInfo[index].estimatedProfit,
} }
}) })

View File

@ -217,7 +217,7 @@ export const useBoardUser = (pid) => {
tokenBalance: board.userData ? new BigNumber(board.userData.tokenBalance) : new BigNumber(0), tokenBalance: board.userData ? new BigNumber(board.userData.tokenBalance) : new BigNumber(0),
stakedBalance: board.userData ? new BigNumber(board.userData.stakedBalance) : new BigNumber(0), stakedBalance: board.userData ? new BigNumber(board.userData.stakedBalance) : new BigNumber(0),
unlockTime: board.userData ? board.userData.unlockTime : 0, unlockTime: board.userData ? board.userData.unlockTime : 0,
xCandyBalance: board.userData ? board.userData.xCandyBalance : 0, estimatedProfit: board.userData ? board.userData.estimatedProfit : 0,
} }
} }
// cake // cake

View File

@ -516,7 +516,7 @@ export interface Boards extends BoardConfig {
tokenBalance: BigNumber tokenBalance: BigNumber
stakedBalance: BigNumber stakedBalance: BigNumber
unlockTime: number unlockTime: number
xCandyBalance: number estimatedProfit: number
} }
} }
export interface BoardsState { export interface BoardsState {

27
src/utils/calls/boards.ts Normal file
View File

@ -0,0 +1,27 @@
import BigNumber from 'bignumber.js'
import { DEFAULT_GAS_LIMIT, DEFAULT_TOKEN_DECIMAL } from 'config'
const options = {
gasLimit: DEFAULT_GAS_LIMIT,
}
export const stakeBoard = async (masterChefContract, pid, amount) => {
const value = new BigNumber(amount).times(DEFAULT_TOKEN_DECIMAL).toString()
const tx = await masterChefContract.deposit(pid, value, options)
const receipt = await tx.wait()
return receipt.status
}
export const unstakeBoard = async (masterChefContract, pid, amount) => {
const value = new BigNumber(amount).times(DEFAULT_TOKEN_DECIMAL).toString()
const tx = await masterChefContract.withdrawHCC(pid, value, options)
const receipt = await tx.wait()
return receipt.status
}
export const harvestBoard = async (masterChefContract, pid) => {
const tx = await masterChefContract.harvest(pid, '0', options)
const receipt = await tx.wait()
return receipt.status
}

View File

@ -1,3 +1,4 @@
export * from './estimateGas' export * from './estimateGas'
export * from './farms' export * from './farms'
export * from './pools' export * from './pools'
export * from './boards'

View File

@ -1,6 +1,6 @@
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { simpleRpcProvider } from 'utils/providers' import { simpleRpcProvider } from 'utils/providers'
import { poolsConfig } from 'config/constants' import { poolsConfig, boardConfig } from 'config/constants'
import { PoolCategory } from 'config/constants/types' import { PoolCategory } from 'config/constants/types'
// Addresses // Addresses
@ -115,8 +115,9 @@ export const getLotteryV2Contract = (signer?: ethers.Signer | ethers.providers.P
export const getMasterchefContract = (signer?: ethers.Signer | ethers.providers.Provider) => { export const getMasterchefContract = (signer?: ethers.Signer | ethers.providers.Provider) => {
return getContract(masterChef, getMasterChefAddress(), signer) return getContract(masterChef, getMasterChefAddress(), signer)
} }
export const getBoardchefContract = (signer?: ethers.Signer | ethers.providers.Provider) => { export const getBoardchefContract = (id: number, signer?: ethers.Signer | ethers.providers.Provider) => {
return getContract(boardChef, getBoardAddress(), signer) const config = boardConfig.find((board) => board.pid === id)
return getContract(config.abi, getAddress(config.contractAddress), signer)
} }
export const getReferralchefContract = (signer?: ethers.Signer | ethers.providers.Provider) => { export const getReferralchefContract = (signer?: ethers.Signer | ethers.providers.Provider) => {
return getContract(referralChef, getReferralAddress(), signer) return getContract(referralChef, getReferralAddress(), signer)

View File

@ -88,10 +88,9 @@ const NodeCard: React.FC<NodeCardProps> = ({ board, account }) => {
return ( return (
<FCard> <FCard>
{/* {true && <StyledCardAccent />} */}
<CardHeading name={t(board.name)} img={board.img} tokenSymbol={board.tokenSymbol} /> <CardHeading name={t(board.name)} img={board.img} tokenSymbol={board.tokenSymbol} />
<CardActionsContainer node={board} account={account} /> <CardActionsContainer board={board} account={account} />
<Divider /> {/* <Divider />
<ExpandableSectionButton <ExpandableSectionButton
onClick={() => setShowExpandableSection(!showExpandableSection)} onClick={() => setShowExpandableSection(!showExpandableSection)}
expanded={showExpandableSection} expanded={showExpandableSection}
@ -101,7 +100,7 @@ const NodeCard: React.FC<NodeCardProps> = ({ board, account }) => {
bscScanAddress={`${process.env.REACT_APP_NETWORK_URL}/address/${getBoardAddress()}`} bscScanAddress={`${process.env.REACT_APP_NETWORK_URL}/address/${getBoardAddress()}`}
totalValueFormated={board.tokenBalance || '-'} totalValueFormated={board.tokenBalance || '-'}
/> />
</ExpandingWrapper> </ExpandingWrapper> */}
</FCard> </FCard>
) )
} }

View File

@ -19,20 +19,20 @@ const Action = styled.div`
` `
interface NodeCardActionsProps { interface NodeCardActionsProps {
node: Boards board: Boards
provider?: ProviderType provider?: ProviderType
account?: string account?: string
} }
const CardActions: React.FC<NodeCardActionsProps> = ({ node, account }) => { const CardActions: React.FC<NodeCardActionsProps> = ({ board, account }) => {
const { t } = useTranslation() const { t } = useTranslation()
const [requestedApproval, setRequestedApproval] = useState(false) const [requestedApproval, setRequestedApproval] = useState(false)
const pid = node.pid const pid = board.pid
const { allowance, tokenBalance, stakedBalance, xCandyBalance } = useBoardUser(pid) const { allowance, tokenBalance, stakedBalance, estimatedProfit } = useBoardUser(pid)
const isApproved = account && allowance && allowance.isGreaterThan(0) const isApproved = account && allowance && allowance.isGreaterThan(0)
const tokenContract = useERC20(getAddress(node.tokenAddresses)) const tokenContract = useERC20(getAddress(board.tokenAddresses))
const { onApprove } = useApproveBoard(tokenContract) const { onApprove } = useApproveBoard(tokenContract, pid)
const handleApprove = useCallback(async () => { const handleApprove = useCallback(async () => {
try { try {
@ -50,15 +50,12 @@ const CardActions: React.FC<NodeCardActionsProps> = ({ node, account }) => {
<StakeAction stakedBalance={stakedBalance} tokenBalance={tokenBalance} pid={pid} /> <StakeAction stakedBalance={stakedBalance} tokenBalance={tokenBalance} pid={pid} />
<Flex flexDirection="column" alignItems="flex-start" mt="10"> <Flex flexDirection="column" alignItems="flex-start" mt="10">
<Flex> <Flex>
<Text bold textTransform="uppercase" color="secondary" fontSize="12px" pr="3px">
{TOKEN_SYMBOL}
</Text>
<Text color="textSubtle" fontSize="12px"> <Text color="textSubtle" fontSize="12px">
{t('Amount')} {t('TotalProfit')}
</Text> </Text>
</Flex> </Flex>
<Text bold textTransform="uppercase" fontSize="20px"> <Text bold textTransform="uppercase" fontSize="20px">
{getBalanceNumber(new BigNumber(xCandyBalance))} {getBalanceNumber(new BigNumber(estimatedProfit))}
</Text> </Text>
</Flex> </Flex>
</> </>
@ -73,7 +70,7 @@ const CardActions: React.FC<NodeCardActionsProps> = ({ node, account }) => {
<Action> <Action>
<Flex> <Flex>
<Text bold textTransform="uppercase" color="secondary" fontSize="12px" pr="3px"> <Text bold textTransform="uppercase" color="secondary" fontSize="12px" pr="3px">
{node.tokenSymbol} {board.tokenSymbol}
</Text> </Text>
<Text bold textTransform="uppercase" color="textSubtle" fontSize="12px"> <Text bold textTransform="uppercase" color="textSubtle" fontSize="12px">
{t('Staked')} {t('Staked')}

View File

@ -24,7 +24,7 @@ const CardHeading: React.FC<ExpandableSectionProps> = ({ name, img, tokenSymbol
<Image src={`/images/nodes/${img}.png`} width={64} height={64} /> <Image src={`/images/nodes/${img}.png`} width={64} height={64} />
<Flex> <Flex>
<Heading mb="4px">{name}</Heading> <Heading mb="4px">{name}</Heading>
<Question text={t('To join board, you need to stake at least 0.1% total supply of Token')} /> {/* <Question text={t('To join board, you need to stake at least 0.1% total supply of Token')} /> */}
</Flex> </Flex>
</Wrapper> </Wrapper>
) )

View File

@ -40,7 +40,7 @@ const DetailsSection: React.FC<ExpandableSectionProps> = ({ bscScanAddress, remo
{/* )} */} {/* )} */}
<Flex justifyContent="flex-start"> <Flex justifyContent="flex-start">
<Link external href={bscScanAddress} bold={false}> <Link external href={bscScanAddress} bold={false}>
{t( 'View on BscScan')} {t('View on BscScan')}
</Link> </Link>
</Flex> </Flex>
</Wrapper> </Wrapper>

View File

@ -1,10 +1,8 @@
import React, { useMemo } from 'react' import React, { useMemo } 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 BigNumber from 'bignumber.js'
import { Button, Flex, Heading, IconButton, AddIcon, MinusIcon, useModal } from '@pancakeswap/uikit' import { Button, Flex, Heading, IconButton, AddIcon, MinusIcon, useModal } from '@pancakeswap/uikit'
// import { NODE_UNLOCK_TIME } from 'config/index'
import { getBalanceNumber } from 'utils/formatBalance' import { getBalanceNumber } from 'utils/formatBalance'
import { useBoardsFromPid } from 'state/hooks' import { useBoardsFromPid } from 'state/hooks'
import { useTranslation } from 'contexts/Localization' import { useTranslation } from 'contexts/Localization'
@ -52,20 +50,11 @@ const StakeAction: React.FC<NodeCardActionsProps> = ({ stakedBalance, tokenBalan
<WithdrawModal max={stakedBalance} tokenDecimals={tokenDecimals} onConfirm={onUnstake} tokenName={tokenName} />, <WithdrawModal max={stakedBalance} tokenDecimals={tokenDecimals} onConfirm={onUnstake} tokenName={tokenName} />,
) )
const handleUnstake = () => { const handleUnstake = () => {
// const unstakeDay = new Date().getDay() const unlockTime = userData.unlockTime * 1000
// const unlockTime = userData.unlockTime * 1000 if (unlockTime > new Date().getTime()) {
// // 只能周五解锁 NEED CHANGE toastWarning(t('Unlock time %unlockTime%', { unlockTime: dayjs(unlockTime).format('YYYY-MM-DD HH:mm') }))
// if (unstakeDay !== NODE_UNLOCK_TIME || unlockTime > new Date().getTime()) {
// toastWarning(
// TranslateString(101012, 'Unlock time'),
// `${dayjs(unlockTime).format('YYYY-MM-DD HH:mm')} Next Friday`, // NEED CHANGE
// )
// return // return
// } }
// if (new BigNumber(userData.stakedBalance).toJSON() !== new BigNumber(userData.xCandyBalance).toJSON()) {
// toastWarning(TranslateString(100103, 'Hint'), TranslateString(101019, 'Unlocking conditions are not met'))
// return
// }
// onUnstake() // onUnstake()
} }
const renderStakingButtons = () => { const renderStakingButtons = () => {

View File

@ -2,8 +2,8 @@ import { useCallback } from 'react'
import { ethers, Contract } from 'ethers' import { ethers, Contract } from 'ethers'
import { useBoardchef } from 'hooks/useContract' import { useBoardchef } from 'hooks/useContract'
const useApproveBoard = (lpContract: Contract) => { const useApproveBoard = (lpContract: Contract, pid) => {
const boardChefContract = useBoardchef() const boardChefContract = useBoardchef(pid)
const handleApprove = useCallback(async () => { const handleApprove = useCallback(async () => {
try { try {
const tx = await lpContract.approve(boardChefContract.address, ethers.constants.MaxUint256) const tx = await lpContract.approve(boardChefContract.address, ethers.constants.MaxUint256)

View File

@ -1,12 +1,12 @@
import { useCallback } from 'react' import { useCallback } from 'react'
import { harvestFarm } from 'utils/calls' import { harvestBoard } from 'utils/calls'
import { useBoardchef } from 'hooks/useContract' import { useBoardchef } from 'hooks/useContract'
const useHarvestBoard = (boardPid: number) => { const useHarvestBoard = (boardPid: number) => {
const boardChefContract = useBoardchef() const boardChefContract = useBoardchef(boardPid)
const handleHarvest = useCallback(async () => { const handleHarvest = useCallback(async () => {
await harvestFarm(boardChefContract, boardPid) await harvestBoard(boardChefContract, boardPid)
}, [boardPid, boardChefContract]) }, [boardPid, boardChefContract])
return { onReward: handleHarvest } return { onReward: handleHarvest }

View File

@ -1,13 +1,13 @@
import { useCallback } from 'react' import { useCallback } from 'react'
import { stakeFarm } from 'utils/calls' import { stakeBoard } from 'utils/calls'
import { useBoardchef } from 'hooks/useContract' import { useBoardchef } from 'hooks/useContract'
const useStakeBoard = (pid: number) => { const useStakeBoard = (pid: number) => {
const boardChefContract = useBoardchef() const boardChefContract = useBoardchef(pid)
const handleStake = useCallback( const handleStake = useCallback(
async (amount: string) => { async (amount: string) => {
const txHash = await stakeFarm(boardChefContract, pid, amount) const txHash = await stakeBoard(boardChefContract, pid, amount)
console.info(txHash) console.info(txHash)
}, },
[boardChefContract, pid], [boardChefContract, pid],

View File

@ -1,13 +1,13 @@
import { useCallback } from 'react' import { useCallback } from 'react'
import { unstakeFarm } from 'utils/calls' import { unstakeBoard } from 'utils/calls'
import { useBoardchef } from 'hooks/useContract' import { useBoardchef } from 'hooks/useContract'
const useUnstakeBoard = (pid: number) => { const useUnstakeBoard = (pid: number) => {
const boardChefContract = useBoardchef() const boardChefContract = useBoardchef(pid)
const handleUnstake = useCallback( const handleUnstake = useCallback(
async (amount: string) => { async (amount: string) => {
await unstakeFarm(boardChefContract, pid, amount) await unstakeBoard(boardChefContract, pid, amount)
}, },
[boardChefContract, pid], [boardChefContract, pid],
) )

View File

@ -7638,6 +7638,11 @@ date-fns@^2.0.1, date-fns@^2.21.3:
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.22.1.tgz#1e5af959831ebb1d82992bf67b765052d8f0efc4" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.22.1.tgz#1e5af959831ebb1d82992bf67b765052d8f0efc4"
integrity sha512-yUFPQjrxEmIsMqlHhAhmxkuH769baF21Kk+nZwZGyrMoyLA+LugaQtC0+Tqf9CBUUULWwUJt6Q5ySI3LJDDCGg== integrity sha512-yUFPQjrxEmIsMqlHhAhmxkuH769baF21Kk+nZwZGyrMoyLA+LugaQtC0+Tqf9CBUUULWwUJt6Q5ySI3LJDDCGg==
dayjs@^1.11.1:
version "1.11.1"
resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.11.1.tgz#90b33a3dda3417258d48ad2771b415def6545eb0"
integrity sha512-ER7EjqVAMkRRsxNCC5YqJ9d9VQYuWdGt7aiH2qA5R5wt8ZmWaP2dLUSIK6y/kVzLMlmh1Tvu5xUf4M/wdGJ5KA==
debug-fabulous@0.0.X: debug-fabulous@0.0.X:
version "0.0.4" version "0.0.4"
resolved "https://registry.yarnpkg.com/debug-fabulous/-/debug-fabulous-0.0.4.tgz#fa071c5d87484685424807421ca4b16b0b1a0763" resolved "https://registry.yarnpkg.com/debug-fabulous/-/debug-fabulous-0.0.4.tgz#fa071c5d87484685424807421ca4b16b0b1a0763"