toast rework + fix bugs

This commit is contained in:
EmberSpirit
2023-10-04 17:20:21 +02:00
parent 3d53d9e7c8
commit 64d46693ea
24 changed files with 713 additions and 1464 deletions
+10 -1
View File
@@ -22,7 +22,8 @@
"viem": "^1.4.1",
"vue": "^3.3.2",
"vue-collapsed": "^1.2.8",
"vue-router": "^4.2.0"
"vue-router": "^4.2.0",
"vue-toastification": "^2.0.0-rc.5"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
@@ -5813,6 +5814,14 @@
"vue": "^3.2.0"
}
},
"node_modules/vue-toastification": {
"version": "2.0.0-rc.5",
"resolved": "https://registry.npmjs.org/vue-toastification/-/vue-toastification-2.0.0-rc.5.tgz",
"integrity": "sha512-q73e5jy6gucEO/U+P48hqX+/qyXDozAGmaGgLFm5tXX4wJBcVsnGp4e/iJqlm9xzHETYOilUuwOUje2Qg1JdwA==",
"peerDependencies": {
"vue": "^3.0.2"
}
},
"node_modules/web3-eth-abi": {
"version": "1.10.1",
"resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.10.1.tgz",
+2 -1
View File
@@ -23,7 +23,8 @@
"viem": "^1.4.1",
"vue": "^3.3.2",
"vue-collapsed": "^1.2.8",
"vue-router": "^4.2.0"
"vue-router": "^4.2.0",
"vue-toastification": "^2.0.0-rc.5"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
+2 -23
View File
@@ -37,7 +37,6 @@ const { memeBurner, token } = storeToRefs(tokenStore);
const { list } = storeToRefs(contractStore);
const isMobile = ref(false);
const showPanel = ref(false);
const showModal = ref(false);
const eventWatch = ref(null);
const netWorkEvent = ref(null);
const memeSacrificedEvent = ref(null);
@@ -93,7 +92,6 @@ function changeRoute(name) {
}
provide("isMobile", isMobile);
provide("showPanel", showPanel);
provide("showModal", showModal);
onMounted(async () => {
console.log("onmounted");
@@ -144,27 +142,6 @@ onMounted(async () => {
<slideout-panel v-model="showPanel">
<connect-wallet></connect-wallet>
</slideout-panel>
<div class="modal-overlay" v-show="showModal">
<card-component class="modal-card">
<div class="body">
<div class="header">
<img alt="logo" class="logo" src="/assets/img/vampir.png" />
</div>
<div class="subheader toast-header">
Success!<br />
You turned your meme into:
</div>
<div class="amount-number">
<div class="token-amount number-mobile">{{ tokenStore.activeToken.rewards }}</div>
<div class="token-name">$Blood</div>
</div>
<div class="info toast-body">
You can claim once the current cycle is finished and your clan bonus was calculated
</div>
</div>
<div class="btn btn-immortal" @click="showModal = false">Okay</div>
</card-component>
</div>
<div class="main" :class="{ 'no-scroll': showPanel, mobile: isMobile }">
<RouterView />
</div>
@@ -283,6 +260,8 @@ onMounted(async () => {
@media (min-width: 992px)
background-color: unset
.modal-card
border-radius: 16px
padding: 16px
width: 342px
text-align: center
position: absolute
+1 -1
View File
@@ -1,6 +1,6 @@
{
"contractName": "Bloodline",
"contractAddress": "0x00E5DAd5dA0FC4Da0baB7f0D99E28C07d8A88ee4",
"contractAddress": "0xBd6bB82108D5F27E8A8f081723408bF26d665a8c",
"abi": [
{
"inputs": [
+146 -327
View File
@@ -1,6 +1,6 @@
{
"contractName": "LiquidityOwner",
"contractAddress": "0x947f05D74ac7dA0Eb0CA88eF9b579D196B178BaE",
"contractAddress": "0xEb898F92F7db3bbF807513C847bfDeE846E1b5Ff",
"abi": [
{
"inputs": [
@@ -19,24 +19,79 @@
"name": "_weth",
"type": "address"
},
{
"internalType": "address",
"name": "_nfPositionManager",
"type": "address"
},
{
"internalType": "address",
"name": "_memeAltar",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "CurrentPriceDisallowsToProvide",
"type": "error"
},
{
"inputs": [],
"name": "NothingToProvide",
"type": "error"
},
{
"inputs": [],
"name": "ProjectAlive",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "int24",
"name": "tickLower",
"type": "int24"
},
{
"indexed": true,
"internalType": "int24",
"name": "tickUpper",
"type": "int24"
},
{
"indexed": true,
"internalType": "uint256",
"name": "_chunk",
"name": "amountWETH",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "constructor"
"name": "LiquidityProvided",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "int24",
"name": "tickLower",
"type": "int24"
},
{
"indexed": true,
"internalType": "int24",
"name": "tickUpper",
"type": "int24"
},
{
"indexed": true,
"internalType": "uint256",
"name": "amountWETH",
"type": "uint256"
}
],
"name": "LiquidityShouldBeProvidedLater",
"type": "event"
},
{
"inputs": [
@@ -62,69 +117,6 @@
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "int24",
"name": "tickLower",
"type": "int24"
},
{
"internalType": "int24",
"name": "tickUpper",
"type": "int24"
},
{
"internalType": "uint128",
"name": "liquidity",
"type": "uint128"
},
{
"internalType": "uint80",
"name": "tokenId",
"type": "uint80"
}
],
"internalType": "struct LiquidityOwner.Position",
"name": "position",
"type": "tuple"
}
],
"name": "addETHPositionToLinkedList",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "int24",
"name": "_tickLower",
"type": "int24"
},
{
"internalType": "int24",
"name": "_tickUpper",
"type": "int24"
},
{
"internalType": "uint256",
"name": "amountBloodline",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amountWETH",
"type": "uint256"
}
],
"name": "addNewPosition",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
@@ -133,12 +125,17 @@
"type": "int48"
}
],
"name": "allRangesLinkedList",
"name": "_positions",
"outputs": [
{
"internalType": "int48",
"name": "",
"type": "int48"
"internalType": "uint112",
"name": "providedETH",
"type": "uint112"
},
{
"internalType": "uint112",
"name": "unprovidedETH",
"type": "uint112"
}
],
"stateMutability": "view",
@@ -157,45 +154,30 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "burn",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "chunk",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256[]",
"name": "liquidityTokenIds",
"type": "uint256[]"
"internalType": "int24",
"name": "tickLower",
"type": "int24"
},
{
"internalType": "int24",
"name": "tickUpper",
"type": "int24"
}
],
"name": "collectDeveloperFees",
"outputs": [
{
"internalType": "uint256",
"name": "amount0",
"type": "uint256"
"internalType": "uint128",
"name": "wethAmount",
"type": "uint128"
},
{
"internalType": "uint256",
"name": "amount1",
"type": "uint256"
"internalType": "uint128",
"name": "bloodlineAmount",
"type": "uint128"
}
],
"stateMutability": "nonpayable",
@@ -206,79 +188,14 @@
"name": "collectedEthTotal",
"outputs": [
{
"internalType": "uint256",
"internalType": "uint112",
"name": "",
"type": "uint256"
"type": "uint112"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "currentTokenIdToFill",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint128",
"name": "liquidity",
"type": "uint128"
}
],
"name": "decreasePositionLiquidity",
"outputs": [
{
"internalType": "uint256",
"name": "amount0",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amount1",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amountWETH",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amountBloodline",
"type": "uint256"
}
],
"name": "increasePositionLiquidity",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "memeAltar",
@@ -292,96 +209,15 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256[]",
"name": "positionsToCancel",
"type": "uint256[]"
},
{
"internalType": "uint256",
"name": "amountOfWETHToUse",
"type": "uint256"
}
],
"name": "movePriceUP",
"outputs": [
{
"internalType": "uint256",
"name": "amount0Collected",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amount1Collected",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "nfPositionManager",
"outputs": [
{
"internalType": "contract INonfungiblePositionManager",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"name": "onERC721Received",
"outputs": [
{
"internalType": "bytes4",
"name": "",
"type": "bytes4"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "developerFee",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amountOfETHToPaySender",
"type": "uint256"
}
],
"name": "payDeveloperFeeAndForGas",
"name": "payDeveloperFee",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
@@ -405,15 +241,33 @@
"type": "function"
},
{
"inputs": [
"inputs": [],
"name": "pool",
"outputs": [
{
"internalType": "uint256",
"internalType": "contract IUniswapV3Pool",
"name": "",
"type": "uint256"
"type": "address"
}
],
"name": "positions",
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "previousBLDTotalSupply",
"outputs": [
{
"internalType": "uint128",
"name": "",
"type": "uint128"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "int24",
"name": "tickLower",
@@ -423,29 +277,37 @@
"internalType": "int24",
"name": "tickUpper",
"type": "int24"
},
{
"internalType": "uint128",
"name": "liquidity",
"type": "uint128"
},
{
"internalType": "uint80",
"name": "tokenId",
"type": "uint80"
}
],
"stateMutability": "view",
"name": "provideUnprovidedLiquidity",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "rebalance",
"inputs": [
{
"internalType": "int24",
"name": "tickLower",
"type": "int24"
},
{
"internalType": "int24",
"name": "tickUpper",
"type": "int24"
}
],
"name": "rageQuit",
"outputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
"internalType": "uint128",
"name": "wethAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "bloodlineAmount",
"type": "uint128"
}
],
"stateMutability": "nonpayable",
@@ -454,28 +316,9 @@
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "tokenIds",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"internalType": "uint112",
"name": "collectedEthInRound",
"type": "uint256"
"type": "uint112"
}
],
"name": "triggerRoundCompleted",
@@ -489,38 +332,25 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "uniV3Pool",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "int256",
"name": "amount0Delta",
"type": "int256"
"internalType": "uint256",
"name": "amount0Owed",
"type": "uint256"
},
{
"internalType": "int256",
"name": "amount1Delta",
"type": "int256"
"internalType": "uint256",
"name": "amount1Owed",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "_data",
"name": "",
"type": "bytes"
}
],
"name": "uniswapV3SwapCallback",
"name": "uniswapV3MintCallback",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
@@ -537,17 +367,6 @@
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "withdrawETH",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
}
+12 -7
View File
@@ -1,6 +1,6 @@
{
"contractName": "MemeAltar",
"contractAddress": "0x9842954639aF0c1d7A692222955868806287aeEA",
"contractAddress": "0x9fA80C0A942016A0a246402e97d30562CF93f5AE",
"abi": [
{
"inputs": [
@@ -484,6 +484,11 @@
"internalType": "uint256",
"name": "amountETHBase",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amountETHForSelling",
"type": "uint256"
}
],
"stateMutability": "view",
@@ -495,11 +500,6 @@
"internalType": "address",
"name": "memeToSacrifice",
"type": "address"
},
{
"internalType": "bool",
"name": "buyFunc",
"type": "bool"
}
],
"name": "getAmountToReachGoal",
@@ -549,7 +549,12 @@
"outputs": [
{
"internalType": "uint256",
"name": "",
"name": "rewardCurrentCycle",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "rewardNextCycle",
"type": "uint256"
}
],
+5 -5
View File
@@ -1,6 +1,6 @@
{
"contractName": "RewardLocker",
"contractAddress": "0xc9f5F78320D0f75099eEA8f8F6FD35BF246f0916",
"contractAddress": "0xC21568120adc35AB0aA7460A4A5E1C3D4f845269",
"abi": [
{
"inputs": [
@@ -551,14 +551,14 @@
"name": "rounds",
"outputs": [
{
"internalType": "uint256",
"internalType": "uint32",
"name": "roundCompletedTimestamp",
"type": "uint256"
"type": "uint32"
},
{
"internalType": "uint256",
"internalType": "uint224",
"name": "totalSacrificeCompetitionRewards",
"type": "uint256"
"type": "uint224"
},
{
"internalType": "uint256",
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
[{"inputs":[{"internalType":"address","name":"meme","type":"address"},{"internalType":"address","name":"uniV2Pool","type":"address"}],"name":"addMemeToList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"b1","type":"uint8"},{"internalType":"uint8","name":"m1","type":"uint8"},{"internalType":"uint8","name":"b2","type":"uint8"},{"internalType":"uint8","name":"m2","type":"uint8"},{"internalType":"uint8","name":"b3","type":"uint8"},{"internalType":"uint8","name":"m4","type":"uint8"}],"internalType":"struct MemeAltar.BM","name":"newBM","type":"tuple"}],"name":"adjustBM","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newDefaultGoal","type":"uint256"}],"name":"adjustDefaultGoal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newDurationLimit","type":"uint256"}],"name":"adjustRoundDurationLimit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"meme","type":"address"}],"name":"removeMemeFromList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"switchAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFixedPrice","type":"uint256"}],"name":"adjustFixedPrice","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
[{"inputs":[{"internalType":"address","name":"meme","type":"address"},{"internalType":"address","name":"uniV2Pool","type":"address"}],"name":"addMemeToList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint40","name":"b1","type":"uint40"},{"internalType":"uint40","name":"m1","type":"uint40"},{"internalType":"uint40","name":"b2","type":"uint40"},{"internalType":"uint40","name":"m2","type":"uint40"},{"internalType":"uint40","name":"b3","type":"uint40"},{"internalType":"uint40","name":"m4","type":"uint40"}],"internalType":"struct MemeAltar.BM","name":"newBM","type":"tuple"}],"name":"adjustBM","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint112","name":"newDefaultGoal","type":"uint112"}],"name":"adjustDefaultGoal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"newDurationLimit","type":"uint32"}],"name":"adjustRoundDurationLimit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"switchAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"meme","type":"address"},{"internalType":"address","name":"newUniV2Pool","type":"address"}],"name":"switchUniV2Pool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"meme","type":"address"}],"name":"removeMemeFromList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
+2
View File
@@ -6,6 +6,7 @@
src="/assets/img/blood-arrow-left.png"
alt="left-arrow"
@click="swiperInstance.slidePrev()"
v-if="token.length > 3"
/>
</div>
<swiper
@@ -80,6 +81,7 @@
src="/assets/img/blood-arrow-right.png"
alt="left-arrow"
@click="swiperInstance.slideNext()"
v-if="token.length > 3"
/>
</div>
</div>
+144 -5
View File
@@ -12,7 +12,13 @@
<template v-if="walletStore.memeToken?.unclaimedRewards > 0">
<Transition name="smooth">
<div class="connected-stake-buttons" v-show="!stakeMenu">
<div class="btn btn-immortal mid-mid-text" @click="rewardLockerStore.claimAll">Claim</div>
<div class="btn btn-immortal mid-mid-text" @click="claimAll" v-if="stateStake === 0">Claim</div>
<div class="btn btn-immortal mid-mid-text" disabled v-else-if="stateStake === 2">
Sign Transaction
</div>
<div class="btn btn-immortal stake-button" disabled v-else-if="stateStake === 3">
<loading-component></loading-component>
</div>
<div class="btn btn-immortal mid-mid-text" @click="openStake">Stake</div>
</div>
</Transition>
@@ -25,9 +31,22 @@
v-if="stakeMenu"
>
<template v-slot:body>
<div class="btn btn-immortal stake-button" @click="stakeAndClaimAllRounds">
<div class="btn btn-immortal stake-button" disabled v-if="stateClaimComp === 0">
Enter Amount
</div>
<div
class="btn btn-immortal stake-button"
v-else-if="stateClaimComp === 1"
@click="stakeAndClaimAllRounds"
>
Stake & Claim Rest
</div>
<div class="btn btn-immortal stake-button" disabled v-if="stateClaimComp === 2">
Sign Transaction
</div>
<div class="btn btn-immortal stake-button" disabled v-if="stateClaimComp === 3">
<loading-component></loading-component>
</div>
<div
class="btn transparent small-text cancel-button text-center"
@click="stakeMenu = false"
@@ -35,6 +54,9 @@
Cancel
</div>
</template>
<template v-slot:message-end>
<div class="input-balance">Balance: {{ walletStore.memeToken?.unclaimedRewards }}</div>
</template>
</stake-menu>
</Transition>
<div class="connected-stake-first-round small-text text-center">
@@ -52,17 +74,22 @@
</template>
<script setup>
import { ref } from "vue";
import { ref, computed } from "vue";
import CardComponent from "@/components/CardComponent.vue";
import StakeMenu from "@/components/StakeMenu.vue";
import TokenNamePrice from "@/components/TokenNamePrice.vue";
import TokenLogo from "@/components/TokenLogo.vue";
import { waitForTransaction } from "@wagmi/core";
import LoadingComponent from "@/components/LoadingComponent.vue";
import StakeSuccessToast from "@/components/toasts/StakeSuccessToast.vue";
import { useWalletStoreV2 } from "@/stores/walletV2";
import { useTokenStore } from "@/stores/tokens";
import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useRouter } from "vue-router";
import { useToast } from "vue-toastification";
const toast = useToast();
const rewardLockerStore = useRewardLockerStore();
const walletStore = useWalletStoreV2();
const tokenStore = useTokenStore();
@@ -79,6 +106,15 @@ const props = defineProps({
const stakeMenu = ref(false);
const stake = ref(null);
const tokenNumber = ref(null);
/**
* state 0 enter amount
* state 1 rdy to go
* state 2 signing
* state 3 loading
* state 4 staked
*/
const state = ref(0);
const stateClaim = ref(0);
function openStake() {
stake.value = true;
@@ -91,9 +127,112 @@ function openUnstake() {
}
async function stakeAndClaimAllRounds() {
try {
stateClaim.value = 2;
console.log("tokenNumber.value", tokenNumber.value);
console.log("walletStore.memeToken?.unclaimedRewards", walletStore.memeToken?.unclaimedRewards);
const coefficient = (10000 * tokenNumber.value) / walletStore.memeToken?.unclaimedRewards;
var hash = await rewardLockerStore.stakeAndClaimAllRounds(coefficient);
stateClaim.value = 3;
const data = await waitForTransaction({
hash: hash,
});
stateClaim.value = 4;
await walletStore.loadWalletData();
showSuccessToast(
walletStore.memeToken?.unclaimedRewards,
"Success!",
"You just claimed and staked",
"Join the next cycle to increase your rewards and win with your clan"
);
} catch (error) {
stateClaim.value = 0;
console.error(error);
throw new Error(error);
}
}
async function claimAll() {
try {
state.value = 2;
const hash = await rewardLockerStore.claimAll();
state.value = 3;
const data = await waitForTransaction({
hash: hash,
});
console.log("data", data);
await walletStore.loadWalletData();
showSuccessToast(
walletStore.memeToken?.unclaimedRewards,
"Success!",
"You just claimed",
"Join the next cycle to increase your rewards and win with your clan."
);
} catch (error) {
state.value = 0;
console.error(error);
throw new Error(error);
}
}
const stateStake = computed(() => {
let returnState = 0;
if (state.value === 2) {
returnState = 2;
} else if (state.value === 3) {
returnState = 3;
}
return returnState;
});
const stateClaimComp = computed(() => {
let returnState = 0;
console.log("tokenNumber.value", tokenNumber.value);
const coefficient = (10000 * tokenNumber.value) / walletStore.memeToken?.unclaimedRewards;
var result = await rewardLockerStore.stakeAndClaimAllRounds(coefficient);
if (
tokenNumber.value === null ||
tokenNumber.value === "" ||
tokenNumber.value === 0 ||
tokenNumber.value > walletStore.memeToken?.unclaimedRewards
) {
returnState = 0;
} else if (stateClaim.value === 2) {
returnState = 2;
} else if (stateClaim.value === 3) {
returnState = 3;
} else if (tokenNumber.value !== null || tokenNumber.value !== "" || tokenNumber.value > 0) {
returnState = 1;
}
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>
+10 -2
View File
@@ -100,8 +100,16 @@ function badgeClick(token) {
var tokenData = tokenStore.getToken(token.contractAddress);
tokenStore.activeToken = tokenData;
// router.push({ name: "home", hash: `#${tokenData.name}` });
router.push({ name: "home" });
instance.parent.emit("update:modelValue", false);
if (tokenStore.memeToken.contractAddress === token.contractAddress) {
//buy
window.open(
"https://app.uniswap.org/swap?inputCurrency=ETH&outputCurrency=0x00E5DAd5dA0FC4Da0baB7f0D99E28C07d8A88ee4&chain=goerli",
"_blank"
);
} else {
router.push({ name: "home" });
instance.parent.emit("update:modelValue", false);
}
}
async function connectWallet(connector) {
+60 -11
View File
@@ -68,7 +68,7 @@
<div class="sacrifice-to-output-rewards header">{{ output.toFixed(5) }}</div>
</div>
<div class="sacrifice-logo">
<img :src="activeToken.vamp?.logo" :alt="activeToken.vamp.name" />
<img :src="activeToken.vamp?.logo" :alt="activeToken.vamp?.name" />
</div>
</div>
<div class="sacrifice-staking-bonus">
@@ -90,7 +90,7 @@
</stake-component-v1>
</div>
</div>
<div class="sacrificed-info" v-if="state === 4">
<div class="sacrificed-info" v-if="stateComputed === 4">
<div class="left low-mid-text">You can claim your $BLOOD when the cycle is finished.</div>
<div class="right">
<img src="/assets/img/moon.png" alt="moon" />
@@ -109,14 +109,15 @@
</div>
</div>
<div class="sacrifice-buttons-function-wrapper">
{{ stateComputed }}
<template v-if="walletStore.connected">
<div class="btn btn-immortal sub-header" disabled v-if="state === 0">Enter Amount</div>
<div class="btn btn-immortal sub-header" disabled v-if="stateComputed === 0">Enter Amount</div>
<div
class="btn btn-immortal sub-header"
v-if="
activeToken.allowance > 0 &&
activeToken.allowance >= tokenNumber &&
(state === 1 || state === 4)
(stateComputed === 1 || stateComputed === 4)
"
@click="sacrificeToken(tokenNumber)"
>
@@ -126,14 +127,14 @@
class="btn btn-immortal sub-header"
v-if="
(!activeToken.allowance || activeToken.allowance < tokenNumber) &&
(state === 1 || state === 4)
(stateComputed === 1 || stateComputed === 4)
"
@click="approveToken(tokenNumber)"
>
Approve Token
</div>
<div class="btn btn-immortal sub-header" disabled v-if="state === 2">Sign Transaction</div>
<div class="btn btn-immortal sub-header" disabled v-if="state === 3">
<div class="btn btn-immortal sub-header" disabled v-if="stateComputed === 2">Sign Transaction</div>
<div class="btn btn-immortal sub-header" disabled v-if="stateComputed === 3">
<loading-component></loading-component>
</div>
</template>
@@ -154,14 +155,16 @@ import { useUniswapStore } from "@/stores/uniswap";
import StakeComponentV1 from "@/components/StakeComponentV1.vue";
import LoadingComponent from "@/components/LoadingComponent.vue";
import TokenInput from "@/components/TokenInput.vue";
import StakeSuccessToast from "@/components/toasts/StakeSuccessToast.vue";
import { useToast } from "vue-toastification";
const toast = useToast();
import { storeToRefs } from "pinia";
import { waitForTransaction, readContract, watchBlockNumber } from "@wagmi/core";
import Helper from "@/utils/helper.js";
const isMobile = inject("isMobile");
const showPanel = inject("showPanel");
const showModal = inject("showModal");
const walletStore = useWalletStoreV2();
// const { connected } = storeToRefs(walletStore);
@@ -199,6 +202,19 @@ const state = ref(0);
const showStakingMenu = ref(false);
const approvalData = ref(null);
const stateComputed = computed(() => {
let returnState = 0;
if (tokenNumber.value === null || tokenNumber.value === "" || tokenNumber.value === 0) {
returnState = 0;
} else if (state.value === 2) {
returnState = 2;
} else if (state.value === 3) {
returnState = 3;
} else if (tokenNumber.value !== null || tokenNumber.value !== "" || tokenNumber.value > 0) {
returnState = 1;
}
return returnState;
});
const processChange = Helper.debounce((value) => getRewardsFor(value));
onMounted(() => {
@@ -267,7 +283,12 @@ async function sacrificeToken(amount) {
console.log("data", data);
activeToken.value.allowance = await tokenStore.allowance();
state.value = 4;
showModal.value = true;
showSuccessToast(
tokenStore.activeToken.rewards?.toFixed(5),
"Success!",
"You turned your meme into:",
"You can claim once the current cycle is finished and your clan bonus was calculated."
);
} catch (error) {
state.value = 0;
console.error(error);
@@ -288,8 +309,6 @@ async function approveToken(amount) {
} catch (error) {
console.error(error);
throw new Error(error);
} finally {
state.value = 1;
}
}
@@ -385,6 +404,36 @@ async function addTokens(value) {
tokenNumber.value = Number(tokenNumber.value) + Number(value);
output.value = await getRewardsFor(tokenNumber.value).output;
}
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">
+95 -11
View File
@@ -35,7 +35,7 @@
:price="walletStore.memeToken?.staked"
></token-name-price>
<token-logo img="/assets/img/token/bloodline.png" :alt="'^y '"></token-logo>
<token-name-price class="stake-reward" name="Extra Reward" price="+20%"></token-name-price>
<token-name-price class="stake-reward" name="Extra Reward" price="+25%"></token-name-price>
</slot>
</div>
<slot name="actions">
@@ -55,15 +55,22 @@
v-model="tokenNumber"
@close="stakeMenu = false"
:stake="stake"
:amount="walletStore.memeToken.balanceOf"
v-if="stakeMenu & !unstakeMenu"
>
<template v-slot:body>
<div
class="btn btn-immortal stake-button"
@click="rewardLockerStore.stakeBloodline(tokenNumber)"
>
<div class="btn btn-immortal stake-button" disabled v-if="stateStake === 0">
Enter Amount
</div>
<div class="btn btn-immortal stake-button" v-else-if="stateStake === 1" @click="stakeToken">
Stake
</div>
<div class="btn btn-immortal stake-button" disabled v-if="stateStake === 2">
Sign Transaction
</div>
<div class="btn btn-immortal stake-button" disabled v-if="stateStake === 3">
<loading-component></loading-component>
</div>
<div
class="btn transparent small-text cancel-button text-center"
@click="stakeMenu = false"
@@ -71,6 +78,9 @@
Cancel
</div>
</template>
<template v-slot:message-end>
<div class="input-balance">Balance: {{ walletStore.memeToken.balanceOf }}</div>
</template>
</stake-menu>
<div class="unstake-menu" v-else-if="stakeMenu & unstakeMenu">
<div class="low-mid-text text-center">
@@ -90,11 +100,7 @@
</div>
</div>
</Transition>
<!-- todo v-if activeround -->
<div
class="connected-stake-first-round small-text text-center"
v-if="roundStore.currentRound === roundStore.activeRound"
>
<div class="connected-stake-first-round small-text text-center" v-if="roundStore.currentRound === 0">
No $BLOOD on the market. Staking is activated after the first cycle is finished.
</div>
<div class="connected-stake-claim-info low-mid-text text-center">
@@ -107,17 +113,22 @@
</template>
<script setup>
import { ref, useSlots } from "vue";
import { ref, useSlots, computed } from "vue";
import CardComponent from "@/components/CardComponent.vue";
import StakeSuccessToast from "@/components/toasts/StakeSuccessToast.vue";
import StakeMenu from "@/components/StakeMenu.vue";
import TokenNamePrice from "@/components/TokenNamePrice.vue";
import TokenLogo from "@/components/TokenLogo.vue";
import { waitForTransaction } from "@wagmi/core";
import LoadingComponent from "@/components/LoadingComponent.vue";
import { useRoundsStore } from "@/stores/rounds";
import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useWalletStoreV2 } from "@/stores/walletV2";
import { useTokenStore } from "@/stores/tokens";
import { useToast } from "vue-toastification";
const toast = useToast();
const walletStore = useWalletStoreV2();
const tokenStore = useTokenStore();
const rewardLockerStore = useRewardLockerStore();
@@ -142,6 +153,15 @@ const stake = ref(null);
const tokenNumber = ref(null);
const loading = ref(false);
/**
* state 0 enter amount
* state 1 rdy to go
* state 2 signing
* state 3 loading
* state 4 staked
*/
const state = ref(0);
function openStake() {
stake.value = true;
unstakeMenu.value = false;
@@ -160,6 +180,70 @@ async function orderUnstake() {
console.log("orderUnstake", result);
loading.value = false;
}
async function stakeToken() {
try {
state.value = 2;
const hash = await rewardLockerStore.stakeBloodline(tokenNumber.value);
state.value = 3;
const data = await waitForTransaction({
hash: hash,
});
console.log("data", data);
state.value = 4;
await walletStore.loadWalletData();
showSuccessToast();
//reload data
} catch (error) {
state.value = 0;
console.error(error);
throw new Error(error);
}
}
const stateStake = computed(() => {
let returnState = 0;
if (tokenNumber.value === null || tokenNumber.value === "" || tokenNumber.value === 0) {
returnState = 0;
} else if (state.value === 2) {
returnState = 2;
} else if (state.value === 3) {
returnState = 3;
} else if (tokenNumber.value !== null || tokenNumber.value !== "" || tokenNumber.value > 0) {
returnState = 1;
}
return returnState;
});
function showSuccessToast() {
// 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: tokenNumber.value,
header: "Success!",
subheader: "You just staked",
info: "Your next sacrifice will get an extra staking bonus as a reward.",
},
// 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">
+4 -1
View File
@@ -7,6 +7,9 @@
<div class="stake-adder-step bloodline-badge grey" @click="addTokensPercent(75)">75%</div>
<div class="stake-adder-step bloodline-badge grey" @click="addTokensPercent(100)">100%</div>
</template>
<template v-slot:message-end>
<slot name="message-end"> </slot>
</template>
</token-input>
<div class="stake-menu-actions">
<slot name="body">
@@ -105,8 +108,8 @@ async function stakeBloodline() {
font-size: 18px
text-align: center
.input-balance
margin: 8px 0
color: var(--grey, #858585)
margin-left: auto
.stake-menu
display: flex
+39 -7
View File
@@ -46,7 +46,7 @@
<div class="rewards-body">
<div class="rewards-coin low-mid-text">$BLOOD</div>
<div class="rewards-amount header" v-if="activeRound === currentRound">0</div>
<div class="rewards-amount header" v-else>{{ getCurrentRoundData?.rewards_total }}</div>
<div class="rewards-amount header" v-else>{{ getCurrentRoundData?.rewards_total.toFixed(5) }}</div>
</div>
<img class="bloodline-token" src="/assets/img/token/bloodline.png" alt="vampir" />
</div>
@@ -71,7 +71,11 @@
<template v-else-if="getCurrentRoundData?.rewards_total > 0">
<Transition name="smooth">
<div class="stake-buttons" v-show="!stakeMenu">
<div class="btn btn-immortal" @click="claimRewards">Claim</div>
<div class="btn btn-immortal" v-if="stateClaimedComp === 0" @click="claimRewards">Claim</div>
<div class="btn btn-immortal" disabled v-if="stateClaimedComp === 2">Sign Transaction</div>
<div class="btn btn-immortal" disabled v-if="stateClaimedComp === 3">
<loading-component></loading-component>
</div>
<div class="btn btn-immortal" @click="openStake">Stake</div>
</div>
</Transition>
@@ -105,12 +109,14 @@
<script setup>
import { storeToRefs } from "pinia";
import RewardsWrapper from "@/components/RewardsWrapper.vue";
import { inject, ref, onMounted } from "vue";
import { inject, ref, onMounted, computed } from "vue";
import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useWalletStoreV2 } from "@/stores/walletV2";
import { useRoundsStore } from "@/stores/rounds";
import { useRouter } from "vue-router";
import StakeMenu from "@/components/StakeMenu.vue";
import { waitForTransaction } from "@wagmi/core";
import LoadingComponent from "@/components/LoadingComponent.vue";
const clanRewards = ref(0);
const rewards = ref(0);
@@ -127,6 +133,7 @@ const { activeRound, currentRound, getCurrentRoundData } = storeToRefs(roundStor
const stakeMenu = ref(false);
const stake = ref(null);
const tokenNumber = ref(null);
const stateClaim = ref(0);
async function stakeAndClaim() {
console.log(tokenNumber.value);
@@ -143,11 +150,36 @@ function openStake() {
onMounted(async () => {});
async function claimRewards() {
console.log("getCurrentRoundData", getCurrentRoundData);
console.log("activeRound.value", activeRound.value);
var result = await rewardLockerStore.claim([activeRound.value]);
console.log("result", result);
try {
stateClaim.value = 2;
console.log("getCurrentRoundData", getCurrentRoundData);
console.log("activeRound.value", activeRound.value);
var hash = await rewardLockerStore.claim([activeRound.value]);
stateClaim.value = 3;
console.log("hash", hash);
const data = await waitForTransaction({
hash: hash,
});
stateClaim.value = 4;
//reload
await roundStore.fillRound(activeRound.value, true);
await walletStore.loadWalletData();
} catch (error) {
stateClaim.value = 0;
console.error(error);
throw new Error(error);
}
}
const stateClaimedComp = computed(() => {
let returnState = 0;
if (stateClaim.value === 2) {
returnState = 2;
} else if (stateClaim.value === 3) {
returnState = 3;
}
return returnState;
});
</script>
<style lang="sass">
+1
View File
@@ -9,6 +9,7 @@
<div class="value-adder">
<slot class="value-adder" name="message"></slot>
<slot name="message-end"></slot>
</div>
</div>
</template>
+102
View File
@@ -0,0 +1,102 @@
<template>
<card-component class="modal-card">
<div class="body">
<div class="header">
<img alt="logo" class="logo" src="/assets/img/vampir.png" />
</div>
<div class="subheader toast-header">
{{ props.header }}<br />
{{ props.subheader }}
</div>
<div class="amount-number">
<div class="token-amount number-mobile">{{ props.value }}</div>
<div class="token-name">$Blood</div>
</div>
<div class="info toast-body">
{{ props.info }}
</div>
</div>
<div class="btn btn-immortal" @click="closeToast">Okay</div>
</card-component>
</template>
<script setup>
import { getCurrentInstance } from "vue";
import CardComponent from "@/components/CardComponent.vue";
import { useToast } from "vue-toastification";
const props = defineProps({
value: String,
header: String,
subheader: String,
info: String,
});
// element.classList.add("toast-open");
const toast = useToast();
const instance = getCurrentInstance();
instance.parent.parent.vnode.el.classList.add("toast-open");
const id = instance.attrs["toast-id"];
function closeToast() {
instance.parent.parent.vnode.el.classList.remove("toast-open");
toast.dismiss(id);
}
console.log("instance", instance.attrs["toast-id"]);
</script>
<style lang="sass">
.Vue-Toastification__container
&.toast-open
background-color: rgb(15, 15, 15, 0.7)
height: 100vh
width: 100vw
position: fixed
left: 0
bottom: 0
z-index: 10
@media (min-width: 992px)
background-color: unset
&.top-center
@media (min-width: 600px)
left: unset
margin-left: unset
.Vue-Toastification__toast
max-width: unset
min-width: unset
max-height: unset
min-height: unset
font-family: unset
margin-bottom: unset
box-shadow: unset
padding: unset
&.modal-overlay
background-color: unset
.modal-card
width: 342px
text-align: center
position: absolute
top: 50%
left: 50%
transform: translate(-50%, -50%)
border: 2px solid var(--dark-purple, #4B0082)
background: var(--midnight-black, #0F0F0F)
z-index: 100
gap: 16px
@media (min-width: 992px)
top: 142px
right: 24px
left: unset
transform: unset
.body
display: flex
flex-direction: column
gap: 8px
.amount-number
display: flex
justify-content: center
align-items: end
gap: 8px
img
width: 74px
height: 74px
</style>
+8
View File
@@ -50,6 +50,10 @@ import { faArrowDown, faArrowRight, faSpinner, faPlus, faCaretLeft, faCaretRight
import { faDiscord, faTwitter, faTelegram } from "@fortawesome/free-brands-svg-icons";
import Toast from "vue-toastification";
// Import the CSS or use your own!
import "vue-toastification/dist/index.css";
/* add icons to the library */
library.add(
faArrowDown,
@@ -81,6 +85,10 @@ pinia.use(piniaPluginPersistedstate);
app.use(pinia);
app.use(Toast, {});
const walletStore = useWalletStoreV2();
const tokenStore = useTokenStore();
const memeBurnerStore = useMemeburnerStore();
+7 -10
View File
@@ -123,14 +123,10 @@ export const useRewardLockerStore = defineStore("rewardlocker", {
});
const { r, s, v } = getSignatureRSV(signature);
console.log("value, deadline, v, r, s", value, deadline, v, r, s);
const hash = await this.contract.write.stakeToBeSecured([value, deadline, v, r, s]);
console.log("hash", hash);
return hash;
const data = await waitForTransaction({
hash: hash,
});
console.log("data", data);
},
async stakeAndClaimRound(stakeCoefficient, round) {
// stakeCoefficient 25% = 2500, 50% = 5000
@@ -151,10 +147,11 @@ export const useRewardLockerStore = defineStore("rewardlocker", {
const rounds = await roundsStore.getFinshedRoundNumbers();
const addresses = tokenStore.sacrificeToken.map((obj) => obj.contractAddress);
console.log({ stakeCoefficient, rounds, addresses });
const hash = await this.contract.write.stakeAndClaim([stakeCoefficient, rounds, addresses]);
// todo reload roundData and wallet data
const walletStore = useWalletStoreV2();
await walletStore.loadWalletData();
console.log("stakeCoefficient", stakeCoefficient);
var stakeCoefficientInt = Math.round(stakeCoefficient);
const hash = await this.contract.write.stakeAndClaim([stakeCoefficientInt, rounds, addresses]);
return hash;
},
},
});
+40 -33
View File
@@ -81,9 +81,9 @@ export const useRoundsStore = defineStore("rounds", {
// );
// console.log("Number(data[tokenIndex].result[1] / BigInt(Math.pow(10, token.decimals))", Number(data[tokenIndex].result[1] / BigInt(Math.pow(10, token.decimals))));
this.rounds[this.currentRound].token[tokenIndex].amount =
Number(data[tokenIndex].result[1] / BigInt(Math.pow(10, token.decimals)))
Number(data[tokenIndex].result[1]) / Math.pow(10, token.decimals)
},
async fillRound(roundNumber) {
async fillRound(roundNumber, refillRound = false) {
console.log("fillRound");
const memeBurnerStore = useMemeburnerStore();
const tokenStore = useTokenStore();
@@ -93,71 +93,78 @@ export const useRoundsStore = defineStore("rounds", {
// if (this.activeRound === this.currentRound) {
// console.log("activeRound is not completed");
// } else
if (!this.rounds[roundNumber]?.goal) {
if (!this.rounds[roundNumber]?.goal || refillRound) {
console.log("round not filled --> fill round");
console.log("vor error");
var data = await memeBurnerStore.getSacrificedRound(roundNumber);
let rewardData = null;
if (walletStore.connected) {
console.log("hier1");
rewardData = await rewardLockerStore.getRewardsForAllToken(roundNumber);
console.log("hier2", rewardData);
}
var goal = await memeBurnerStore.getGoal(roundNumber);
var goal = await memeBurnerStore.getGoal(roundNumber);
console.log("goal", goal);
var tokenArray = [];
var rewards_clan = 0;
var rewards_sacrifice = 0;
var rewards_staking = 0;
console.log("data", data);
var rewards_sacrifice = 0;
var rewards_staking = 0;
console.log("data", data);
for (let index = 0; index < data.length; index++) {
var tokenData = {};
const token = tokenStore.token[index];
var coefficent = await rewardLockerStore.getSacrificedTokenCoefficient(
roundNumber,
token.contractAddress
);
console.log("coefficent", coefficent);
);
console.log("coefficent", coefficent);
tokenData.name = token.name;
tokenData.contractAddress = token.contractAddress;
tokenData.vamplogo = token.vamp.logo;
tokenData.vampname = token.vamp.name;
// tokenData.amount = data[index].result[1];
tokenData.amount = Number(data[index].result[1]) / Math.pow(10, token.decimals);
// tokenData.amount = data[index].result[1];
tokenData.amount = Number(data[index].result[1]) / Math.pow(10, token.decimals);
// tokenData.getAmountToReachGoal =
// Number(await memeBurnerStore.getAmountToReachGoal(token.contractAddress)) /
// Math.pow(10, token.decimals);
if (this.currentRound !== roundNumber && walletStore.connected) {
console.log("index", index);
console.log("rewardData[index]", rewardData[index]);
if (walletStore.connected) {
const stakeReward = Number(rewardData[index].result[0]);
const sacrificeClanReward = Number(rewardData[index].result[1]);
console.log("stakeReward", stakeReward);
console.log("sacrificeClanReward", sacrificeClanReward);
const clanwin = (Number(coefficent) / 10000 - 1) * sacrificeClanReward;
console.log("clanwin", clanwin);
const sacrificeRewards = Number(sacrificeClanReward) - clanwin;
console.log("sacrificeRewards", sacrificeRewards);
tokenData.rewards_ges =
Number(rewardData[index].result[1] / BigInt(Math.pow(10, token.decimals)) +
rewardData[index].result[0] / BigInt(Math.pow(10, token.decimals)));
tokenData.rewards_clan = clanwin / Math.pow(10, token.decimals);;
tokenData.rewards_staking = Number(rewardData[index].result[0] / BigInt(Math.pow(10, token.decimals)));
tokenData.rewards_sacrifice = sacrificeRewards / Math.pow(10, token.decimals);
let clanwin = 0;
if (this.activeRound !== this.currentRound) {
clanwin = (Number(coefficent) / 10000 - 1) * sacrificeClanReward;
console.log("clanwin", clanwin);
}
const sacrificeRewards = Number(sacrificeClanReward) - clanwin;
rewards_clan = rewards_clan + tokenData.rewards_clan;
tokenData.rewards_ges = Number(
rewardData[index].result[1] / BigInt(Math.pow(10, token.decimals)) +
rewardData[index].result[0] / BigInt(Math.pow(10, token.decimals))
);
tokenData.rewards_clan = clanwin / Math.pow(10, token.decimals);
tokenData.rewards_staking = Number(
rewardData[index].result[0] / BigInt(Math.pow(10, token.decimals))
);
tokenData.rewards_sacrifice = sacrificeRewards / Math.pow(10, token.decimals);
rewards_clan = rewards_clan + tokenData.rewards_clan;
rewards_sacrifice = rewards_sacrifice + tokenData.rewards_sacrifice;
rewards_staking = rewards_staking + tokenData.rewards_staking;
}
tokenArray.push(tokenData);
}
console.log("clanwin123", rewards_clan);
const goalInBLD = await memeBurnerStore.getGoalInBLOOD(roundNumber);
}
console.log("clanwin123", rewards_clan);
const goalInBLD = await memeBurnerStore.getGoalInBLOOD(roundNumber);
this.rounds[roundNumber] = {
goal: Number(goal[0]) / Math.pow(10, tokenStore.memeToken.decimals),
goalInBLD: Number(goalInBLD / BigInt(Math.pow(10, tokenStore.memeToken.decimals))),
expirationTimestamp: Number(goal[1]),
expirationTimestamp: Number(goal[2]),
rewards_clan: Number(rewards_clan),
rewards_staking: Number(rewards_staking),
rewards_sacrifice: Number(rewards_sacrifice),
-4
View File
@@ -146,13 +146,9 @@ export const useWalletStoreV2 = defineStore("walletV2", {
await this.getTokenBalances();
//MemeToken Staked
const tokenStore = useTokenStore();
console.log("tokenStore.memeToken.decimals", tokenStore.memeToken.decimals);
const staked = await rewardlockerStore.getStaked(this.address);
console.log("staked", staked);
console.log("ztrsdz", staked / BigInt(Math.pow(10, tokenStore.memeToken.decimals)));
this.memeToken.staked = Number(staked / BigInt(Math.pow(10, tokenStore.memeToken.decimals)));
const unclaimedRewardsArray = await rewardlockerStore.getTotalRewards(this.address);
console.log("unclaimedRewardsArray", unclaimedRewardsArray);
const unclaimedRewards = unclaimedRewardsArray[0] + unclaimedRewardsArray[1];
this.memeToken.unclaimedRewards = Number(unclaimedRewards/ BigInt(Math.pow(10, tokenStore.memeToken.decimals)))
+11 -21
View File
@@ -40,7 +40,7 @@
>
<div class="cycle-winner-left">
<div class="cycle-winner-headline">Clan Winner</div>
<div class="cycle-winner-subheadline">+20% Clan Bonus</div>
<div class="cycle-winner-subheadline">+25% Clan Bonus</div>
</div>
<div class="cycle-winner-right">
<div class="cycle-winner-logo">
@@ -66,27 +66,11 @@
<div class="bloodline-clan">
<div class="sub-header">Bloodline Clan</div>
<p>
<p class="mid-text">
Win extra rewards for you and your clan. Increase the strength of your bloodline by sacrificing more
memes.
</p>
<table class="bonus-table" v-if="!isMobile">
<tbody>
<tr>
<th scope="row">1st</th>
<td>100% Bonus</td>
</tr>
<tr>
<th scope="row">2nd</th>
<td>50% Bonus</td>
</tr>
<tr>
<th scope="row">3rd</th>
<td>No Bonus</td>
</tr>
</tbody>
</table>
<div class="bloodline-container" v-else>
<div class="bloodline-container">
<div class="bloodline-border purple">Get up to +100% Clan Bonus <br />on your sacrifice.</div>
</div>
<blood-chart :data="roundsStore.rounds[roundsStore.activeRound]"></blood-chart>
@@ -101,6 +85,7 @@ import { inject, ref, onMounted, onBeforeUnmount } from "vue";
import BloodChart from "@/components/BloodChart.vue";
import TokenClaim from "@/components/TokenClaim.vue";
import { useMemeburnerStore } from "@/stores/memeburner";
import CardComponent from "@/components/CardComponent.vue";
import { useRoundsStore } from "@/stores/rounds";
import { useRewardLockerStore } from "@/stores/rewardlocker";
@@ -159,12 +144,17 @@ onMounted(async () => {
// create the observer
observer.value = new window.IntersectionObserver(handler);
// give the observer some dom nodes to keep an eye on
observer.value.observe(observerElement.value);
if (observerElement.value) {
observer.value.observe(observerElement.value);
}
});
onBeforeUnmount(() => {
console.log("clear");
clearInterval(timer.value);
observer.value.unobserve(observerElement.value);
if (observer.value) {
observer.value.unobserve(observerElement.value);
}
});
async function prevSlide() {
+6 -1
View File
@@ -3283,7 +3283,12 @@
dependencies:
"@vue/devtools-api" "^6.5.0"
"vue@^2.6.14 || ^3.3.0", "vue@^3.0.0-0 || ^2.6.0", "vue@^3.2.0", "vue@^3.2.25", "vue@^3.3.2", "vue@>= 3.0.0 < 4", "vue@3.3.4":
"vue-toastification@^2.0.0-rc.5":
"integrity" "sha512-q73e5jy6gucEO/U+P48hqX+/qyXDozAGmaGgLFm5tXX4wJBcVsnGp4e/iJqlm9xzHETYOilUuwOUje2Qg1JdwA=="
"resolved" "https://registry.npmjs.org/vue-toastification/-/vue-toastification-2.0.0-rc.5.tgz"
"version" "2.0.0-rc.5"
"vue@^2.6.14 || ^3.3.0", "vue@^3.0.0-0 || ^2.6.0", "vue@^3.0.2", "vue@^3.2.0", "vue@^3.2.25", "vue@^3.3.2", "vue@>= 3.0.0 < 4", "vue@3.3.4":
"integrity" "sha512-VTyEYn3yvIeY1Py0WaYGZsXnz3y5UnGi62GjVEqvEGPl6nxbOrCXbVOTQWBEJUqAyTUk2uJ5JLVnYJ6ZzGbrSw=="
"resolved" "https://registry.npmjs.org/vue/-/vue-3.3.4.tgz"
"version" "3.3.4"