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