mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-24 08:31:20 +00:00
Refactor
This commit is contained in:
parent
7526053cad
commit
f898728232
@ -80,40 +80,21 @@ export const blockReward = (nodeStatus): number => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const currentTier = (addressInfo): string => {
|
export const currentTier = (addressInfo): string | undefined => {
|
||||||
if (addressInfo.level === 0) {
|
if (addressInfo.level === 0) {
|
||||||
return html`${translate('mintingpage.mchange28')} 0
|
return '`Tier 0 (Level 0)';
|
||||||
(${translate('mintingpage.mchange27')} 0)`;
|
} else if (addressInfo.level === 1 || addressInfo.level === 2) {
|
||||||
} else if (addressInfo.level === 1) {
|
return 'Tier 1 (Level 1 + 2)';
|
||||||
return html`${translate('mintingpage.mchange28')} 1
|
} else if (addressInfo.level === 3 || addressInfo.level === 4) {
|
||||||
(${translate('mintingpage.mchange27')} 1 + 2)`;
|
return 'Tier 2 (Level 3 + 4)';
|
||||||
} else if (addressInfo.level === 2) {
|
} else if (addressInfo.level === 5 || addressInfo.level === 6) {
|
||||||
return html`${translate('mintingpage.mchange28')} 1
|
return 'Tier 3 (Level 5 + 6)';
|
||||||
(${translate('mintingpage.mchange27')} 1 + 2)`;
|
} else if (addressInfo.level === 7 || addressInfo.level === 8) {
|
||||||
} else if (addressInfo.level === 3) {
|
return 'Tier 4 (Level 7 + 8)';
|
||||||
return html`${translate('mintingpage.mchange28')} 2
|
} else if (addressInfo.level === 9 || addressInfo.level === 10) {
|
||||||
(${translate('mintingpage.mchange27')} 3 + 4)`;
|
return 'Tier 5 (Level 9 + 10)';
|
||||||
} else if (addressInfo.level === 4) {
|
} else {
|
||||||
return html`${translate('mintingpage.mchange28')} 2
|
return undefined; // fallback: should never reach this point
|
||||||
(${translate('mintingpage.mchange27')} 3 + 4)`;
|
|
||||||
} else if (addressInfo.level === 5) {
|
|
||||||
return html`${translate('mintingpage.mchange28')} 3
|
|
||||||
(${translate('mintingpage.mchange27')} 5 + 6)`;
|
|
||||||
} else if (addressInfo.level === 6) {
|
|
||||||
return html`${translate('mintingpage.mchange28')} 3
|
|
||||||
(${translate('mintingpage.mchange27')} 5 + 6)`;
|
|
||||||
} else if (addressInfo.level === 7) {
|
|
||||||
return html`${translate('mintingpage.mchange28')} 4
|
|
||||||
(${translate('mintingpage.mchange27')} 7 + 8)`;
|
|
||||||
} else if (addressInfo.level === 8) {
|
|
||||||
return html`${translate('mintingpage.mchange28')} 4
|
|
||||||
(${translate('mintingpage.mchange27')} 7 + 8)`;
|
|
||||||
} else if (addressInfo.level === 9) {
|
|
||||||
return html`${translate('mintingpage.mchange28')} 5
|
|
||||||
(${translate('mintingpage.mchange27')} 9 + 10)`;
|
|
||||||
} else if (addressInfo.level === 10) {
|
|
||||||
return html`${translate('mintingpage.mchange28')} 5
|
|
||||||
(${translate('mintingpage.mchange27')} 9 + 10)`;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -161,6 +142,203 @@ export const tierPercent = (addressInfo, tier4Online): number | undefined => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// _countLevels() {
|
||||||
|
// if (this.addressInfo.level === 0) {
|
||||||
|
// let countTier0 = (this.addressLevel[0].count).toString()
|
||||||
|
// return '' + countTier0
|
||||||
|
// } else if (this.addressInfo.level === 1) {
|
||||||
|
// let countTier10 = (this.addressLevel[1].count + this.addressLevel[2].count).toString()
|
||||||
|
// return '' + countTier10
|
||||||
|
// } else if (this.addressInfo.level === 2) {
|
||||||
|
// let countTier11 = (this.addressLevel[1].count + this.addressLevel[2].count).toString()
|
||||||
|
// return '' + countTier11
|
||||||
|
// } else if (this.addressInfo.level === 3) {
|
||||||
|
// let countTier20 = (this.addressLevel[3].count + this.addressLevel[4].count).toString()
|
||||||
|
// return '' + countTier20
|
||||||
|
// } else if (this.addressInfo.level === 4) {
|
||||||
|
// let countTier21 = (this.addressLevel[3].count + this.addressLevel[4].count).toString()
|
||||||
|
// return '' + countTier21
|
||||||
|
// } else if (this.addressInfo.level === 5) {
|
||||||
|
// if (this.tier4Online < 30) {
|
||||||
|
// let countTier30 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||||
|
// return '' + countTier30
|
||||||
|
// } else {
|
||||||
|
// let countTier30 = (this.addressLevel[5].count + this.addressLevel[6].count).toString()
|
||||||
|
// return '' + countTier30
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 6) {
|
||||||
|
// if (this.tier4Online < 30) {
|
||||||
|
// let countTier31 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||||
|
// return '' + countTier31
|
||||||
|
// } else {
|
||||||
|
// let countTier31 = (this.addressLevel[5].count + this.addressLevel[6].count).toString()
|
||||||
|
// return '' + countTier31
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 7) {
|
||||||
|
// if (this.tier4Online < 30) {
|
||||||
|
// let countTier40 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||||
|
// return '' + countTier40
|
||||||
|
// } else {
|
||||||
|
// let countTier40 = (this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||||
|
// return '' + countTier40
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 8) {
|
||||||
|
// if (this.tier4Online < 30) {
|
||||||
|
// let countTier40 = (this.addressLevel[5].count + this.addressLevel[6].count + this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||||
|
// return '' + countTier40
|
||||||
|
// } else {
|
||||||
|
// let countTier41 = (this.addressLevel[7].count + this.addressLevel[8].count).toString()
|
||||||
|
// return '' + countTier41
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 9) {
|
||||||
|
// let countTier50 = (this.addressLevel[9].count + this.addressLevel[10].count).toString()
|
||||||
|
// return '' + countTier50
|
||||||
|
// } else if (this.addressInfo.level === 10) {
|
||||||
|
// let countTier51 = (this.addressLevel[9].count + this.addressLevel[10].count).toString()
|
||||||
|
// return '' + countTier51
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// _countReward() {
|
||||||
|
// if (this.addressInfo.level === 0) {
|
||||||
|
// return '0'
|
||||||
|
// } else if (this.addressInfo.level === 1) {
|
||||||
|
// let countReward10 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count)).toFixed(8)
|
||||||
|
// let countReward11 = (countReward10).toString()
|
||||||
|
// return '' + countReward11
|
||||||
|
// } else if (this.addressInfo.level === 2) {
|
||||||
|
// let countReward20 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count)).toFixed(8)
|
||||||
|
// let countReward21 = (countReward20).toString()
|
||||||
|
// return '' + countReward21
|
||||||
|
// } else if (this.addressInfo.level === 3) {
|
||||||
|
// let countReward30 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count)).toFixed(8)
|
||||||
|
// let countReward31 = (countReward30).toString()
|
||||||
|
// return '' + countReward31
|
||||||
|
// } else if (this.addressInfo.level === 4) {
|
||||||
|
// let countReward40 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count)).toFixed(8)
|
||||||
|
// let countReward41 = (countReward40).toString()
|
||||||
|
// return '' + countReward41
|
||||||
|
// } else if (this.addressInfo.level === 5) {
|
||||||
|
// 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)
|
||||||
|
// let countReward51 = (countReward50).toString()
|
||||||
|
// return '' + countReward51
|
||||||
|
// } else {
|
||||||
|
// let countReward50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count)).toFixed(8)
|
||||||
|
// let countReward51 = (countReward50).toString()
|
||||||
|
// return '' + countReward51
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 6) {
|
||||||
|
// 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)
|
||||||
|
// let countReward61 = (countReward60).toString()
|
||||||
|
// return '' + countReward61
|
||||||
|
// } else {
|
||||||
|
// let countReward60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count)).toFixed(8)
|
||||||
|
// let countReward61 = (countReward60).toString()
|
||||||
|
// return '' + countReward61
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 7) {
|
||||||
|
// 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)
|
||||||
|
// let countReward71 = (countReward70).toString()
|
||||||
|
// return '' + countReward71
|
||||||
|
// } else {
|
||||||
|
// let countReward70 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8)
|
||||||
|
// let countReward71 = (countReward70).toString()
|
||||||
|
// return '' + countReward71
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 8) {
|
||||||
|
// 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)
|
||||||
|
// let countReward81 = (countReward80).toString()
|
||||||
|
// return '' + countReward81
|
||||||
|
// } else {
|
||||||
|
// let countReward80 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count)).toFixed(8)
|
||||||
|
// let countReward81 = (countReward80).toString()
|
||||||
|
// return '' + countReward81
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 9) {
|
||||||
|
// let countReward90 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count)).toFixed(8)
|
||||||
|
// let countReward91 = (countReward90).toString()
|
||||||
|
// return '' + countReward91
|
||||||
|
// } else if (this.addressInfo.level === 10) {
|
||||||
|
// let countReward100 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count)).toFixed(8)
|
||||||
|
// let countReward101 = (countReward100).toString()
|
||||||
|
// return '' + countReward101
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// _countRewardDay() {
|
||||||
|
// if (this.addressInfo.level === 0) {
|
||||||
|
// return '0'
|
||||||
|
// } else if (this.addressInfo.level === 1) {
|
||||||
|
// let countRewardDay10 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count) * this._timeCalc()).toFixed(8)
|
||||||
|
// let countRewardDay11 = (countRewardDay10).toString()
|
||||||
|
// return '' + countRewardDay11
|
||||||
|
// } else if (this.addressInfo.level === 2) {
|
||||||
|
// let countRewardDay20 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[1].count + this.addressLevel[2].count) * this._timeCalc()).toFixed(8)
|
||||||
|
// let countRewardDay21 = (countRewardDay20).toString()
|
||||||
|
// return '' + countRewardDay21
|
||||||
|
// } else if (this.addressInfo.level === 3) {
|
||||||
|
// let countRewardDay30 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count) * this._timeCalc()).toFixed(8)
|
||||||
|
// let countRewardDay31 = (countRewardDay30).toString()
|
||||||
|
// return '' + countRewardDay31
|
||||||
|
// } else if (this.addressInfo.level === 4) {
|
||||||
|
// let countRewardDay40 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[3].count + this.addressLevel[4].count) * this._timeCalc()).toFixed(8)
|
||||||
|
// let countRewardDay41 = (countRewardDay40).toString()
|
||||||
|
// return '' + countRewardDay41
|
||||||
|
// } else if (this.addressInfo.level === 5) {
|
||||||
|
// 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)
|
||||||
|
// let countRewardDay51 = (countRewardDay50).toString()
|
||||||
|
// return '' + countRewardDay51
|
||||||
|
// } else {
|
||||||
|
// let countRewardDay50 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count) * this._timeCalc()).toFixed(8)
|
||||||
|
// let countRewardDay51 = (countRewardDay50).toString()
|
||||||
|
// return '' + countRewardDay51
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 6) {
|
||||||
|
// 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)
|
||||||
|
// let countRewardDay61 = (countRewardDay60).toString()
|
||||||
|
// return '' + countRewardDay61
|
||||||
|
// } else {
|
||||||
|
// let countRewardDay60 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[5].count + this.addressLevel[6].count) * this._timeCalc()).toFixed(8)
|
||||||
|
// let countRewardDay61 = (countRewardDay60).toString()
|
||||||
|
// return '' + countRewardDay61
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 7) {
|
||||||
|
// 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)
|
||||||
|
// let countRewardDay71 = (countRewardDay70).toString()
|
||||||
|
// return '' + countRewardDay71
|
||||||
|
// } else {
|
||||||
|
// let countRewardDay70 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8)
|
||||||
|
// let countRewardDay71 = (countRewardDay70).toString()
|
||||||
|
// return '' + countRewardDay71
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 8) {
|
||||||
|
// 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)
|
||||||
|
// let countRewardDay81 = (countRewardDay80).toString()
|
||||||
|
// return '' + countRewardDay81
|
||||||
|
// } else {
|
||||||
|
// let countRewardDay80 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[7].count + this.addressLevel[8].count) * this._timeCalc()).toFixed(8)
|
||||||
|
// let countRewardDay81 = (countRewardDay80).toString()
|
||||||
|
// return '' + countRewardDay81
|
||||||
|
// }
|
||||||
|
// } else if (this.addressInfo.level === 9) {
|
||||||
|
// let countRewardDay90 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count) * this._timeCalc()).toFixed(8)
|
||||||
|
// let countRewardDay91 = (countRewardDay90).toString()
|
||||||
|
// return '' + countRewardDay91
|
||||||
|
// } else if (this.addressInfo.level === 10) {
|
||||||
|
// let countRewardDay100 = ((this._blockReward() / 100 * this._tierPercent()) / (this.addressLevel[9].count + this.addressLevel[10].count) * this._timeCalc()).toFixed(8)
|
||||||
|
// let countRewardDay101 = (countRewardDay100).toString()
|
||||||
|
// return '' + countRewardDay101
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
export const averageBlockTime = (adminInfo, nodeHeightBlock) => {
|
export const averageBlockTime = (adminInfo, nodeHeightBlock) => {
|
||||||
const avgBlock = adminInfo.currentTimestamp - nodeHeightBlock.timestamp;
|
const avgBlock = adminInfo.currentTimestamp - nodeHeightBlock.timestamp;
|
||||||
const averageTime = avgBlock / 1000 / 1440;
|
const averageTime = avgBlock / 1000 / 1440;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user