quoter update + desktop update
This commit is contained in:
+3
-3
@@ -13,7 +13,7 @@ import { useRoundsStore } from "@/stores/rounds";
|
|||||||
|
|
||||||
import SlideoutPanel from "./components/SlideoutPanel.vue";
|
import SlideoutPanel from "./components/SlideoutPanel.vue";
|
||||||
import ConnectWallet from "./components/ConnectWallet.vue";
|
import ConnectWallet from "./components/ConnectWallet.vue";
|
||||||
import StakeComponent from "@/components/StakeComponent.vue";
|
import CardComponent from "@/components/CardComponent.vue";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
watchAccount,
|
watchAccount,
|
||||||
@@ -145,7 +145,7 @@ onMounted(async () => {
|
|||||||
<connect-wallet></connect-wallet>
|
<connect-wallet></connect-wallet>
|
||||||
</slideout-panel>
|
</slideout-panel>
|
||||||
<div class="modal-overlay" v-show="showModal">
|
<div class="modal-overlay" v-show="showModal">
|
||||||
<stake-component class="modal-card">
|
<card-component class="modal-card">
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<img alt="logo" class="logo" src="/assets/img/vampir.png" />
|
<img alt="logo" class="logo" src="/assets/img/vampir.png" />
|
||||||
@@ -163,7 +163,7 @@ onMounted(async () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn btn-immortal" @click="showModal = false">Okay</div>
|
<div class="btn btn-immortal" @click="showModal = false">Okay</div>
|
||||||
</stake-component>
|
</card-component>
|
||||||
</div>
|
</div>
|
||||||
<div class="main" :class="{ 'no-scroll': showPanel, mobile: isMobile }">
|
<div class="main" :class="{ 'no-scroll': showPanel, mobile: isMobile }">
|
||||||
<RouterView />
|
<RouterView />
|
||||||
|
|||||||
@@ -0,0 +1,197 @@
|
|||||||
|
{
|
||||||
|
"contractName": "Quoter",
|
||||||
|
"contractAddress": "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6",
|
||||||
|
"abi": [
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "_factory",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "_WETH9",
|
||||||
|
"type": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "constructor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "WETH9",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "",
|
||||||
|
"type": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "factory",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "",
|
||||||
|
"type": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "path",
|
||||||
|
"type": "bytes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "amountIn",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "quoteExactInput",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "amountOut",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "tokenIn",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "tokenOut",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint24",
|
||||||
|
"name": "fee",
|
||||||
|
"type": "uint24"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "amountIn",
|
||||||
|
"type": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint160",
|
||||||
|
"name": "sqrtPriceLimitX96",
|
||||||
|
"type": "uint160"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "quoteExactInputSingle",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "amountOut",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "path",
|
||||||
|
"type": "bytes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "amountOut",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "quoteExactOutput",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "amountIn",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "tokenIn",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "tokenOut",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint24",
|
||||||
|
"name": "fee",
|
||||||
|
"type": "uint24"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "amountOut",
|
||||||
|
"type": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint160",
|
||||||
|
"name": "sqrtPriceLimitX96",
|
||||||
|
"type": "uint160"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "quoteExactOutputSingle",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "amountIn",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "int256",
|
||||||
|
"name": "amount0Delta",
|
||||||
|
"type": "int256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "int256",
|
||||||
|
"name": "amount1Delta",
|
||||||
|
"type": "int256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "path",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "uniswapV3SwapCallback",
|
||||||
|
"outputs": [],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<stake-component>
|
<card-component>
|
||||||
<template v-slot:headline> Unclaimed </template>
|
<template v-slot:headline> Unclaimed </template>
|
||||||
<template v-slot:body>
|
<template v-slot:body>
|
||||||
<token-name-price
|
<token-name-price
|
||||||
@@ -48,12 +48,12 @@
|
|||||||
<div class="small-text text-center">Sacrifice to earn $BLOOD</div>
|
<div class="small-text text-center">Sacrifice to earn $BLOOD</div>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</stake-component>
|
</card-component>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import StakeComponent from "@/components/StakeComponent.vue";
|
import CardComponent from "@/components/CardComponent.vue";
|
||||||
import StakeMenu from "@/components/StakeMenu.vue";
|
import StakeMenu from "@/components/StakeMenu.vue";
|
||||||
import TokenNamePrice from "@/components/TokenNamePrice.vue";
|
import TokenNamePrice from "@/components/TokenNamePrice.vue";
|
||||||
import TokenLogo from "@/components/TokenLogo.vue";
|
import TokenLogo from "@/components/TokenLogo.vue";
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ import { useTokenStore } from "@/stores/tokens";
|
|||||||
import Meme1Json from "@/assets/contracts/Meme1.json";
|
import Meme1Json from "@/assets/contracts/Meme1.json";
|
||||||
import TokenNamePrice from "./TokenNamePrice.vue";
|
import TokenNamePrice from "./TokenNamePrice.vue";
|
||||||
import TokenLogo from "./TokenLogo.vue";
|
import TokenLogo from "./TokenLogo.vue";
|
||||||
import StakeComponent from "./StakeComponent.vue";
|
|
||||||
import TokenInput from "./TokenInput.vue";
|
import TokenInput from "./TokenInput.vue";
|
||||||
import StakeComponentV1 from "@/components/StakeComponentV1.vue";
|
import StakeComponentV1 from "@/components/StakeComponentV1.vue";
|
||||||
|
|
||||||
@@ -155,6 +154,8 @@ async function connectWallet(connector) {
|
|||||||
border-radius: 8px
|
border-radius: 8px
|
||||||
.connected-header-logout
|
.connected-header-logout
|
||||||
margin-left: auto
|
margin-left: auto
|
||||||
|
&:hover, &:active, &:focus
|
||||||
|
cursor: pointer
|
||||||
svg
|
svg
|
||||||
font-size: 25px
|
font-size: 25px
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
@input="
|
@input="
|
||||||
($event) => {
|
($event) => {
|
||||||
tokenNumber = $event.target.value;
|
tokenNumber = $event.target.value;
|
||||||
return getRewardsFor($event.target.value);
|
return processChange($event.target.value);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
:logo="activeToken.logo"
|
:logo="activeToken.logo"
|
||||||
@@ -65,9 +65,7 @@
|
|||||||
<div class="sarcrifice-to-input">
|
<div class="sarcrifice-to-input">
|
||||||
<div class="sacrifice-to-output">
|
<div class="sacrifice-to-output">
|
||||||
<div class="sacrifice-to-output-coin">$BLOOD</div>
|
<div class="sacrifice-to-output-coin">$BLOOD</div>
|
||||||
<div class="sacrifice-to-output-rewards header">
|
<div class="sacrifice-to-output-rewards header">{{ output.toFixed(5) }}</div>
|
||||||
{{ output }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="sacrifice-logo">
|
<div class="sacrifice-logo">
|
||||||
<img :src="activeToken.vamp?.logo" :alt="activeToken.vamp.name" />
|
<img :src="activeToken.vamp?.logo" :alt="activeToken.vamp.name" />
|
||||||
@@ -90,8 +88,6 @@
|
|||||||
<stake-component-v1 :variant="1" v-if="showStakingMenu">
|
<stake-component-v1 :variant="1" v-if="showStakingMenu">
|
||||||
<template v-slot:headline> {{ null }}</template>
|
<template v-slot:headline> {{ null }}</template>
|
||||||
</stake-component-v1>
|
</stake-component-v1>
|
||||||
|
|
||||||
<!-- <stake-component v-if="showStakingMenu" stakeonly class="variant1"></stake-component> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sacrificed-info" v-if="state === 4">
|
<div class="sacrificed-info" v-if="state === 4">
|
||||||
@@ -150,16 +146,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, defineProps, watch, inject, nextTick } from "vue";
|
import { ref, defineProps, watch, inject, nextTick, onMounted, onBeforeUnmount, computed } 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";
|
||||||
|
import { useUniswapStore } from "@/stores/uniswap";
|
||||||
import StakeComponentV1 from "@/components/StakeComponentV1.vue";
|
import StakeComponentV1 from "@/components/StakeComponentV1.vue";
|
||||||
import LoadingComponent from "@/components/LoadingComponent.vue";
|
import LoadingComponent from "@/components/LoadingComponent.vue";
|
||||||
import TokenInput from "@/components/TokenInput.vue";
|
import TokenInput from "@/components/TokenInput.vue";
|
||||||
|
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { waitForTransaction } from "@wagmi/core";
|
import { waitForTransaction, readContract, watchBlockNumber } from "@wagmi/core";
|
||||||
|
|
||||||
import Helper from "@/utils/helper.js";
|
import Helper from "@/utils/helper.js";
|
||||||
const isMobile = inject("isMobile");
|
const isMobile = inject("isMobile");
|
||||||
@@ -173,6 +170,7 @@ const tokenStore = useTokenStore();
|
|||||||
const { activeToken } = storeToRefs(tokenStore);
|
const { activeToken } = storeToRefs(tokenStore);
|
||||||
|
|
||||||
const memeburnerStore = useMemeburnerStore();
|
const memeburnerStore = useMemeburnerStore();
|
||||||
|
const uniswapStore = useUniswapStore();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: Array,
|
data: Array,
|
||||||
@@ -189,6 +187,7 @@ const props = defineProps({
|
|||||||
const tokenNumber = ref(null);
|
const tokenNumber = ref(null);
|
||||||
const output = ref(0);
|
const output = ref(0);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
const blockEvent = ref(null);
|
||||||
/**
|
/**
|
||||||
* state 0 enter amount
|
* state 0 enter amount
|
||||||
* state 1 rdy to go
|
* state 1 rdy to go
|
||||||
@@ -200,12 +199,66 @@ const state = ref(0);
|
|||||||
const showStakingMenu = ref(false);
|
const showStakingMenu = ref(false);
|
||||||
const approvalData = ref(null);
|
const approvalData = ref(null);
|
||||||
|
|
||||||
// const processChange = Helper.debounce((e) => getRewardsFor(e.target.value));
|
const processChange = Helper.debounce((value) => getRewardsFor(value));
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
blockEvent.value = watchBlockNumber(
|
||||||
|
{
|
||||||
|
listen: true,
|
||||||
|
},
|
||||||
|
async (blockNumber) => {
|
||||||
|
console.log("blockNumber", blockNumber);
|
||||||
|
await getRewardsFor(tokenNumber.value);
|
||||||
|
// if (tokenNumber.value && tokenNumber.value > 0) {
|
||||||
|
// console.log("tokenNumber.value", tokenNumber.value);
|
||||||
|
// var quoteRewards = await uniswapStore.quoteExactInputSingle(
|
||||||
|
// tokenNumber.value * Math.pow(10, tokenStore.activeToken.decimals)
|
||||||
|
// );
|
||||||
|
// const quoteRewards1 = Number(quoteRewards) / Math.pow(10, tokenStore.activeToken.decimals);
|
||||||
|
// console.log("quoteRewards", quoteRewards);
|
||||||
|
// const rewardsForResult = await memeburnerStore.getRewardFor(
|
||||||
|
// tokenNumber.value * Math.pow(10, tokenStore.activeToken.decimals)
|
||||||
|
// );
|
||||||
|
// const rewardsForResult1 = Number(rewardsForResult) / Math.pow(10, tokenStore.activeToken.decimals);
|
||||||
|
// console.log("rewardsForResult1", rewardsForResult1);
|
||||||
|
// console.log("quoteRewards1", quoteRewards1);
|
||||||
|
// console.log("compare", quoteRewards1 * 0.995);
|
||||||
|
// console.log("ifcompare1", quoteRewards1 * 0.995 > rewardsForResult1);
|
||||||
|
// //return bigger number
|
||||||
|
// if (quoteRewards1 * 0.995 > rewardsForResult1) {
|
||||||
|
// //sacrificememe
|
||||||
|
// output.value = quoteRewards1;
|
||||||
|
// // const hash = await memeburnerStore.sacrificeMeme(tokenNumber.value);
|
||||||
|
// } else {
|
||||||
|
// output.value = rewardsForResult1;
|
||||||
|
// //sacrificeMemeAndBuyBLOOD
|
||||||
|
// // const hash = await memeburnerStore.sacrificeMeme(tokenNumber.value);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
}
|
||||||
|
);
|
||||||
|
console.log("blockEvent.value", blockEvent.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
console.log("blockEventunwatch", blockEvent.value);
|
||||||
|
blockEvent.value();
|
||||||
|
});
|
||||||
|
|
||||||
async function sacrificeToken(amount) {
|
async function sacrificeToken(amount) {
|
||||||
try {
|
try {
|
||||||
state.value = 2;
|
state.value = 2;
|
||||||
const hash = await memeburnerStore.sacrificeMeme(amount);
|
const getRewards = await getRewardsFor(amount);
|
||||||
|
console.log("getRewards123", getRewards);
|
||||||
|
let hash = null;
|
||||||
|
if (getRewards.variant === "sacrifice") {
|
||||||
|
console.log("sacrifice");
|
||||||
|
hash = await memeburnerStore.sacrificeMeme(amount);
|
||||||
|
} else {
|
||||||
|
console.log("buy");
|
||||||
|
hash = await memeburnerStore.sacrificeMemeAndBuyBLOOD(amount);
|
||||||
|
}
|
||||||
console.log("hash", hash);
|
console.log("hash", hash);
|
||||||
state.value = 3;
|
state.value = 3;
|
||||||
const data = await waitForTransaction({
|
const data = await waitForTransaction({
|
||||||
@@ -241,20 +294,86 @@ async function approveToken(amount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getRewardsFor(value) {
|
async function getRewardsFor(value) {
|
||||||
|
console.log("getRewardsFor", value);
|
||||||
loading.value = true;
|
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 {
|
try {
|
||||||
if (!value || isNaN(value)) {
|
if (!value || isNaN(value)) {
|
||||||
output.value = 0;
|
output.value = 0;
|
||||||
state.value = 0;
|
state.value = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const rewardsForResult = await memeburnerStore.getRewardFor(
|
console.log("blablub", {
|
||||||
BigInt(value * Math.pow(10, activeToken.value.decimals))
|
allowance: activeToken.value.allowance,
|
||||||
);
|
tokenNumber: tokenNumber.value,
|
||||||
|
connected: walletStore.connected,
|
||||||
|
check: walletStore.connected && activeToken.value.allowance >= tokenNumber.value,
|
||||||
|
ges: !walletStore.connected || (walletStore.connected && activeToken.value.allowance < tokenNumber.value),
|
||||||
|
});
|
||||||
|
if (!walletStore.connected || (walletStore.connected && activeToken.value.allowance < tokenNumber.value)) {
|
||||||
|
console.log("hier");
|
||||||
|
const rewardsForResult = await memeburnerStore.getRewardFor(
|
||||||
|
BigInt(value * Math.pow(10, activeToken.value.decimals))
|
||||||
|
);
|
||||||
|
console.log("rewardsForResult", rewardsForResult);
|
||||||
|
const rewardsForResultNumber = Number(rewardsForResult) / Math.pow(10, tokenStore.activeToken.decimals);
|
||||||
|
newOutput = rewardsForResultNumber;
|
||||||
|
variant = "sacrifice";
|
||||||
|
} else {
|
||||||
|
console.log("hier1");
|
||||||
|
console.log("activeToken.allowance", activeToken.value.allowance);
|
||||||
|
const rewardsForResult = await memeburnerStore.getRewardFor(
|
||||||
|
BigInt(value * Math.pow(10, activeToken.value.decimals))
|
||||||
|
);
|
||||||
|
console.log("rewardsForResult", rewardsForResult);
|
||||||
|
var quoteRewards = await uniswapStore.quoteExactInputSingle(
|
||||||
|
tokenNumber.value * Math.pow(10, tokenStore.activeToken.decimals)
|
||||||
|
);
|
||||||
|
const rewardsForResultNumber = Number(rewardsForResult) / 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);
|
||||||
state.value = 1;
|
state.value = 1;
|
||||||
output.value = rewardsForResult / BigInt(Math.pow(10, tokenStore.memeToken.decimals));
|
output.value = newOutput;
|
||||||
tokenStore.activeToken.rewards = output.value;
|
tokenStore.activeToken.rewards = newOutput;
|
||||||
return output.value;
|
return { ouput: newOutput, variant: variant };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("error", error);
|
console.log("error", error);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -264,7 +383,7 @@ async function getRewardsFor(value) {
|
|||||||
|
|
||||||
async function addTokens(value) {
|
async function addTokens(value) {
|
||||||
tokenNumber.value = Number(tokenNumber.value) + Number(value);
|
tokenNumber.value = Number(tokenNumber.value) + Number(value);
|
||||||
output.value = await getRewardsFor(parseInt(tokenNumber.value));
|
output.value = await getRewardsFor(tokenNumber.value).output;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, useSlots } from "vue";
|
import { ref, useSlots } from "vue";
|
||||||
import StakeComponent from "@/components/StakeComponent.vue";
|
import CardComponent from "@/components/CardComponent.vue";
|
||||||
import StakeMenu from "@/components/StakeMenu.vue";
|
import StakeMenu from "@/components/StakeMenu.vue";
|
||||||
import TokenNamePrice from "@/components/TokenNamePrice.vue";
|
import TokenNamePrice from "@/components/TokenNamePrice.vue";
|
||||||
import TokenLogo from "@/components/TokenLogo.vue";
|
import TokenLogo from "@/components/TokenLogo.vue";
|
||||||
@@ -201,6 +201,8 @@ async function orderUnstake() {
|
|||||||
.token-price
|
.token-price
|
||||||
font-size: 24px
|
font-size: 24px
|
||||||
.connected-stake-buttons
|
.connected-stake-buttons
|
||||||
|
display: flex
|
||||||
|
gap: 8px
|
||||||
.btn
|
.btn
|
||||||
font-size: 18px
|
font-size: 18px
|
||||||
.connected-stake-first-round
|
.connected-stake-first-round
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else-if="getCurrentRoundData?.rewards_total > 0">
|
<template v-else-if="getCurrentRoundData?.rewards_total > 0">
|
||||||
<Transition name="smooth">
|
<Transition name="smooth">
|
||||||
<div class="connected-stake-buttons" v-show="!stakeMenu">
|
<div class="stake-buttons" v-show="!stakeMenu">
|
||||||
<div class="btn btn-immortal" @click="claimRewards">Claim</div>
|
<div class="btn btn-immortal" @click="claimRewards">Claim</div>
|
||||||
<div class="btn btn-immortal" @click="openStake">Stake</div>
|
<div class="btn btn-immortal" @click="openStake">Stake</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -165,7 +165,9 @@ async function claimRewards() {
|
|||||||
.stake-buttons
|
.stake-buttons
|
||||||
display: flex
|
display: flex
|
||||||
text-align: center
|
text-align: center
|
||||||
gap: 32px
|
gap: 8px
|
||||||
|
@media (min-width: 992px)
|
||||||
|
gap: 32px
|
||||||
div
|
div
|
||||||
flex: 1 1 50%
|
flex: 1 1 50%
|
||||||
.rewards-wrapper
|
.rewards-wrapper
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="token-input">
|
<div class="token-input">
|
||||||
<div class="sarcrifice-from-input">
|
<div class="sarcrifice-from-input">
|
||||||
<input
|
<input @input="emit('update:modelValue', $event.target.value)" :value="props.modelValue" :placeholder="0" />
|
||||||
@input="emit('update:modelValue', $event.target.value)"
|
|
||||||
v-model="props.modelValue"
|
|
||||||
:placeholder="0"
|
|
||||||
/>
|
|
||||||
<div class="sacrifice-logo" v-if="props.logo">
|
<div class="sacrifice-logo" v-if="props.logo">
|
||||||
<img :src="props.logo" alt="vampir" />
|
<img :src="props.logo" alt="vampir" />
|
||||||
</div>
|
</div>
|
||||||
@@ -19,7 +15,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: Number,
|
modelValue: [String, Number],
|
||||||
logo: String,
|
logo: String,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
name: String,
|
name: String,
|
||||||
price: Number,
|
price: [Number, String],
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
+18
-13
@@ -3,6 +3,7 @@ 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";
|
||||||
import { useRewardLockerStore } from "@/stores/rewardlocker";
|
import { useRewardLockerStore } from "@/stores/rewardlocker";
|
||||||
|
import { useUniswapStore } from "@/stores/uniswap";
|
||||||
import { useRoundsStore } from "@/stores/rounds";
|
import { useRoundsStore } from "@/stores/rounds";
|
||||||
|
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
@@ -85,6 +86,7 @@ const tokenStore = useTokenStore();
|
|||||||
const memeBurnerStore = useMemeburnerStore();
|
const memeBurnerStore = useMemeburnerStore();
|
||||||
const rewardLockerStore = useRewardLockerStore();
|
const rewardLockerStore = useRewardLockerStore();
|
||||||
const roundsStore = useRoundsStore();
|
const roundsStore = useRoundsStore();
|
||||||
|
const uniswapStore = useUniswapStore();
|
||||||
|
|
||||||
|
|
||||||
const goerliKey = import.meta.env.VITE_GOERLI_KEY;
|
const goerliKey = import.meta.env.VITE_GOERLI_KEY;
|
||||||
@@ -179,7 +181,8 @@ watchAccount(async (account) => {
|
|||||||
await memeBurnerStore.init();
|
await memeBurnerStore.init();
|
||||||
await tokenStore.initV2();
|
await tokenStore.initV2();
|
||||||
await rewardLockerStore.init();
|
await rewardLockerStore.init();
|
||||||
await walletStore.loadWalletData();
|
await walletStore.loadWalletData();
|
||||||
|
await uniswapStore.init();
|
||||||
} else {
|
} else {
|
||||||
walletStore.address = null;
|
walletStore.address = null;
|
||||||
walletStore.connected = false;
|
walletStore.connected = false;
|
||||||
@@ -193,18 +196,20 @@ watchNetwork((network) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watchContractEvent(
|
|
||||||
{
|
|
||||||
address: memeBurnerStore.config.contractAddress,
|
// watchContractEvent(
|
||||||
abi: memeBurnerStore.config.abi,
|
// {
|
||||||
eventName: "MemeSacrificed",
|
// address: memeBurnerStore.config.contractAddress,
|
||||||
},
|
// abi: memeBurnerStore.config.abi,
|
||||||
async (log) => {
|
// eventName: "MemeSacrificed",
|
||||||
console.log("memeSacrificedEvent", log);
|
// },
|
||||||
const token = log[0].args.sacrificedToken;
|
// async (log) => {
|
||||||
await roundsStore.updateCurrentRound(token);
|
// console.log("memeSacrificedEvent", log);
|
||||||
}
|
// const token = log[0].args.sacrificedToken;
|
||||||
);
|
// await roundsStore.updateCurrentRound(token);
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
await walletStore.init();
|
await walletStore.init();
|
||||||
await tokenStore.initV2();
|
await tokenStore.initV2();
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ export const useMemeburnerStore = defineStore("memeburner", {
|
|||||||
const rewards = await this.contract.read.getRewardForSacrifice([
|
const rewards = await this.contract.read.getRewardForSacrifice([
|
||||||
tokenStore.activeToken.contractAddress,
|
tokenStore.activeToken.contractAddress,
|
||||||
amount,
|
amount,
|
||||||
]);
|
]);
|
||||||
|
console.log("tokenStore.activeToken.contractAddress", tokenStore.activeToken.contractAddress);
|
||||||
|
console.log("amount", amount);
|
||||||
console.log("rewards", rewards);
|
console.log("rewards", rewards);
|
||||||
return rewards;
|
return rewards;
|
||||||
},
|
},
|
||||||
@@ -97,9 +99,27 @@ export const useMemeburnerStore = defineStore("memeburner", {
|
|||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async sacrificeMemeAndBuyBLOOD(amount) {
|
||||||
|
const tokenStore = useTokenStore();
|
||||||
|
|
||||||
|
const amountDecimal = BigInt(amount * Math.pow(10, tokenStore.activeToken.decimals));
|
||||||
|
var hash = await this.contract.write.sacrificeMemeAndBuyBLOOD([
|
||||||
|
tokenStore.activeToken.contractAddress,
|
||||||
|
amountDecimal.toString(),
|
||||||
|
0,
|
||||||
|
]);
|
||||||
|
return hash;
|
||||||
|
},
|
||||||
async getGoalInBLOOD(roundNumber) {
|
async getGoalInBLOOD(roundNumber) {
|
||||||
return await this.contract.read.getGoalInBLOOD([roundNumber]);
|
return await this.contract.read.getGoalInBLOOD([roundNumber]);
|
||||||
},
|
},
|
||||||
|
async getAmountETHBase(amount) {
|
||||||
|
console.log("getAmountETHBase");
|
||||||
|
const tokenStore = useTokenStore();
|
||||||
|
return await this.contract.read.getAmountETHBase([tokenStore.activeToken.contract.address, amount, true]);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ export const useTokenStore = defineStore("token", {
|
|||||||
if (walletStore.connected) {
|
if (walletStore.connected) {
|
||||||
//TODO, wenn connected, dann all diese Daten laden?
|
//TODO, wenn connected, dann all diese Daten laden?
|
||||||
this.activeToken.balance = await walletStore.getTokenBalance(token);
|
this.activeToken.balance = await walletStore.getTokenBalance(token);
|
||||||
this.activeToken.allowance = await this.allowance();
|
this.activeToken.allowance = Number(await this.allowance());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async allowance() {
|
async allowance() {
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
import { defineStore } from "pinia";
|
||||||
|
import { useWalletStoreV2 } from "@/stores/walletV2";
|
||||||
|
import QuoterJson from "@/assets/contracts/Quoter.json";
|
||||||
|
import UniswapPoolJson from "@/assets/contracts/UniswapPool.json";
|
||||||
|
import { useMemeburnerStore } from "@/stores/memeburner";
|
||||||
|
|
||||||
|
import { getContract, multicall } from "@wagmi/core";
|
||||||
|
|
||||||
|
export const useUniswapStore = defineStore("uniswap", {
|
||||||
|
state: () => ({
|
||||||
|
quoateV3Contract: {},
|
||||||
|
quoateV2Contract: {},
|
||||||
|
uniswapPoolContract: {},
|
||||||
|
poolData: {
|
||||||
|
token0: null,
|
||||||
|
token1: null,
|
||||||
|
fee: null,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
getters: {},
|
||||||
|
actions: {
|
||||||
|
init() {
|
||||||
|
console.log("init uniswap");
|
||||||
|
const walletStore = useWalletStoreV2();
|
||||||
|
|
||||||
|
this.quoateV3Contract = getContract({
|
||||||
|
address: QuoterJson.contractAddress,
|
||||||
|
abi: QuoterJson.abi,
|
||||||
|
walletClient: walletStore.walletClient || walletStore.publicClient,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.uniswapPoolContract = getContract({
|
||||||
|
address: UniswapPoolJson.contractAddress,
|
||||||
|
abi: UniswapPoolJson.abi,
|
||||||
|
walletClient: walletStore.walletClient || walletStore.publicClient,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.getPoolData();
|
||||||
|
},
|
||||||
|
|
||||||
|
async quoteExactInputSingle(amount) {
|
||||||
|
console.log("quoteExactInputSingle");
|
||||||
|
const memeBurnerStore = useMemeburnerStore();
|
||||||
|
var amountEthBase = await memeBurnerStore.getAmountETHBase(amount);
|
||||||
|
console.log("123", {
|
||||||
|
token1: this.poolData.token1,
|
||||||
|
token0: this.poolData.token0,
|
||||||
|
fee: this.poolData.fee,
|
||||||
|
amountEthBase,
|
||||||
|
pricelimit: 0, //sqrtPriceLimitX96
|
||||||
|
});
|
||||||
|
const quotedAmountOut = await this.quoateV3Contract.read.quoteExactInputSingle([
|
||||||
|
this.poolData.token1,
|
||||||
|
this.poolData.token0,
|
||||||
|
this.poolData.fee,
|
||||||
|
amountEthBase,
|
||||||
|
0, //sqrtPriceLimitX96
|
||||||
|
]);
|
||||||
|
return quotedAmountOut;
|
||||||
|
},
|
||||||
|
async getPoolData() {
|
||||||
|
console.log("getPoolData");
|
||||||
|
const contracts = [];
|
||||||
|
contracts.push(
|
||||||
|
{
|
||||||
|
...this.uniswapPoolContract,
|
||||||
|
functionName: "token0",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...this.uniswapPoolContract,
|
||||||
|
functionName: "token1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...this.uniswapPoolContract,
|
||||||
|
functionName: "fee",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const data = await multicall({
|
||||||
|
contracts,
|
||||||
|
});
|
||||||
|
this.poolData.token0 = data[0].result;
|
||||||
|
this.poolData.token1 = data[1].result;
|
||||||
|
this.poolData.fee = data[2].result;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
+66
-54
@@ -7,67 +7,67 @@
|
|||||||
<div class="mid-mid-text">{{ getAddressShortName(walletStore.address) }}</div>
|
<div class="mid-mid-text">{{ getAddressShortName(walletStore.address) }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="total-rewards-wrapper">
|
<template v-if="!walletStore.connected">
|
||||||
<div class="total-rewards-headline mid-text text-center">Total Rewards</div>
|
<div class="profile-not-connected low-mid-text">
|
||||||
<claim-component></claim-component>
|
Connect your wallet to see your profile.
|
||||||
</div>
|
<div class="btn btn-immortal" @click="showPanel = true">Connect</div>
|
||||||
<template v-if="!isMobile">
|
</div>
|
||||||
<stake-component-v1 :variant="2"> </stake-component-v1>
|
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<stake-component-v1> </stake-component-v1>
|
<div class="total-rewards-wrapper">
|
||||||
</template>
|
<div class="total-rewards-headline mid-text text-center">Total Rewards</div>
|
||||||
<div class="profile-stake">
|
<claim-component></claim-component>
|
||||||
<!-- <stake-component>
|
|
||||||
<template v-slot:headline> Staked </template>
|
|
||||||
<template v-slot:subheadline>
|
|
||||||
Stake for a 25% bonus on your sacrifice. Upper limit is your stake.
|
|
||||||
</template>
|
|
||||||
</stake-component> -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="most-sacrificed-wrapper" v-if="false">
|
|
||||||
<div class="most-sacrificed-inner">
|
|
||||||
<div class="most-sacrificed-left">
|
|
||||||
<div class="most-sacrificed-header">Bloodline Clan</div>
|
|
||||||
<div class="most-sacrificed-subheader">Most sacrificed</div>
|
|
||||||
</div>
|
|
||||||
<div class="most-sacrificed-right">
|
|
||||||
<div class="most-sacrificed-coin-logo">
|
|
||||||
<img src="/assets/img/token/pepevamp.png" alt="" />
|
|
||||||
</div>
|
|
||||||
<div class="most-sacrificed-coin-name">$PEPE</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<template v-if="!isMobile">
|
||||||
<div class="total-sacrificed-wrapper" v-if="false">
|
<stake-component-v1 :variant="2"> </stake-component-v1>
|
||||||
<div class="total-sacrificed-inner">
|
</template>
|
||||||
<div class="total-sacrificed-header">Total Sacrifice</div>
|
<template v-else>
|
||||||
<div class="total-sacrificed-coins">
|
<stake-component-v1> </stake-component-v1>
|
||||||
<div class="total-sacrificed-coin">
|
</template>
|
||||||
<div class="total-sacrificed-coin-amount">1,2b</div>
|
|
||||||
<div class="total-sacrificed-coin-logo">
|
<div class="most-sacrificed-wrapper" v-if="false">
|
||||||
|
<div class="most-sacrificed-inner">
|
||||||
|
<div class="most-sacrificed-left">
|
||||||
|
<div class="most-sacrificed-header">Bloodline Clan</div>
|
||||||
|
<div class="most-sacrificed-subheader">Most sacrificed</div>
|
||||||
|
</div>
|
||||||
|
<div class="most-sacrificed-right">
|
||||||
|
<div class="most-sacrificed-coin-logo">
|
||||||
<img src="/assets/img/token/pepevamp.png" alt="" />
|
<img src="/assets/img/token/pepevamp.png" alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div class="total-sacrificed-coin-name">$PEPE</div>
|
<div class="most-sacrificed-coin-name">$PEPE</div>
|
||||||
</div>
|
|
||||||
<div class="total-sacrificed-coin">
|
|
||||||
<div class="total-sacrificed-coin-amount">139m</div>
|
|
||||||
<div class="total-sacrificed-coin-logo">
|
|
||||||
<img src="/assets/img/token/shibvamp.png" alt="" />
|
|
||||||
</div>
|
|
||||||
<div class="total-sacrificed-coin-name">$SHIB</div>
|
|
||||||
</div>
|
|
||||||
<div class="total-sacrificed-coin">
|
|
||||||
<div class="total-sacrificed-coin-amount">0</div>
|
|
||||||
<div class="total-sacrificed-coin-logo">
|
|
||||||
<img src="/assets/img/token/elonvamp.png" alt="" />
|
|
||||||
</div>
|
|
||||||
<div class="total-sacrificed-coin-name">$ELON</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="total-sacrificed-wrapper" v-if="false">
|
||||||
|
<div class="total-sacrificed-inner">
|
||||||
|
<div class="total-sacrificed-header">Total Sacrifice</div>
|
||||||
|
<div class="total-sacrificed-coins">
|
||||||
|
<div class="total-sacrificed-coin">
|
||||||
|
<div class="total-sacrificed-coin-amount">1,2b</div>
|
||||||
|
<div class="total-sacrificed-coin-logo">
|
||||||
|
<img src="/assets/img/token/pepevamp.png" alt="" />
|
||||||
|
</div>
|
||||||
|
<div class="total-sacrificed-coin-name">$PEPE</div>
|
||||||
|
</div>
|
||||||
|
<div class="total-sacrificed-coin">
|
||||||
|
<div class="total-sacrificed-coin-amount">139m</div>
|
||||||
|
<div class="total-sacrificed-coin-logo">
|
||||||
|
<img src="/assets/img/token/shibvamp.png" alt="" />
|
||||||
|
</div>
|
||||||
|
<div class="total-sacrificed-coin-name">$SHIB</div>
|
||||||
|
</div>
|
||||||
|
<div class="total-sacrificed-coin">
|
||||||
|
<div class="total-sacrificed-coin-amount">0</div>
|
||||||
|
<div class="total-sacrificed-coin-logo">
|
||||||
|
<img src="/assets/img/token/elonvamp.png" alt="" />
|
||||||
|
</div>
|
||||||
|
<div class="total-sacrificed-coin-name">$ELON</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- <div class="cycle-wrapper">
|
<!-- <div class="cycle-wrapper">
|
||||||
<div class="cycle-inner">
|
<div class="cycle-inner">
|
||||||
@@ -168,7 +168,7 @@ import { useRoundsStore } from "@/stores/rounds";
|
|||||||
import { useWalletStoreV2 } from "@/stores/walletV2";
|
import { useWalletStoreV2 } from "@/stores/walletV2";
|
||||||
|
|
||||||
import { getblocky, getAddressShortName } from "@/helper/helper.js";
|
import { getblocky, getAddressShortName } from "@/helper/helper.js";
|
||||||
import StakeComponent from "@/components/StakeComponent.vue";
|
import CardComponent from "@/components/CardComponent.vue";
|
||||||
import StakeComponentV1 from "@/components/StakeComponentV1.vue";
|
import StakeComponentV1 from "@/components/StakeComponentV1.vue";
|
||||||
import ClaimComponent from "@/components/ClaimComponent.vue";
|
import ClaimComponent from "@/components/ClaimComponent.vue";
|
||||||
|
|
||||||
@@ -180,6 +180,7 @@ const walletStore = useWalletStoreV2();
|
|||||||
const rewardLockerStore = useRewardLockerStore();
|
const rewardLockerStore = useRewardLockerStore();
|
||||||
const memeBurnerStore = useMemeburnerStore();
|
const memeBurnerStore = useMemeburnerStore();
|
||||||
const isMobile = inject("isMobile");
|
const isMobile = inject("isMobile");
|
||||||
|
const showPanel = inject("showPanel");
|
||||||
|
|
||||||
const activeRound = ref(null);
|
const activeRound = ref(null);
|
||||||
const openCycleElement = ref(false);
|
const openCycleElement = ref(false);
|
||||||
@@ -421,4 +422,15 @@ const rounds = computed(() => {
|
|||||||
.arrow
|
.arrow
|
||||||
width: 14px
|
width: 14px
|
||||||
padding: 0 16px
|
padding: 0 16px
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.profile-not-connected
|
||||||
|
border-radius: 16px
|
||||||
|
padding: 16px
|
||||||
|
gap: 16px
|
||||||
|
display: flex
|
||||||
|
flex-direction: column
|
||||||
|
text-align: center
|
||||||
|
background: var(--darkgrey, #202020)
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+79
-1
@@ -9,6 +9,7 @@
|
|||||||
<button @click="">unstake</button>
|
<button @click="">unstake</button>
|
||||||
<button @click="fetchBalance">fetchBalance</button>
|
<button @click="fetchBalance">fetchBalance</button>
|
||||||
<button @click="claimView">claimview</button>
|
<button @click="claimView">claimview</button>
|
||||||
|
<button @click="testQuoter(token0, token1, fee)">quoater</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -18,11 +19,14 @@ import Meme1Json from "@/assets/contracts/Meme1.json";
|
|||||||
import Meme2Json from "@/assets/contracts/Meme2.json";
|
import Meme2Json from "@/assets/contracts/Meme2.json";
|
||||||
import MemeBurnerJson from "@/assets/contracts/Bloodline.json";
|
import MemeBurnerJson from "@/assets/contracts/Bloodline.json";
|
||||||
import RewardLockerJson from "@/assets/contracts/RewardLocker.json";
|
import RewardLockerJson from "@/assets/contracts/RewardLocker.json";
|
||||||
|
import QuoterJson from "@/assets/contracts/Quoter.json";
|
||||||
|
import UniswapPoolJson from "@/assets/contracts/UniswapPool.json";
|
||||||
|
import MemeAltarJson from "@/assets/contracts/MemeAltar.json";
|
||||||
import { useTokenStore } from "@/stores/tokens";
|
import { useTokenStore } from "@/stores/tokens";
|
||||||
import { useWalletStoreV2 } from "@/stores/walletV2";
|
import { useWalletStoreV2 } from "@/stores/walletV2";
|
||||||
import { useRewardLockerStore } from "@/stores/rewardlocker";
|
import { useRewardLockerStore } from "@/stores/rewardlocker";
|
||||||
import { useMemeburnerStore } from "@/stores/memeburner";
|
import { useMemeburnerStore } from "@/stores/memeburner";
|
||||||
import { signTypedData } from "@wagmi/core";
|
import { signTypedData, getContract } from "@wagmi/core";
|
||||||
|
|
||||||
const tokenStore = useTokenStore();
|
const tokenStore = useTokenStore();
|
||||||
const walletV2Store = useWalletStoreV2();
|
const walletV2Store = useWalletStoreV2();
|
||||||
@@ -39,8 +43,50 @@ const contractMeme1 = ref(null);
|
|||||||
const contractBurner = ref(null);
|
const contractBurner = ref(null);
|
||||||
const contractBloodline = ref(null);
|
const contractBloodline = ref(null);
|
||||||
const rewardlocker = ref(null);
|
const rewardlocker = ref(null);
|
||||||
|
const contractQuoter = ref(null);
|
||||||
|
const poolContract = ref(null);
|
||||||
|
const memeAltarContract = ref(null);
|
||||||
|
const token0 = ref(null);
|
||||||
|
const token1 = ref(null);
|
||||||
|
const fee = ref(null);
|
||||||
|
const amountETHBase = ref(null);
|
||||||
|
const amount = 100 * Math.pow(10, 18);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
contractQuoter.value = getContract({
|
||||||
|
address: QuoterJson.contractAddress,
|
||||||
|
abi: QuoterJson.abi,
|
||||||
|
walletClient: walletV2Store.walletClient || walletV2Store.publicClient,
|
||||||
|
});
|
||||||
|
|
||||||
|
poolContract.value = getContract({
|
||||||
|
address: UniswapPoolJson.contractAddress,
|
||||||
|
abi: UniswapPoolJson.abi,
|
||||||
|
walletClient: walletV2Store.walletClient || walletV2Store.publicClient,
|
||||||
|
});
|
||||||
|
|
||||||
|
memeAltarContract.value = getContract({
|
||||||
|
address: MemeAltarJson.contractAddress,
|
||||||
|
abi: MemeAltarJson.abi,
|
||||||
|
walletClient: walletV2Store.walletClient || walletV2Store.publicClient,
|
||||||
|
});
|
||||||
|
console.log("poolContract.value", poolContract.value);
|
||||||
|
|
||||||
|
token0.value = await poolContract.value.read.token0();
|
||||||
|
token1.value = await poolContract.value.read.token1();
|
||||||
|
fee.value = await poolContract.value.read.fee();
|
||||||
|
|
||||||
|
console.log("input-amountEthBASE", {
|
||||||
|
memeToSacrifice: "0x4435ABC578136e2Eca50b5EFf950F17CAF42485b",
|
||||||
|
amountToSacrifice: amount,
|
||||||
|
roundParticipant: true,
|
||||||
|
});
|
||||||
|
amountETHBase.value = await memeAltarContract.value.read.getAmountETHBase([
|
||||||
|
"0x4435ABC578136e2Eca50b5EFf950F17CAF42485b",
|
||||||
|
amount,
|
||||||
|
true,
|
||||||
|
]);
|
||||||
|
console.log("amountETHBase", amountETHBase.value);
|
||||||
// web3.value = new Web3(window.ethereum);
|
// web3.value = new Web3(window.ethereum);
|
||||||
// // const contract = new web3.value.eth.Contract(Meme1Json.abi, Meme1Json.contractAddress);
|
// // const contract = new web3.value.eth.Contract(Meme1Json.abi, Meme1Json.contractAddress);
|
||||||
// console.log("web3", web3.value);
|
// console.log("web3", web3.value);
|
||||||
@@ -53,6 +99,38 @@ onMounted(async () => {
|
|||||||
// );
|
// );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function testQuoter(token0, token1, fee) {
|
||||||
|
console.log("inputQuote", {
|
||||||
|
token1: token1,
|
||||||
|
token0: token0,
|
||||||
|
fee: fee,
|
||||||
|
amountETHBase: amountETHBase.value,
|
||||||
|
sqrtPriceLimitX96: 0,
|
||||||
|
});
|
||||||
|
const quotedAmountOut = await contractQuoter.value.read.quoteExactInputSingle([
|
||||||
|
token1,
|
||||||
|
token0,
|
||||||
|
fee,
|
||||||
|
amountETHBase.value,
|
||||||
|
0,
|
||||||
|
]);
|
||||||
|
//rewardsUniswap3
|
||||||
|
//if getrewardforsacrifice 5% less than quoater amount
|
||||||
|
//buy below issuanceprice
|
||||||
|
//0 should be the issuanceprice (memealtar.issuanceprice)
|
||||||
|
//if input 0 not allow sacrifice
|
||||||
|
//before allowance just compare quoater with getrewardforsacrifice
|
||||||
|
//after allowance eth_call sacrificememe and sacrificebuyblood
|
||||||
|
//if error quoater --> usesacrificememe
|
||||||
|
|
||||||
|
//on sacrificememe calculate minEthAmount )
|
||||||
|
//on bloodbuy calculate minBloodamount (quoatedAmount * 0,995) - 100
|
||||||
|
//0,995 Schlupf (siehe app.uniswap (0,5%))
|
||||||
|
//if the price move more like this Schlupf (0,5%), dann revert
|
||||||
|
//uniswapv2 quoater for sacrificememe
|
||||||
|
console.log("quotedAmountOut", quotedAmountOut);
|
||||||
|
}
|
||||||
|
|
||||||
async function claimView() {
|
async function claimView() {
|
||||||
var resultStake = await rewardLockerStore.contract.read.claim([[0, 1, 2]]);
|
var resultStake = await rewardLockerStore.contract.read.claim([[0, 1, 2]]);
|
||||||
console.log("resultStake", resultStake);
|
console.log("resultStake", resultStake);
|
||||||
|
|||||||
Reference in New Issue
Block a user