token-result

This commit is contained in:
EmberSpirit
2023-10-08 12:17:57 +02:00
parent 18d14f1478
commit 5c7e176457
+4 -12
View File
@@ -150,7 +150,7 @@
</template>
<script setup>
import { ref, defineProps, watch, inject, nextTick, onMounted, onBeforeUnmount, computed } from "vue";
import { ref, defineProps, watch, inject, nextTick, onMounted, onBeforeUnmount, computed, markRaw } from "vue";
import { useWalletStoreV2 } from "@/stores/walletV2";
import { useTokenStore } from "@/stores/tokens";
import { useMemeburnerStore } from "@/stores/memeburner";
@@ -280,7 +280,6 @@ async function sacrificeToken(amount) {
try {
state.value = 2;
const getRewards = await getRewardsFor(amount);
console.log("getRewards123", getRewards);
let hash = null;
if (getRewards.variant === "sacrifice") {
console.log("sacrifice");
@@ -292,12 +291,7 @@ async function sacrificeToken(amount) {
console.log("hash", hash);
}
console.log("hierabc");
console.log("state.value = 2");
console.log("hash", hash);
state.value = 3;
console.log("state.value = 3");
const data = await waitForTransaction({
hash: hash,
});
@@ -305,13 +299,14 @@ async function sacrificeToken(amount) {
activeToken.value.allowance = await tokenStore.allowance();
state.value = 4;
console.log("state.value = 4");
const outputSacrifice = output.value;
showSuccessToast(
tokenStore.activeToken.rewards?.toFixed(5),
outputSacrifice?.toFixed(5),
"Success!",
"You turned your meme into:",
"You can claim once the current cycle is finished and your clan bonus was calculated."
);
await walletStore.loadWalletData();
} catch (error) {
state.value = 0;
console.error(error);
@@ -349,13 +344,11 @@ async function getRewardsFor(value) {
const rewardsForResult = await memeburnerStore.getRewardFor(
BigInt(value * Math.pow(10, activeToken.value.decimals))
);
console.log("rewardsForResult", rewardsForResult);
const rewardsForResultNumber = Number(rewardsForResult[0]) / Math.pow(10, tokenStore.activeToken.decimals);
var quoteRewards = await uniswapStore.quoteExactInputSingle(
tokenNumber.value * Math.pow(10, tokenStore.activeToken.decimals)
);
console.log("quoteRewards", quoteRewards);
let variant = "sacrifice";
if (quoteRewards.result) {
console.log("quoteRewards", quoteRewards);
@@ -400,7 +393,6 @@ async function getRewardsFor(value) {
args: [tokenStore.activeToken.contractAddress, amountDecimal.toString(), 0],
account: walletStore.address,
});
console.log("amountSacrifice", amountSacrifice);
const amountBuy = await readContract({
address: memeburnerStore.contract.address,