no bigint rounddata + cycle improvements
This commit is contained in:
@@ -45,7 +45,8 @@
|
||||
</div>
|
||||
<div class="blood-chart-element-footer">
|
||||
<div class="blood-chart-amount">
|
||||
{{ compactNumber(coin.amount) }}
|
||||
<!-- {{ compactNumber(coin.amount) }} -->
|
||||
{{ coin.amount.toFixed(2) }}
|
||||
</div>
|
||||
<div class="blood-chart-coin">$BLOOD</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div class="claim bloodline-border bloodline-border__thin grey">
|
||||
<div class="claim-headline">You Cycle Rewards</div>
|
||||
|
||||
<div class="rewards-wrapper" v-if="!isMobile">
|
||||
<rewards-wrapper
|
||||
title="Sacrafice Reward"
|
||||
@@ -19,15 +20,25 @@
|
||||
/>
|
||||
</div>
|
||||
<div class="rewards-list" v-else>
|
||||
<rewards-wrapper title="Sacrafice Reward" coin="$BLOOD" amount="0" image="/assets/img/vampir.png" />
|
||||
<!-- <rewards-wrapper
|
||||
<rewards-wrapper
|
||||
title="Sacrafice Reward"
|
||||
coin="$BLOOD"
|
||||
:amount="getCurrentRoundData?.rewards_sacrifice.toFixed(2)"
|
||||
image="/assets/img/vampir.png"
|
||||
/>
|
||||
<rewards-wrapper
|
||||
title="Staking Bonus"
|
||||
coin="$BLOOD"
|
||||
amount="0 todo"
|
||||
:amount="getCurrentRoundData?.rewards_staking.toFixed(2)"
|
||||
info="max: 312m"
|
||||
image="/assets/img/vampir.png"
|
||||
/> -->
|
||||
<rewards-wrapper title="Clan Bonus" coin="$BLOOD" amount="0" image="/assets/img/vampir.png" />
|
||||
/>
|
||||
<rewards-wrapper
|
||||
title="Clan Bonus"
|
||||
coin="$BLOOD"
|
||||
:amount="getCurrentRoundData?.rewards_clan.toFixed(2)"
|
||||
image="/assets/img/vampir.png"
|
||||
/>
|
||||
</div>
|
||||
<div class="rewards-total-wrapper">
|
||||
<div class="rewards-total-headline">Total Reward</div>
|
||||
@@ -35,7 +46,7 @@
|
||||
<div class="rewards-body">
|
||||
<div class="rewards-coin">$BLOOD</div>
|
||||
<div class="rewards-amount" v-if="activeRound === currentRound">0</div>
|
||||
<div class="rewards-amount" v-else>todo</div>
|
||||
<div class="rewards-amount" v-else>{{ getCurrentRoundData?.rewards_total }}</div>
|
||||
</div>
|
||||
<img class="bloodline-token" src="/assets/img/token/bloodline.png" alt="vampir" />
|
||||
</div>
|
||||
|
||||
@@ -43,7 +43,7 @@ export const useRewardLockerStore = defineStore("rewardlocker", {
|
||||
// calls.push(this.contract.methods.rewards(walletStore.address, roundNumber, token.contractAddress));
|
||||
contracts.push({
|
||||
...this.contract,
|
||||
functionName: "rewards",
|
||||
functionName: "getRewards",
|
||||
args: [walletStore.address, roundNumber, token.contractAddress],
|
||||
});
|
||||
}
|
||||
|
||||
+36
-16
@@ -28,6 +28,7 @@ export const useRoundsStore = defineStore("rounds", {
|
||||
},
|
||||
getCurrentRoundData() {
|
||||
console.log("this.rounds", this.rounds);
|
||||
console.log("this.rounds[this.activeRound]", this.rounds[this.activeRound]);
|
||||
return this.rounds[this.activeRound];
|
||||
},
|
||||
},
|
||||
@@ -100,6 +101,8 @@ export const useRoundsStore = defineStore("rounds", {
|
||||
var tokenArray = [];
|
||||
var rewards_clan = 0;
|
||||
var rewards_sacrifice = 0;
|
||||
var rewards_staking = 0;
|
||||
console.log("data", data);
|
||||
for (let index = 0; index < data.length; index++) {
|
||||
var tokenData = {};
|
||||
const token = tokenStore.token[index];
|
||||
@@ -107,34 +110,51 @@ export const useRoundsStore = defineStore("rounds", {
|
||||
roundNumber,
|
||||
token.contractAddress
|
||||
);
|
||||
console.log("testcoef", testcoef);
|
||||
|
||||
tokenData.name = token.name;
|
||||
tokenData.contractAddress = token.contractAddress;
|
||||
tokenData.vamplogo = token.vamp.logo;
|
||||
tokenData.vampname = token.vamp.name;
|
||||
tokenData.amount = data[index].result[1];
|
||||
tokenData.getAmountToReachGoal = await memeBurnerStore.getAmountToReachGoal(token.contractAddress);
|
||||
// tokenData.amount = data[index].result[1];
|
||||
tokenData.amount = Number(data[index].result[1]) / Math.pow(10, token.decimals);
|
||||
tokenData.getAmountToReachGoal =
|
||||
Number(await memeBurnerStore.getAmountToReachGoal(token.contractAddress)) /
|
||||
Math.pow(10, token.decimals);
|
||||
if (this.currentRound !== roundNumber && walletStore.connected) {
|
||||
const clanwin = (Number(testcoef) / 10000 - 1) * Number(rewardData[index].result);
|
||||
const sacrificeRewards = Number(rewardData[index].result) - clanwin;
|
||||
console.log("index", index);
|
||||
console.log("rewardData[index]", rewardData[index]);
|
||||
const stakeReward = Number(rewardData[index].result[0]);
|
||||
const sacrificeClanReward = Number(rewardData[index].result[1]);
|
||||
console.log("stakeReward", stakeReward);
|
||||
console.log("sacrificeClanReward", sacrificeClanReward);
|
||||
const clanwin = (Number(testcoef) / 10000 - 1) * sacrificeClanReward;
|
||||
console.log("clanwin", clanwin);
|
||||
const sacrificeRewards = Number(sacrificeClanReward) - clanwin;
|
||||
console.log("sacrificeRewards", sacrificeRewards);
|
||||
tokenData.rewards_ges =
|
||||
Number(rewardData[index].result[1] / BigInt(Math.pow(10, token.decimals)) +
|
||||
rewardData[index].result[0] / BigInt(Math.pow(10, token.decimals)));
|
||||
tokenData.rewards_clan = clanwin / Math.pow(10, token.decimals);;
|
||||
tokenData.rewards_staking = Number(rewardData[index].result[0] / BigInt(Math.pow(10, token.decimals)));
|
||||
tokenData.rewards_sacrifice = sacrificeRewards / Math.pow(10, token.decimals);
|
||||
|
||||
tokenData.rewards_ges = BigInt(rewardData[index].result);
|
||||
tokenData.rewards_clan = BigInt(clanwin);
|
||||
tokenData.rewards_sacrifice = BigInt(sacrificeRewards);
|
||||
|
||||
rewards_clan = rewards_clan + clanwin / Math.pow(10, token.decimals);
|
||||
rewards_sacrifice = rewards_sacrifice + sacrificeRewards / Math.pow(10, token.decimals);
|
||||
rewards_clan = rewards_clan + tokenData.rewards_clan;
|
||||
rewards_sacrifice = rewards_sacrifice + tokenData.rewards_sacrifice;
|
||||
rewards_staking = rewards_staking + tokenData.rewards_staking;
|
||||
}
|
||||
tokenArray.push(tokenData);
|
||||
}
|
||||
console.log("clanwin123", rewards_clan);
|
||||
const goalInBLD = await memeBurnerStore.getGoalInBLD(roundNumber);
|
||||
this.rounds[roundNumber] = {
|
||||
goal: goal[0],
|
||||
goalInBLD: goalInBLD / BigInt(Math.pow(10, tokenStore.memeToken.decimals)),
|
||||
expirationTimestamp: goal[1],
|
||||
rewards_clan: BigInt(rewards_clan),
|
||||
rewards_sacrifice: BigInt(rewards_sacrifice),
|
||||
rewards_total: BigInt(rewards_clan + rewards_sacrifice),
|
||||
goal: Number(goal[0]) / Math.pow(10, tokenStore.memeToken.decimals),
|
||||
goalInBLD: Number(goalInBLD / BigInt(Math.pow(10, tokenStore.memeToken.decimals))),
|
||||
expirationTimestamp: Number(goal[1]),
|
||||
rewards_clan: Number(rewards_clan),
|
||||
rewards_staking: Number(rewards_staking),
|
||||
rewards_sacrifice: Number(rewards_sacrifice),
|
||||
rewards_total: Number(rewards_clan + rewards_sacrifice),
|
||||
token: tokenArray,
|
||||
};
|
||||
console.log("this.rounds[roundNumber]", this.rounds[roundNumber]);
|
||||
|
||||
@@ -138,10 +138,13 @@ onMounted(async () => {
|
||||
roundsStore.activeRound = roundsStore.currentRound;
|
||||
}
|
||||
await roundsStore.fillRound(roundsStore.activeRound);
|
||||
console.log("roundsStore.getCurrentRoundData", roundsStore.getCurrentRoundData);
|
||||
if (roundsStore.currentRound === roundsStore.activeRound) {
|
||||
const expirationTimestamp = roundsStore.getCurrentRoundData.expirationTimestamp;
|
||||
timer.value = setInterval(function () {
|
||||
timeBetweenDates(expirationTimestamp);
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
@@ -164,11 +167,10 @@ async function nextSlide() {
|
||||
}
|
||||
|
||||
function timeBetweenDates(expirationTimestamp) {
|
||||
const dateEntered = new Date(Number(expirationTimestamp) * 1000);
|
||||
const dateEntered = new Date(expirationTimestamp * 1000);
|
||||
if (dateEntered) {
|
||||
var now = new Date();
|
||||
difference.value = dateEntered.getTime() - now.getTime();
|
||||
console.log("difference.value", difference.value);
|
||||
if (difference.value <= 0) {
|
||||
clearInterval(timer.value);
|
||||
days.value = "0d";
|
||||
@@ -180,8 +182,6 @@ function timeBetweenDates(expirationTimestamp) {
|
||||
var _hours = Math.floor(_minutes / 60);
|
||||
var _days = Math.floor(_hours / 24);
|
||||
|
||||
console.log("_days", _days);
|
||||
|
||||
days.value = _days;
|
||||
hours.value = _hours % 24;
|
||||
minutes.value = _minutes % 60;
|
||||
|
||||
Reference in New Issue
Block a user