Porting function for calculation countMintersInLevel

This commit is contained in:
Nicola Benaglia 2025-06-20 16:40:46 +02:00
parent fd7aadf367
commit aff7186674
2 changed files with 190 additions and 163 deletions

View File

@ -50,6 +50,7 @@ import {
levelUpBlocks, levelUpBlocks,
levelUpDays, levelUpDays,
mintingStatus, mintingStatus,
countMintersInLevel,
} from './MintingStats.tsx'; } from './MintingStats.tsx';
export const Minting = ({ setIsOpenMinting, myAddress, show }) => { export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
@ -733,7 +734,11 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
/> />
<StatCard <StatCard
label="Total Minters in The Tier" label="Total Minters in The Tier"
value="77 Minters" value={countMintersInLevel(
accountInfo?.level,
addressLevel,
tier4Online
)?.toFixed(0)}
/> />
<StatCard label="Tier Share Per Block" value="13%" /> <StatCard label="Tier Share Per Block" value="13%" />
<StatCard <StatCard

View File

@ -144,200 +144,222 @@ export const tierPercent = (accountInfo, tier4Online): number | undefined => {
} }
}; };
// _countLevels() { export const countMintersInLevel = (
// if (this.accountInfo.level === 0) { level,
// let countTier0 = (this.addressLevel[0].count).toString() addressLevel,
// return '' + countTier0 tier4Online
// } else if (this.accountInfo.level === 1) { ): number => {
// let countTier10 = (this.addressLevel[1].count + this.addressLevel[2].count).toString() if (level === 0) {
// return '' + countTier10 const countTier0 = addressLevel[0].count;
// } else if (this.accountInfo.level === 2) { return countTier0;
// let countTier11 = (this.addressLevel[1].count + this.addressLevel[2].count).toString() } else if (level === 1) {
// return '' + countTier11 const countTier10 = addressLevel[1].count + addressLevel[2].count;
// } else if (this.accountInfo.level === 3) { return countTier10;
// let countTier20 = (this.addressLevel[3].count + this.addressLevel[4].count).toString() } else if (level === 2) {
// return '' + countTier20 const countTier11 = addressLevel[1].count + addressLevel[2].count;
// } else if (this.accountInfo.level === 4) { return countTier11;
// let countTier21 = (this.addressLevel[3].count + this.addressLevel[4].count).toString() } else if (level === 3) {
// return '' + countTier21 const countTier20 = addressLevel[3].count + addressLevel[4].count;
// } else if (this.accountInfo.level === 5) { return countTier20;
// if (this.tier4Online < 30) { } else if (level === 4) {
// let countTier30 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString() const countTier21 = addressLevel[3].count + addressLevel[4].count;
// return '' + countTier30 return countTier21;
// } else { } else if (level === 5) {
// let countTier30 = (this.addressLevel[5].count + this.addressLevel[6].count).toString() if (tier4Online < 30) {
// return '' + countTier30 const countTier30 =
// } addressLevel[5].count +
// } else if (this.accountInfo.level === 6) { addressLevel[6].count +
// if (this.tier4Online < 30) { addressLevel[7].count +
// let countTier31 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString() addressLevel[8].count;
// return '' + countTier31 return countTier30;
// } else { } else {
// let countTier31 = (this.addressLevel[5].count + this.addressLevel[6].count).toString() const countTier30 = addressLevel[5].count + addressLevel[6].count;
// return '' + countTier31 return countTier30;
// } }
// } else if (this.accountInfo.level === 7) { } else if (level === 6) {
// if (this.tier4Online < 30) { if (tier4Online < 30) {
// let countTier40 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString() const countTier31 =
// return '' + countTier40 addressLevel[5].count +
// } else { addressLevel[6].count +
// let countTier40 = (this.addressLevel[7].count + this.addressLevel[8].count).toString() addressLevel[7].count +
// return '' + countTier40 addressLevel[8].count;
// } return countTier31;
// } else if (this.accountInfo.level === 8) { } else {
// if (this.tier4Online < 30) { const countTier31 = addressLevel[5].count + addressLevel[6].count;
// let countTier40 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString() return countTier31;
// return '' + countTier40 }
// } else { } else if (level === 7) {
// let countTier41 = (this.addressLevel[7].count + this.addressLevel[8].count).toString() if (tier4Online < 30) {
// return '' + countTier41 const countTier40 =
// } addressLevel[5].count +
// } else if (this.accountInfo.level === 9) { addressLevel[6].count +
// let countTier50 = (this.addressLevel[9].count + this.addressLevel[10].count).toString() addressLevel[7].count +
// return '' + countTier50 addressLevel[8].count;
// } else if (this.accountInfo.level === 10) { return countTier40;
// let countTier51 = (this.addressLevel[9].count + this.addressLevel[10].count).toString() } else {
// return '' + countTier51 const countTier40 = addressLevel[7].count + addressLevel[8].count;
// } return countTier40;
// } }
} else if (level === 8) {
if (tier4Online < 30) {
const countTier40 =
addressLevel[5].count +
addressLevel[6].count +
addressLevel[7].count +
addressLevel[8].count;
return countTier40;
} else {
const countTier41 = addressLevel[7].count + addressLevel[8].count;
return countTier41;
}
} else if (level === 9) {
const countTier50 = addressLevel[9].count + addressLevel[10].count;
return countTier50;
} else if (level === 10) {
const countTier51 = addressLevel[9].count + addressLevel[10].count;
return countTier51;
}
return 0; // should never reach this point
};
// _countReward() { // _countReward() {
// if (this.accountInfo.level === 0) { // if (accountInfo.level === 0) {
// return '0' // return '0'
// } else if (this.accountInfo.level === 1) { // } else if (accountInfo.level === 1) {
// let countReward10 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count)).toFixed(8) // const countReward10 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[1].count + addressLevel[2].count)).toFixed(8)
// let countReward11 = (countReward10).toString() // const countReward11 = (countReward10).toString()
// return '' + countReward11 // return countReward11
// } else if (this.accountInfo.level === 2) { // } else if (accountInfo.level === 2) {
// let countReward20 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count)).toFixed(8) // const countReward20 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[1].count + addressLevel[2].count)).toFixed(8)
// let countReward21 = (countReward20).toString() // const countReward21 = (countReward20).toString()
// return '' + countReward21 // return countReward21
// } else if (this.accountInfo.level === 3) { // } else if (accountInfo.level === 3) {
// let countReward30 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count)).toFixed(8) // const countReward30 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[3].count + addressLevel[4].count)).toFixed(8)
// let countReward31 = (countReward30).toString() // const countReward31 = (countReward30).toString()
// return '' + countReward31 // return countReward31
// } else if (this.accountInfo.level === 4) { // } else if (accountInfo.level === 4) {
// let countReward40 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count)).toFixed(8) // const countReward40 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[3].count + addressLevel[4].count)).toFixed(8)
// let countReward41 = (countReward40).toString() // const countReward41 = (countReward40).toString()
// return '' + countReward41 // return countReward41
// } else if (this.accountInfo.level === 5) { // } else if (accountInfo.level === 5) {
// if (this.tier4Online < 30) { // if (this.tier4Online < 30) {
// let countReward50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8) // const countReward50 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count + addressLevel[7].count + addressLevel[8].count)).toFixed(8)
// let countReward51 = (countReward50).toString() // const countReward51 = (countReward50).toString()
// return '' + countReward51 // return countReward51
// } else { // } else {
// let countReward50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count)).toFixed(8) // const countReward50 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count)).toFixed(8)
// let countReward51 = (countReward50).toString() // const countReward51 = (countReward50).toString()
// return '' + countReward51 // return countReward51
// } // }
// } else if (this.accountInfo.level === 6) { // } else if (accountInfo.level === 6) {
// if (this.tier4Online < 30) { // if (this.tier4Online < 30) {
// let countReward60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8) // const countReward60 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count + addressLevel[7].count + addressLevel[8].count)).toFixed(8)
// let countReward61 = (countReward60).toString() // const countReward61 = (countReward60).toString()
// return '' + countReward61 // return countReward61
// } else { // } else {
// let countReward60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count)).toFixed(8) // const countReward60 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count)).toFixed(8)
// let countReward61 = (countReward60).toString() // const countReward61 = (countReward60).toString()
// return '' + countReward61 // return countReward61
// } // }
// } else if (this.accountInfo.level === 7) { // } else if (accountInfo.level === 7) {
// if (this.tier4Online < 30) { // if (this.tier4Online < 30) {
// let countReward70 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8) // const countReward70 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count + addressLevel[7].count + addressLevel[8].count)).toFixed(8)
// let countReward71 = (countReward70).toString() // const countReward71 = (countReward70).toString()
// return '' + countReward71 // return countReward71
// } else { // } else {
// let countReward70 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8) // const countReward70 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[7].count + addressLevel[8].count)).toFixed(8)
// let countReward71 = (countReward70).toString() // const countReward71 = (countReward70).toString()
// return '' + countReward71 // return countReward71
// } // }
// } else if (this.accountInfo.level === 8) { // } else if (accountInfo.level === 8) {
// if (this.tier4Online < 30) { // if (this.tier4Online < 30) {
// let countReward80 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8) // const countReward80 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count + addressLevel[7].count + addressLevel[8].count)).toFixed(8)
// let countReward81 = (countReward80).toString() // const countReward81 = (countReward80).toString()
// return '' + countReward81 // return countReward81
// } else { // } else {
// let countReward80 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8) // const countReward80 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[7].count + addressLevel[8].count)).toFixed(8)
// let countReward81 = (countReward80).toString() // const countReward81 = (countReward80).toString()
// return '' + countReward81 // return countReward81
// } // }
// } else if (this.accountInfo.level === 9) { // } else if (accountInfo.level === 9) {
// let countReward90 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count)).toFixed(8) // const countReward90 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[9].count + addressLevel[10].count)).toFixed(8)
// let countReward91 = (countReward90).toString() // const countReward91 = (countReward90).toString()
// return '' + countReward91 // return countReward91
// } else if (this.accountInfo.level === 10) { // } else if (accountInfo.level === 10) {
// let countReward100 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count)).toFixed(8) // const countReward100 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[9].count + addressLevel[10].count)).toFixed(8)
// let countReward101 = (countReward100).toString() // const countReward101 = (countReward100).toString()
// return '' + countReward101 // return countReward101
// } // }
// } // }
// _countRewardDay() { // _countRewardDay() {
// if (this.accountInfo.level === 0) { // if (accountInfo.level === 0) {
// return '0' // return '0'
// } else if (this.accountInfo.level === 1) { // } else if (accountInfo.level === 1) {
// let countRewardDay10 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count) * this._timeCalc()).toFixed(8) // const countRewardDay10 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[1].count + addressLevel[2].count) * this._timeCalc()).toFixed(8)
// let countRewardDay11 = (countRewardDay10).toString() // const countRewardDay11 = (countRewardDay10).toString()
// return '' + countRewardDay11 // return countRewardDay11
// } else if (this.accountInfo.level === 2) { // } else if (accountInfo.level === 2) {
// let countRewardDay20 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count) * this._timeCalc()).toFixed(8) // const countRewardDay20 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[1].count + addressLevel[2].count) * this._timeCalc()).toFixed(8)
// let countRewardDay21 = (countRewardDay20).toString() // const countRewardDay21 = (countRewardDay20).toString()
// return '' + countRewardDay21 // return countRewardDay21
// } else if (this.accountInfo.level === 3) { // } else if (accountInfo.level === 3) {
// let countRewardDay30 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count) * this._timeCalc()).toFixed(8) // const countRewardDay30 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[3].count + addressLevel[4].count) * this._timeCalc()).toFixed(8)
// let countRewardDay31 = (countRewardDay30).toString() // const countRewardDay31 = (countRewardDay30).toString()
// return '' + countRewardDay31 // return countRewardDay31
// } else if (this.accountInfo.level === 4) { // } else if (accountInfo.level === 4) {
// let countRewardDay40 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count) * this._timeCalc()).toFixed(8) // const countRewardDay40 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[3].count + addressLevel[4].count) * this._timeCalc()).toFixed(8)
// let countRewardDay41 = (countRewardDay40).toString() // const countRewardDay41 = (countRewardDay40).toString()
// return '' + countRewardDay41 // return countRewardDay41
// } else if (this.accountInfo.level === 5) { // } else if (accountInfo.level === 5) {
// if (this.tier4Online < 30) { // if (this.tier4Online < 30) {
// let countRewardDay50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8) // const countRewardDay50 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count + addressLevel[7].count + addressLevel[8].count) * this._timeCalc()).toFixed(8)
// let countRewardDay51 = (countRewardDay50).toString() // const countRewardDay51 = (countRewardDay50).toString()
// return '' + countRewardDay51 // return countRewardDay51
// } else { // } else {
// let countRewardDay50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count) * this._timeCalc()).toFixed(8) // const countRewardDay50 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count) * this._timeCalc()).toFixed(8)
// let countRewardDay51 = (countRewardDay50).toString() // const countRewardDay51 = (countRewardDay50).toString()
// return '' + countRewardDay51 // return countRewardDay51
// } // }
// } else if (this.accountInfo.level === 6) { // } else if (accountInfo.level === 6) {
// if (this.tier4Online < 30) { // if (this.tier4Online < 30) {
// let countRewardDay60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8) // const countRewardDay60 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count + addressLevel[7].count + addressLevel[8].count) * this._timeCalc()).toFixed(8)
// let countRewardDay61 = (countRewardDay60).toString() // const countRewardDay61 = (countRewardDay60).toString()
// return '' + countRewardDay61 // return countRewardDay61
// } else { // } else {
// let countRewardDay60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count) * this._timeCalc()).toFixed(8) // const countRewardDay60 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count) * this._timeCalc()).toFixed(8)
// let countRewardDay61 = (countRewardDay60).toString() // const countRewardDay61 = (countRewardDay60).toString()
// return '' + countRewardDay61 // return countRewardDay61
// } // }
// } else if (this.accountInfo.level === 7) { // } else if (accountInfo.level === 7) {
// if (this.tier4Online < 30) { // if (this.tier4Online < 30) {
// let countRewardDay70 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8) // const countRewardDay70 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count + addressLevel[7].count + addressLevel[8].count) * this._timeCalc()).toFixed(8)
// let countRewardDay71 = (countRewardDay70).toString() // const countRewardDay71 = (countRewardDay70).toString()
// return '' + countRewardDay71 // return countRewardDay71
// } else { // } else {
// let countRewardDay70 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8) // const countRewardDay70 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[7].count + addressLevel[8].count) * this._timeCalc()).toFixed(8)
// let countRewardDay71 = (countRewardDay70).toString() // const countRewardDay71 = (countRewardDay70).toString()
// return '' + countRewardDay71 // return countRewardDay71
// } // }
// } else if (this.accountInfo.level === 8) { // } else if (accountInfo.level === 8) {
// if (this.tier4Online < 30) { // if (this.tier4Online < 30) {
// let countRewardDay80 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8) // const countRewardDay80 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[5].count + addressLevel[6].count + addressLevel[7].count + addressLevel[8].count) * this._timeCalc()).toFixed(8)
// let countRewardDay81 = (countRewardDay80).toString() // const countRewardDay81 = (countRewardDay80).toString()
// return '' + countRewardDay81 // return countRewardDay81
// } else { // } else {
// let countRewardDay80 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8) // const countRewardDay80 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[7].count + addressLevel[8].count) * this._timeCalc()).toFixed(8)
// let countRewardDay81 = (countRewardDay80).toString() // const countRewardDay81 = (countRewardDay80).toString()
// return '' + countRewardDay81 // return countRewardDay81
// } // }
// } else if (this.accountInfo.level === 9) { // } else if (accountInfo.level === 9) {
// let countRewardDay90 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count) * this._timeCalc()).toFixed(8) // const countRewardDay90 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[9].count + addressLevel[10].count) * this._timeCalc()).toFixed(8)
// let countRewardDay91 = (countRewardDay90).toString() // const countRewardDay91 = (countRewardDay90).toString()
// return '' + countRewardDay91 // return countRewardDay91
// } else if (this.accountInfo.level === 10) { // } else if (accountInfo.level === 10) {
// let countRewardDay100 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count) * this._timeCalc()).toFixed(8) // const countRewardDay100 = ((this._blockReward() / 100 * this._tierPercent()) / (addressLevel[9].count + addressLevel[10].count) * this._timeCalc()).toFixed(8)
// let countRewardDay101 = (countRewardDay100).toString() // const countRewardDay101 = (countRewardDay100).toString()
// return '' + countRewardDay101 // return countRewardDay101
// } // }
// } // }