update m issues + e frontend improvements

This commit is contained in:
EmberSpirit
2023-10-23 21:35:38 +02:00
parent 44df04cc23
commit 6e58bc6319
24 changed files with 305 additions and 312 deletions
+23 -10
View File
@@ -23,19 +23,20 @@
<rewards-wrapper
title="Sacrafice Reward"
coin="$BLOOD"
:amount="formatBigIntDivision(rewardsSacrifice, 10n ** tokenStore.memeToken.decimals)"
:amount="formatNumber(rewardsSacrifice, 10n ** tokenStore.memeToken.decimals)"
image="/assets/img/vampir.png"
/>
<rewards-wrapper
title="Staking Bonus"
coin="$BLOOD"
:amount="formatBigIntDivision(rewardsStaking, 10n ** tokenStore.memeToken.decimals)"
:amount="formatNumber(rewardsStaking, 10n ** tokenStore.memeToken.decimals)"
image="/assets/img/vampir.png"
/>
<rewards-wrapper
title="Clan Bonus"
:subTitle="rewardsClan > 0 ? clanBonusPercentage : null"
coin="$BLOOD"
:amount="formatBigIntDivision(rewardsClan, 10n ** tokenStore.memeToken.decimals)"
:amount="formatNumber(rewardsClan, 10n ** tokenStore.memeToken.decimals)"
:image="
activeCycle === currentCycle || !cycleStore.getCurrentCycleData?.winner.vamplogo
? '/assets/img/token/notoken.png'
@@ -47,13 +48,13 @@
<div class="rewards-total-headline sub-header">Total Reward</div>
<div
class="rewards-total-inner bloodline-border bloodline-border--variant1"
:class="{ purple: rewardsTotal > 0 && activeCycle !== currentCycle }"
:class="{ purple: rewardsTotal > 0n && activeCycle !== currentCycle }"
>
<token-name-price
name="$BLOOD"
:price="formatBigIntDivision(rewardsTotal, 10n ** tokenStore.memeToken.decimals)"
:price="formatNumber(rewardsTotal, 10n ** tokenStore.memeToken.decimals)"
></token-name-price>
<token-logo img="/assets/img/vampir.png" :alt="'vampire'"></token-logo>
<token-logo img="/assets/img/vampir.png" :size="64" :alt="'vampire'"></token-logo>
</div>
</div>
<div class="claim-button">
@@ -86,7 +87,9 @@
<div class="btn btn-immortal sub-header" disabled v-if="stateClaimedComp === 3">
<loading-component></loading-component>
</div>
<div class="btn btn-immortal sub-header" @click="openStake">Stake</div>
<div class="btn btn-immortal sub-header" v-if="stateClaimedComp === 0" @click="openStake">
Stake
</div>
</div>
</Transition>
<Transition name="smooth">
@@ -157,7 +160,7 @@ import { waitForTransaction } from "@wagmi/core";
import LoadingComponent from "@/components/LoadingComponent.vue";
import TokenNamePrice from "@/components/TokenNamePrice.vue";
import TokenLogo from "@/components/TokenLogo.vue";
import { formatBigIntDivision } from "@/helper/helper.js";
import { formatNumber, formatBigIntDivision } from "@/helper/helper.js";
import { showSuccessToast } from "@/helper/toast.js";
const showPanel = inject("showPanel");
@@ -212,7 +215,7 @@ async function stakeAndClaim() {
const outputClaim = BigInt(rewardData?.topics[2]);
const outputStaked = BigInt(stakeData?.topics[3]);
showSuccessToast(
formatBigIntDivision(outputClaim + outputStaked, 10n ** tokenStore.memeToken.decimals),
formatNumber(outputClaim + outputStaked, 10n ** tokenStore.memeToken.decimals),
"Success!",
"You just claimed and staked",
"Join the next cycle to increase your rewards and win with your clan."
@@ -260,7 +263,7 @@ async function claimRewards() {
//
console.log("rewardData", rewardData);
const outputClaim = formatBigIntDivision(BigInt(rewardData.topics[2]), 10n ** tokenStore.memeToken.decimals);
const outputClaim = formatNumber(BigInt(rewardData.topics[2]), 10n ** tokenStore.memeToken.decimals);
showSuccessToast(
outputClaim,
"Success!",
@@ -276,6 +279,16 @@ async function claimRewards() {
}
}
const clanBonusPercentage = computed(() => {
return (
(
(formatBigIntDivision(rewardsClan.value, 10n ** tokenStore.memeToken.decimals, 8) /
formatBigIntDivision(rewardsTotal.value, 10n ** tokenStore.memeToken.decimals, 8)) *
100
).toFixed(2) + "%"
);
});
const stateClaimedComp = computed(() => {
let returnState = 0;
if (stateClaim.value === 2) {