diff --git a/src/localServer/define.d.ts b/src/localServer/define.d.ts index 0a4a45f..b59a5f7 100644 --- a/src/localServer/define.d.ts +++ b/src/localServer/define.d.ts @@ -255,12 +255,6 @@ interface conet_tokens { CONETianPlan?: { Guardian: CryptoAsset - Sentinel: CryptoAsset - Conetian: CryptoAsset - Pioneer: CryptoAsset - Pioneer_referrer: CryptoAsset - Conetian_referrer: CryptoAsset - Sentinel_referrer: CryptoAsset Guardian_referrer: CryptoAsset } } diff --git a/src/localServer/workers/utilities/smartContractABI.ts b/src/localServer/workers/utilities/smartContractABI.ts index 10f2cd3..23b26c3 100644 --- a/src/localServer/workers/utilities/smartContractABI.ts +++ b/src/localServer/workers/utilities/smartContractABI.ts @@ -4211,19 +4211,6 @@ const CONETianPlan_ABI = [ "name": "URI", "type": "event" }, - { - "inputs": [], - "name": "Conetian", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "Guardian", @@ -4239,20 +4226,7 @@ const CONETianPlan_ABI = [ }, { "inputs": [], - "name": "Pioneer", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "Sentinel", + "name": "GuardianReferrer", "outputs": [ { "internalType": "uint256", @@ -4438,7 +4412,7 @@ const CONETianPlan_ABI = [ "outputs": [ { "internalType": "bool", - "name": "", + "name": "existNFT", "type": "bool" } ], @@ -4447,49 +4421,12 @@ const CONETianPlan_ABI = [ }, { "inputs": [], - "name": "getAllLeft", + "name": "getAvailableBalance", "outputs": [ { - "internalType": "uint256[4]", - "name": "nft", - "type": "uint256[4]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAllSupply", - "outputs": [ - { - "internalType": "uint256[4]", - "name": "nft", - "type": "uint256[4]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "getAssets", - "outputs": [ - { - "internalType": "uint256[4]", - "name": "nft", - "type": "uint256[4]" - }, - { - "internalType": "uint256[4]", - "name": "nft_referrer", - "type": "uint256[4]" + "internalType": "uint256", + "name": "available", + "type": "uint256" } ], "stateMutability": "view", @@ -4557,19 +4494,6 @@ const CONETianPlan_ABI = [ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "maxConetian", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "maxGuardian", @@ -4583,51 +4507,6 @@ const CONETianPlan_ABI = [ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "maxPioneer", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxSentinel", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "maxSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -4635,20 +4514,20 @@ const CONETianPlan_ABI = [ "name": "to", "type": "address" }, - { - "internalType": "address", - "name": "_referrer", - "type": "address" - }, { "internalType": "string", "name": "_tx", "type": "string" }, { - "internalType": "uint256[]", + "internalType": "uint256", "name": "values", - "type": "uint256[]" + "type": "uint256" + }, + { + "internalType": "address", + "name": "_referrer", + "type": "address" } ], "name": "mint", @@ -4843,25 +4722,6 @@ const CONETianPlan_ABI = [ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { diff --git a/src/localServer/workers/utilities/utilV2.ts b/src/localServer/workers/utilities/utilV2.ts index cc11daf..46330d6 100644 --- a/src/localServer/workers/utilities/utilV2.ts +++ b/src/localServer/workers/utilities/utilV2.ts @@ -75,27 +75,12 @@ const claimable_BNB = '0xBE8184294613a6f2531A7EA996deD57cb8CAeB0B' const claimable_ETH = '0xAD7dEC79BC005F699Ef80EB53fF1a7E21E24A456' const claimable_Arb_ETH = '0xF406385E1A0389Ae35684D27c3Ef2799E88E2c4A' const claimable_Arb_USDT = '0xF40A8EFc8Dd47929ba8Ee9d5B3f1534239E930Fe' -const CONETianPlanAddr = '0x27B9043873dE8684822DEC12F90bAE08f6a06657' +const CONETianPlanAddr = '0x6365DbbeeC743d14eA3BC4823E53bf6a7984bf70' const Guardian = 0 -const Sentinel = 1 -const Conetian = 2 -const Pioneer = 3 - -const maxGuardian = 250 -const maxSentinel = 1000 -const maxConetian = 2000 -const maxPioneer = 5000 - -const Guardian_referrer = 100 -const Sentinel_referrer = 101 -const Conetian_referrer = 102 -const Pioneer_referrer = 103 - -const GuardianPriceUSDT = 1200 -const SentinelPriceUSDT = 700 -const ConetianPriceUSDT = 500 -const PioneerPriceUSDT = 100 +const maxGuardian = 30000 +const Guardian_referrer = 10 +const GuardianPriceUSDT = 100 // ****************************************************************** const getAddress = (addr) => { diff --git a/src/localServer/workers/utilities/web3Util.ts b/src/localServer/workers/utilities/web3Util.ts index c52aca1..00c70c2 100644 --- a/src/localServer/workers/utilities/web3Util.ts +++ b/src/localServer/workers/utilities/web3Util.ts @@ -342,7 +342,7 @@ const getProfileAssets_CONET_Balance = async (profile: profile) => { CNTPV1, cCNTP, conet, cBNBUSDT, cUSDT, cBNB, cETH, cArbETH, cArbUSDT, CGPNs, CGPN2s, - CONETianPlan + _CONETianPlan ] = await Promise.all([ //scanCNTP (key, provideBlastMainChain), scanCNTPV1(key), @@ -510,98 +510,34 @@ const getProfileAssets_CONET_Balance = async (profile: profile) => { name: 'CGPN2s' } } - // @ts-ignore - const CONETianData: BigInt[][] = CONETianPlan.result - // @ts-ignore - const CONETianDataBalance = CONETianPlan.total - if (CONETianPlan !== false) { + //@ts-ignore + const CONETianData:{balanceGuardian: BigInt, balanceReferrer: BigInt, availableBalance: BigInt}|false = _CONETianPlan + + // {balanceGuardian, balanceReferrer, availableBalance} + if (CONETianData !== false) { if (current.CONETianPlan) { - current.CONETianPlan.Guardian.balance = CONETianData[0][Guardian].toString() - current.CONETianPlan.Sentinel.balance = CONETianData[0][Sentinel].toString() - current.CONETianPlan.Conetian.balance = CONETianData[0][Conetian].toString() - current.CONETianPlan.Pioneer.balance = CONETianData[0][Pioneer].toString() - current.CONETianPlan.Guardian.totalSupply = (maxGuardian - parseInt(CONETianDataBalance[Guardian].toString())).toFixed(0) - current.CONETianPlan.Sentinel.totalSupply = (maxSentinel - parseInt(CONETianDataBalance[Sentinel].toString())).toFixed(0) - current.CONETianPlan.Conetian.totalSupply = (maxConetian - parseInt(CONETianDataBalance[Conetian].toString())).toFixed(0) - current.CONETianPlan.Pioneer.totalSupply = (maxPioneer - parseInt(CONETianDataBalance[Pioneer].toString())).toFixed(0) - current.CONETianPlan.Guardian_referrer.balance = CONETianData[1][Guardian].toString() - current.CONETianPlan.Sentinel_referrer.balance = CONETianData[1][Sentinel].toString() - current.CONETianPlan.Conetian_referrer.balance = CONETianData[1][Conetian].toString() - current.CONETianPlan.Pioneer_referrer.balance = CONETianData[1][Pioneer].toString() - + current.CONETianPlan.Guardian.balance = CONETianData.balanceGuardian.toString() + current.CONETianPlan.Guardian.totalSupply = (maxGuardian - parseInt(CONETianData.availableBalance.toString())).toFixed(0) + current.CONETianPlan.Guardian_referrer.balance = CONETianData.balanceReferrer.toString() } else { current.CONETianPlan = { Guardian: { - balance: CONETianData[0][Guardian].toString(), + balance: CONETianData.balanceGuardian.toString(), history: [], network: 'CONET Holesky', decimal: Guardian, contract: CONETianPlanAddr, name: 'Guardian', supplyMaximum: maxGuardian.toString(), - totalSupply: (maxGuardian - parseInt(CONETianDataBalance[Guardian].toString())).toFixed(0), - }, - Sentinel: { - balance: CONETianData[0][Sentinel].toString(), - history: [], - network: 'CONET Holesky', - decimal: Sentinel, - contract: CONETianPlanAddr, - name: 'Sentinel', - supplyMaximum: maxSentinel.toString(), - totalSupply: (maxSentinel - parseInt(CONETianDataBalance[Sentinel].toString())).toFixed(0) - }, - Conetian: { - balance: CONETianData[0][Conetian].toString(), - history: [], - network: 'CONET Holesky', - decimal: Conetian, - contract: CONETianPlanAddr, - name: 'Conetian', - supplyMaximum: maxConetian.toString(), - totalSupply: (maxConetian - parseInt(CONETianDataBalance[Conetian].toString())).toFixed(0) - }, - Pioneer: { - balance: CONETianData[0][Pioneer].toString(), - history: [], - network: 'CONET Holesky', - decimal: Pioneer, - contract: CONETianPlanAddr, - name: 'Pioneer', - supplyMaximum: maxPioneer.toString(), - totalSupply: (maxPioneer - parseInt(CONETianDataBalance[Pioneer].toString())).toFixed(0) + totalSupply: (maxGuardian - parseInt(CONETianData.availableBalance.toString())).toFixed(0) }, Guardian_referrer: { - balance: CONETianData[1][Guardian].toString(), + balance: CONETianData.balanceReferrer.toString(), history: [], network: 'CONET Holesky', decimal: Guardian_referrer, contract: CONETianPlanAddr, name: 'Guardian_referrer' - }, - Sentinel_referrer: { - balance: CONETianData[1][Sentinel].toString(), - history: [], - network: 'CONET Holesky', - decimal: Sentinel_referrer, - contract: CONETianPlanAddr, - name: 'Sentinel_referrer' - }, - Conetian_referrer: { - balance: CONETianData[1][Conetian].toString(), - history: [], - network: 'CONET Holesky', - decimal: Conetian_referrer, - contract: CONETianPlanAddr, - name: 'Conetian_referrer' - }, - Pioneer_referrer: { - balance: CONETianData[1][Pioneer].toString(), - history: [], - network: 'CONET Holesky', - decimal: Pioneer_referrer, - contract: CONETianPlanAddr, - name: 'Pioneer_referrer' } } @@ -2113,10 +2049,14 @@ const scan_Guardian_ReferralNodes = async (walletAddr) => { const scan_CONETianPlanAddr = async (walletAddr) => new Promise(async resolve => { const CONETianPlanContract = new ethers.Contract(CONETianPlanAddr, CONETianPlan_ABI, provideCONET) try { - const result = await CONETianPlanContract.getAssets(walletAddr) - const total = await CONETianPlanContract.getAllLeft() - return resolve({result, total}) - }catch (ex) { + const [balanceGuardian, balanceReferrer, availableBalance] = await Promise.all([ + CONETianPlanContract.balanceOf(walletAddr, Guardian), + CONETianPlanContract.balanceOf(walletAddr, Guardian_referrer), + CONETianPlanContract.getAvailableBalance() + ]) + + return resolve({balanceGuardian, balanceReferrer, availableBalance}) + } catch (ex) { resolve (false) } })