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