feat: 修改邀请
This commit is contained in:
parent
77d6a61640
commit
bd09158250
|
|
@ -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: '0x38bafe75a90bc310b8b5058be3ba6511c3bc215b',
|
97: '0x7e64aac0806597cb2efddf7c001e59d6b4e9cb15',
|
||||||
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约
|
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约
|
||||||
},
|
},
|
||||||
holderChef: {
|
holderChef: {
|
||||||
97: '0x0584becc972bb2171502a2b54e9f52656b707d35',
|
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: {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,13 @@ export const withdrawReward = () => {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export const checkWithdrawResult = (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({
|
||||||
|
|
|
||||||
|
|
@ -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 { getReferralInfo } from 'services/referral'
|
||||||
import { ReferralInfo, ReferralConfigType } from 'types/referral'
|
import { ReferralInfo, ReferralConfigType } 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,11 @@ const initialState: ReferralState = {
|
||||||
isCommander: false,
|
isCommander: false,
|
||||||
rewardInfo: {},
|
rewardInfo: {},
|
||||||
}
|
}
|
||||||
|
const payWayList = {
|
||||||
|
usdt: tokens.usdt,
|
||||||
|
// bnb: tokens.bnb,
|
||||||
|
hcc: tokens.hcc,
|
||||||
|
}
|
||||||
export const referralSlice = createSlice({
|
export const referralSlice = createSlice({
|
||||||
name: 'Referral',
|
name: 'Referral',
|
||||||
initialState,
|
initialState,
|
||||||
|
|
@ -41,4 +51,18 @@ export const fetchReferralInfoAsync = (account) => async (dispatch) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 parsedLpAllowances
|
||||||
|
}
|
||||||
|
|
||||||
export default referralSlice.reducer
|
export default referralSlice.reducer
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,9 @@ export const useBuyTransaction = () => {
|
||||||
const referralContract = useReferralchef()
|
const referralContract = useReferralchef()
|
||||||
const transaction = async () => {
|
const transaction = async () => {
|
||||||
const data = await withdrawReward()
|
const data = await withdrawReward()
|
||||||
const { to, amount, code, signature } = data
|
const { address, receive, timestamp, sign } = data
|
||||||
console.log(data)
|
const params = [address, receive, timestamp, sign]
|
||||||
const params = [to, amount, code, signature]
|
const price = getDecimalAmountNumber(receive)
|
||||||
const price = getDecimalAmountNumber(amount)
|
|
||||||
const res = await referralContract.adminMint(...params, { value: price })
|
const res = await referralContract.adminMint(...params, { value: price })
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
@ -44,10 +43,9 @@ export const useWithdraw = () => {
|
||||||
const referralRewardContract = useReferralRewardchef()
|
const referralRewardContract = useReferralRewardchef()
|
||||||
const transaction = async () => {
|
const transaction = async () => {
|
||||||
const data = await withdrawReward()
|
const data = await withdrawReward()
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue