comments + contract update +

smaller design issues
This commit is contained in:
EmberSpirit
2023-10-12 20:01:11 +02:00
parent 68cd720c59
commit b5c6f8af33
37 changed files with 714 additions and 1480 deletions
+11 -48
View File
@@ -37,7 +37,7 @@
<div
class="btn btn-immortal stake-button"
v-else-if="stateClaimComp === 1"
@click="stakeAndClaimAllRounds"
@click="stakeAndClaimAllCycles"
>
Stake & Claim Rest
</div>
@@ -55,7 +55,9 @@
</div>
</template>
<template v-slot:message-end>
<div class="input-balance">Balance: {{ walletStore.memeToken?.unclaimedRewards }}</div>
<div class="input-balance">
Balance: {{ formatNumber(walletStore.memeToken?.unclaimedRewards) }}
</div>
</template>
</stake-menu>
</Transition>
@@ -88,6 +90,8 @@ import { useTokenStore } from "@/stores/tokens";
import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useRouter } from "vue-router";
import { useToast } from "vue-toastification";
import { formatNumber } from "@/helper/helper.js";
import { showSuccessToast } from "@/helper/toast.js";
const toast = useToast();
const rewardLockerStore = useRewardLockerStore();
@@ -121,17 +125,12 @@ function openStake() {
stakeMenu.value = true;
}
function openUnstake() {
stake.value = false;
stakeMenu.value = true;
}
async function stakeAndClaimAllRounds() {
async function stakeAndClaimAllCycles() {
try {
const unclaimedRewards = walletStore.memeToken?.unclaimedRewards;
stateClaim.value = 2;
const coefficient = (10000 * tokenNumber.value) / unclaimedRewards;
var hash = await rewardLockerStore.stakeAndClaimAllRounds(coefficient);
var hash = await rewardLockerStore.stakeAndClaimAllCycles(coefficient);
stateClaim.value = 3;
const data = await waitForTransaction({
hash: hash,
@@ -147,7 +146,7 @@ async function stakeAndClaimAllRounds() {
//ClaimedReward (address staker, uint256 reward)
const outputClaim = Number(rewardData.topics[2]) / Math.pow(10, tokenStore.memeToken.decimals);
showSuccessToast(
outputClaim.toFixed(5),
formatNumber(outputClaim),
"Success!",
"You just claimed and staked",
"Join the next cycle to increase your rewards and win with your clan"
@@ -178,7 +177,7 @@ async function claimAll() {
//ClaimedReward (address staker, uint256 reward)
const outputClaim = Number(rewardData.topics[2]) / Math.pow(10, tokenStore.memeToken.decimals);
showSuccessToast(
outputClaim.toFixed(5),
formatNumber(outputClaim),
"Success!",
"You just claimed",
"Join the next cycle to increase your rewards and win with your clan."
@@ -220,42 +219,6 @@ const stateClaimComp = computed(() => {
}
return returnState;
});
function showSuccessToast(value, header, subheader, info) {
// Define the content object with the component, props and listeners
const content = {
component: StakeSuccessToast,
// Any prop can be passed, but don't expect them to be reactive
props: {
// counter: this.counter,
// value: tokenStore.activeToken.rewards?.toFixed(5),
value: value,
header: header,
subheader: subheader,
info: info,
},
// Listen and react to events using callbacks. In this case we listen for
// the "click" event emitted when clicking the toast button
listeners: {},
};
// Render the toast and its contents
toast(content, {
position: "top-center",
icon: false,
closeOnClick: false,
toastClassName: "modal-overlay",
closeButton: false,
hideProgressBar: true,
timeout: false,
});
}
</script>
<style lang="sass">
// .smooth-enter-active, .smooth-leave-active
// transition: opacity 0.1s
// .smooth-enter, .smooth-leave-to
// height: 0
</style>
<style lang="sass"></style>