更新合约, 修改获取白单数量的方法, 修改白单提示文字
This commit is contained in:
parent
b698d63c31
commit
e7613a4c35
@ -6,4 +6,4 @@ VITE_TOKENID_ID='0x34a1'
|
||||
VITE_ERC_ADDRESS='0xFd42bfb03212dA7e1A4608a44d7658641D99CF34'
|
||||
VITE_CFNFT_ADDRESS='0xaa34B79A0Ab433eaC900fB3CB9f191F5Cd27501D'
|
||||
VITE_CLAIM_ADDRESS='0xf45702180314187a3549FEDac3B78349b47ca6A0'
|
||||
VITE_CLAIMWL_ADDRESS='0x20204A3df0c3191Ee93f4DB328Ca92aEe148Ce24'
|
||||
VITE_CLAIMWL_ADDRESS='0xc43Efb17C24e4e027d3F2613DB858181abE2994e'
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,5 @@
|
||||
const MINT_CONTRACT_ADDRESS='0x31f29c9a3d0c1c13c825475aebf0d964b5b47c45'
|
||||
|
||||
const MINT_CONTRACT_ADDRESS=import.meta.env.VITE_CLAIMWL_ADDRESS
|
||||
const RPC='https://rpc.testnet.immutable.com/'
|
||||
|
||||
const requestChain = async (rpc, method, params) => {
|
||||
@ -8,14 +9,20 @@ const requestChain = async (rpc, method, params) => {
|
||||
method,
|
||||
params,
|
||||
}
|
||||
const options: any = {
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
}
|
||||
return fetch(rpc, options, DEFAULT_TIMEOUT).then(res => res.json())
|
||||
const res = await fetch(rpc, options)
|
||||
const json = await res.json()
|
||||
console.log(json)
|
||||
if (json.error) {
|
||||
throw new Error(json.error.message)
|
||||
}
|
||||
return json.result
|
||||
}
|
||||
|
||||
const queryMintData = async(user, data) => {
|
||||
@ -28,9 +35,13 @@ const queryMintData = async(user, data) => {
|
||||
}
|
||||
// 当前用户白单数量
|
||||
|
||||
const fetchWLCount = async(user) => {
|
||||
const data = '0xe65ee803'
|
||||
return queryMintData(user, data)
|
||||
export const queryMintStatus = async(user) => {
|
||||
const data = '0x2c560ec0'
|
||||
const res = await queryMintData(user, data)
|
||||
// remove '0x', split with 64 length
|
||||
let nums = res.slice(2).match(/.{64}/g)
|
||||
nums = nums.map(o => parseInt(o));
|
||||
return nums
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -189,9 +189,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isOpenClaim == 2" class="amount">
|
||||
<span>Boom! You are on the whitelist</span>
|
||||
<span>{{statusTxt}}</span>
|
||||
</div>
|
||||
<div v-if="isOpenClaim == 1" class="amount">You are not on the whitelist</div>
|
||||
<div v-if="isOpenClaim == 1" class="amount">{{statusTxt}}</div>
|
||||
</div>
|
||||
<div class="join-btm-right" @click="hasNot">
|
||||
<div
|
||||
@ -247,9 +247,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isOpenClaim == 2" class="amount">
|
||||
<span>Boom! You are on the whitelist</span>
|
||||
<span>{{statusTxt}}</span>
|
||||
</div>
|
||||
<div v-if="isOpenClaim == 1" class="amount">You are not on the whitelist</div>
|
||||
<div v-if="isOpenClaim == 1" class="amount">{{statusTxt}}</div>
|
||||
</div>
|
||||
<div v-if="!getAddress" class="join-btm-right">
|
||||
<div
|
||||
@ -434,9 +434,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isOpenClaim == 2" class="amount">
|
||||
<span>Boom! You are on the whitelist</span>
|
||||
<span>{{statusTxt}}</span>
|
||||
</div>
|
||||
<div v-if="isOpenClaim == 1" class="amount">You are not on the whitelist</div>
|
||||
<div v-if="isOpenClaim == 1" class="amount">{{statusTxt}}</div>
|
||||
</div>
|
||||
<div v-if="!getAddress" class="join-btm-right">
|
||||
<div
|
||||
@ -1005,9 +1005,25 @@ const mintTotal = ref(1);
|
||||
const thisMintTotal = ref(0);
|
||||
// 是否在白名单和是否已经打开
|
||||
const isOpenClaim = ref(0);
|
||||
const statusTxt = ref('');
|
||||
const getIsWhite = async () => {
|
||||
if (getAddress.value) {
|
||||
let whiteAmount = await fetchWLCount("ethereum", getAddress.value)
|
||||
const [num1, num2, minted] = await fetchWLCount(getAddress.value)
|
||||
if (num1 > 0 && num2 > 0) {
|
||||
statusTxt.value = 'Eligible for minting in Guaranteed and FCFS rounds'
|
||||
} else if (num1 > 0) {
|
||||
statusTxt.value = 'Boom! you are on the Guaranteed Whitelist'
|
||||
} else if (num2 > 0) {
|
||||
statusTxt.value = 'Congrats,you are on the fcfs whitelist'
|
||||
} else {
|
||||
statusTxt.value = 'Regrettably, you are not on the whitelist'
|
||||
}
|
||||
let whiteAmount = num1 - minted
|
||||
// 第2阶段开启后, 可mint总数等于必中白和幸运白的总数
|
||||
if (activityState.value === 2) {
|
||||
whiteAmount = num1 + num2 - minted
|
||||
}
|
||||
whiteAmount = whiteAmount < 0 ? 0 : whiteAmount
|
||||
console.log(whiteAmount,'whiteAmount-------')
|
||||
if(whiteAmount > 0) {
|
||||
whiteCount.value = whiteAmount;
|
||||
|
@ -4,6 +4,7 @@ import ERC_abi from './../abi/ImmutableERC20MinterBurnerPermit.json'
|
||||
import CFNFT_abi from './../abi/CFNFTGame.json'
|
||||
import CLAIM_abi from './../abi/NFTClaimStage2.json'
|
||||
import CLAIMWL_abi from './../abi/NFTClaimStage2WL.json'
|
||||
import { queryMintStatus } from '../abi/mint.js'
|
||||
var abis = {
|
||||
"ERC": ERC_abi,
|
||||
"CFNFT": CFNFT_abi,
|
||||
@ -18,7 +19,7 @@ var chainId = import.meta.env.VITE_TOKENID_ID
|
||||
// var connectUrl = process.env.VUE_APP_CONFIG_URL
|
||||
|
||||
// 公用方法
|
||||
const MINT_CONTRACT_ADDRESS = '0x31f29c9a3d0c1c13c825475aebf0d964b5b47c45'
|
||||
const MINT_CONTRACT_ADDRESS = claimWlAddress
|
||||
const RPC = 'https://rpc.testnet.immutable.com/'
|
||||
|
||||
const requestChain = async (rpc, method, params) => {
|
||||
@ -266,18 +267,10 @@ export const mintConfig = async (name, myAddress) => {
|
||||
}
|
||||
|
||||
// 当前用户白单数量
|
||||
export const fetchWLCount = async (name, myAddress) => {
|
||||
let web3
|
||||
if (name == 'ethereum') {
|
||||
web3 = new Web3(window.ethereum);
|
||||
} else if (name == 'okxwallet') {
|
||||
web3 = new Web3(okxwallet)
|
||||
} else if (name == 'connect') {
|
||||
web3 = new Web3(provider)
|
||||
}
|
||||
let contract = new web3.eth.Contract(abis['CLAIMWL'].abi, claimWlAddress, { from: myAddress })
|
||||
const tokenId = await contract.methods.whiteCount(myAddress).call();
|
||||
return parseInt(tokenId)
|
||||
export const fetchWLCount = async (myAddress) => {
|
||||
const nums = await queryMintStatus(myAddress)
|
||||
console.log(nums)
|
||||
return nums
|
||||
}
|
||||
|
||||
// 当前用户已获得的数量
|
||||
|
@ -23,5 +23,5 @@ const passportInit = app => {
|
||||
app.config.globalProperties.$passportInit = passportInstance
|
||||
// app.provide('passportInit', passportInit)
|
||||
}
|
||||
passportInstance.loginCallback()
|
||||
passportInstance.loginCallback().then(()=>{}).catch(err=>{console.log(err,'passportInit')})
|
||||
export default passportInit
|
||||
|
Loading…
x
Reference in New Issue
Block a user