updated contracts + install metamask if not installed

This commit is contained in:
EmberSpirit
2023-10-08 11:22:17 +02:00
parent 8d8423b1cb
commit 18d14f1478
11 changed files with 2385 additions and 2604 deletions
+3 -69
View File
@@ -113,7 +113,6 @@
</div>
</div>
<div class="sacrifice-buttons-function-wrapper">
{{ stateComputed }}
<template v-if="walletStore.connected">
<div class="btn btn-immortal sub-header" disabled v-if="stateComputed === 0">Enter Amount</div>
<div
@@ -341,29 +340,6 @@ async function getRewardsFor(value) {
loading.value = true;
let variant = null;
let newOutput = 0;
// if (activeToken.value.allowance >= value) {
// const amountDecimal = BigInt(value * Math.pow(10, tokenStore.activeToken.decimals));
// const hash = await readContract({
// address: memeburnerStore.contract.address,
// abi: memeburnerStore.contract.abi,
// functionName: "sacrificeMeme",
// args: [tokenStore.activeToken.contractAddress, amountDecimal.toString(), 0],
// account: walletStore.address,
// });
// console.log("hash", hash);
// // var hash = await memeburnerStore.contract.simulate.sacrificeMeme([
// // tokenStore.activeToken.contractAddress,
// // amountDecimal.toString(),
// // 0,
// // ]);
// // console.log("hash", hash);
// // state.value = 3;
// // const data = await waitForTransaction({
// // hash: hash,
// // });
// // console.log("datahash", data);
// }
try {
if (!value || isNaN(value)) {
output.value = 0;
@@ -373,12 +349,13 @@ async function getRewardsFor(value) {
const rewardsForResult = await memeburnerStore.getRewardFor(
BigInt(value * Math.pow(10, activeToken.value.decimals))
);
const rewardsForResultNumber = Number(rewardsForResult) / Math.pow(10, tokenStore.activeToken.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);
@@ -444,49 +421,6 @@ async function getRewardsFor(value) {
}
}
// if (!walletStore.connected && variant === "sacrifice") {
// newOutput = rewardsForResultNumber;
// } else if (!walletStore.connected && variant === "buy") {
// newOutput = rewardsForResultNumber;
// }
// if (!walletStore.connected || (walletStore.connected && activeToken.value.allowance < tokenNumber.value)) {
// //case 1
// // user is not logged in or Allowance is less than Input, then I show getRewardsForSacrifice Value
// newOutput = rewardsForResultNumber;
// variant = "sacrifice";
// } else {
// const rewardsForResult = await memeburnerStore.getRewardFor(
// BigInt(value * Math.pow(10, activeToken.value.decimals))
// );
// console.log(
// "tokenNumber.value * Math.pow(10, tokenStore.activeToken.decimals)",
// tokenNumber.value * Math.pow(10, tokenStore.activeToken.decimals)
// );
// console.log("tokenNumber.value", tokenNumber.value);
// var quoteRewards = await uniswapStore.quoteExactInputSingle(
// tokenNumber.value * Math.pow(10, tokenStore.activeToken.decimals)
// );
// console.log("quoteRewards", quoteRewards);
// const rewardsForResultNumber = Number(rewardsForResult[0]) / Math.pow(10, tokenStore.activeToken.decimals);
// console.log("rewardsForResultNumber", rewardsForResultNumber);
// const quoteRewardsNumber = Number(quoteRewards) / Math.pow(10, tokenStore.activeToken.decimals);
// console.log("quoteRewardsNumber", quoteRewardsNumber);
// if (quoteRewardsNumber * 0.995 > rewardsForResultNumber) {
// //sacrificememe
// newOutput = quoteRewardsNumber;
// variant = "buy";
// // const hash = await memeburnerStore.sacrificeMeme(tokenNumber.value);
// } else {
// newOutput = rewardsForResultNumber;
// variant = "sacrifice";
// //sacrificeMemeAndBuyBLOOD
// // const hash = await memeburnerStore.sacrificeMeme(tokenNumber.value);
// }
// }
// console.log("variant", variant);
// tokenStore.activeToken.rewards = newOutput;
output.value = newOutput;
return { ouput: newOutput, variant: variant };
} catch (error) {