update m issues + e frontend improvements

This commit is contained in:
EmberSpirit
2023-10-23 21:35:38 +02:00
parent 44df04cc23
commit 6e58bc6319
24 changed files with 305 additions and 312 deletions
+16 -3
View File
@@ -105,7 +105,7 @@ onMounted(async () => {
<div class="footer">
<div class="footer-inner">
<div class="footer-headline">Join Bloodline</div>
<div class="footer-headline" v-if="!isMobile">Join Bloodline</div>
<div class="footer-social-links">
<div class="social-bloodline-badge">
@@ -123,6 +123,11 @@ onMounted(async () => {
<font-awesome-icon icon="fa-brands fa-twitter" />
</div>
</div>
<div class="social-bloodline-badge">
<div class="social-bloodline-badge-icon">
<font-awesome-icon icon="fa-solid fa-blog" />
</div>
</div>
</div>
</div>
</div>
@@ -149,22 +154,30 @@ onMounted(async () => {
.footer
height: auto
background-color: var(--midnight-black)
background-color: #2D2D2D
padding-bottom: 72px
@media (min-width: 992px)
background-color: var(--midnight-black)
height: 150px
min-height: 150px
display: flex
flex-direction: column
justify-content: center
padding-bottom: unset
margin-top: auto
.footer-inner
padding: 16px 0 24px 0
padding: 24px 0
font-size: 24px
display: flex
flex-direction: column
gap: 16px
align-items: center
border-top: 1px solid #000
@media (min-width: 992px)
padding: 16px 0 24px 0
justify-content: center
border-top: unset
background-color: transparent
.footer-headline
font-size: 16px
.footer-social-links
+1 -1
View File
@@ -1,6 +1,6 @@
{
"contractName": "Bloodline",
"contractAddress": "0xfB97A4a863d75F72E6d3DCef4a47413E811c9D2E",
"contractAddress": "0x51bF3df58D123e8EA43fb2189f18027FD36a08Af",
"abi": [
{
"inputs": [
+1 -97
View File
@@ -1,6 +1,6 @@
{
"contractName": "LiquidityOwner",
"contractAddress": "0x0f18b2D23278E1f1d92cc2cE10a75604bDBE9Ad1",
"contractAddress": "0xF8bc4Ce13263DD4e12070e3192be50310eF7C95a",
"abi": [
{
"inputs": [
@@ -132,35 +132,6 @@
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "int24",
"name": "tick",
"type": "int24"
},
{
"internalType": "int24",
"name": "tickLower",
"type": "int24"
},
{
"internalType": "int24",
"name": "tickUpper",
"type": "int24"
}
],
"name": "_liquidityCanBeProvided",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
@@ -198,54 +169,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "int24",
"name": "tickCycle",
"type": "int24"
}
],
"name": "calculateTicksForRange1",
"outputs": [
{
"internalType": "int24",
"name": "tickLower",
"type": "int24"
},
{
"internalType": "int24",
"name": "tickUpper",
"type": "int24"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "int24",
"name": "tickCycle",
"type": "int24"
}
],
"name": "calculateTicksForRange2",
"outputs": [
{
"internalType": "int24",
"name": "tickLower",
"type": "int24"
},
{
"internalType": "int24",
"name": "tickUpper",
"type": "int24"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
@@ -288,25 +211,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "cycleTicks",
"outputs": [
{
"internalType": "int24",
"name": "",
"type": "int24"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "memeAltar",
+106 -46
View File
@@ -1,6 +1,6 @@
{
"contractName": "MemeAltar",
"contractAddress": "0x5368264F18DD0e09ea074a79F3F8B504e2363d84",
"contractAddress": "0xE4F42F3f8B0E57b1054D457fe3b49a1A10B1aCEa",
"abi": [
{
"inputs": [
@@ -53,11 +53,6 @@
"name": "CycleCompletedRegistrationFailed",
"type": "error"
},
{
"inputs": [],
"name": "GoalCannotBeZero",
"type": "error"
},
{
"inputs": [],
"name": "InsufficientOutputAmount",
@@ -220,16 +215,42 @@
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint64",
"name": "b",
"type": "uint64"
},
{
"indexed": true,
"internalType": "uint64",
"name": "m",
"type": "uint64"
"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"
}
],
"indexed": false,
"internalType": "struct MemeAltar.BM",
"name": "_bm",
"type": "tuple"
}
],
"name": "NewBM",
@@ -288,14 +309,41 @@
{
"inputs": [
{
"internalType": "uint64",
"name": "newB",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "newM",
"type": "uint64"
"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",
@@ -362,12 +410,12 @@
},
{
"inputs": [],
"name": "b",
"name": "bloodline",
"outputs": [
{
"internalType": "uint64",
"internalType": "contract Bloodline",
"name": "",
"type": "uint64"
"type": "address"
}
],
"stateMutability": "view",
@@ -375,12 +423,37 @@
},
{
"inputs": [],
"name": "bloodline",
"name": "bm",
"outputs": [
{
"internalType": "contract Bloodline",
"name": "",
"type": "address"
"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"
}
],
"stateMutability": "view",
@@ -589,9 +662,9 @@
"name": "issuancePrice",
"outputs": [
{
"internalType": "uint128",
"internalType": "uint256",
"name": "",
"type": "uint128"
"type": "uint256"
}
],
"stateMutability": "view",
@@ -610,19 +683,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "m",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
+1 -1
View File
@@ -1,6 +1,6 @@
{
"contractName": "RewardLocker",
"contractAddress": "0x3342B37A0c06FEf2c3dD9481e31CCCF970e7235B",
"contractAddress": "0x2952253374973DE0ffbFe35269Ca13FaF28B935F",
"abi": [
{
"inputs": [
File diff suppressed because one or more lines are too long
-2
View File
@@ -34,8 +34,6 @@ body
display: flex
flex-direction: column
height: 100vh
.footer
margin-top: auto
.container
margin-right: auto
+2 -2
View File
@@ -73,7 +73,7 @@
</div>
<div class="blood-chart-element-footer">
<div class="blood-chart-amount">
{{ formatBigIntDivision(coin.amountInBLD, 10n ** tokenStore.memeToken.decimals) }}
{{ formatNumber(coin.amountInBLD, 10n ** tokenStore.memeToken.decimals) }}
</div>
<div>$BLOOD</div>
</div>
@@ -96,7 +96,7 @@
<script setup>
import { computed, ref, inject, onMounted } from "vue";
import { getPercentage, formatBigIntDivision } from "@/helper/helper.js";
import { getPercentage, formatNumber } from "@/helper/helper.js";
import { useCycleStore } from "@/stores/cycles";
import { useMemeburnerStore } from "@/stores/memeburner";
+25 -19
View File
@@ -4,12 +4,12 @@
<template v-slot:body>
<token-name-price
:name="tokenStore.getToken(walletStore.memeToken?.contractAddress)?.name"
:price="formatBigIntDivision(walletStore.unclaimedRewards, 10n ** tokenStore.memeToken.decimals)"
:price="formatNumber(walletStore.unclaimedRewards, 10n ** tokenStore.memeToken.decimals)"
></token-name-price>
<token-logo img="/assets/img/token/bloodline.png" :alt="'bloodline logo'"></token-logo>
</template>
<template v-slot:actions>
<template v-if="walletStore.unclaimedRewards > 0">
<template v-if="walletStore.unclaimedRewards > 0n">
<Transition name="smooth">
<div class="connected-stake-buttons" v-show="!stakeMenu">
<div class="btn btn-immortal mid-mid-text" @click="claimAll" v-if="stateStake === 0">Claim</div>
@@ -19,21 +19,32 @@
<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 class="btn btn-immortal mid-mid-text" @click="openStake" v-if="stateStake === 0">
Stake
</div>
</div>
</Transition>
<Transition name="smooth">
<stake-menu
v-model="tokenNumber"
@close="stakeMenu = false"
:amount="
formatBigIntDivision(walletStore.unclaimedRewards, 10n ** tokenStore.memeToken.decimals)
"
:amount="walletStore.unclaimedRewards"
:stake="stake"
v-if="stakeMenu"
>
<template v-slot:body>
<div class="btn btn-immortal stake-button" disabled v-if="stateClaimComp === 0">
<div
class="btn btn-immortal stake-button"
disabled
v-if="
tokenNumber > 0 &&
BigInt(tokenNumber) * 10n ** tokenStore.memeToken.decimals >
walletStore.unclaimedRewards
"
>
Insufficient Balance
</div>
<div class="btn btn-immortal stake-button" disabled v-else-if="stateClaimComp === 0">
Enter Amount
</div>
<div
@@ -43,10 +54,10 @@
>
Stake & Claim Rest
</div>
<div class="btn btn-immortal stake-button" disabled v-if="stateClaimComp === 2">
<div class="btn btn-immortal stake-button" disabled v-else-if="stateClaimComp === 2">
Sign Transaction
</div>
<div class="btn btn-immortal stake-button" disabled v-if="stateClaimComp === 3">
<div class="btn btn-immortal stake-button" disabled v-else-if="stateClaimComp === 3">
<loading-component></loading-component>
</div>
<div
@@ -59,12 +70,7 @@
<template v-slot:message-end>
<div class="input-balance">
Balance:
{{
formatBigIntDivision(
walletStore.unclaimedRewards,
10n ** tokenStore.memeToken.decimals
)
}}
{{ formatNumber(walletStore.unclaimedRewards, 10n ** tokenStore.memeToken.decimals) }}
</div>
</template>
</stake-menu>
@@ -73,7 +79,7 @@
<template v-else-if="cycleStore.rewardsSacrificeCurrentCycle > 0n">
<div class="connected-stake-buttons">
<div class="btn btn-immortal mid-mid-text btn--disabled">Claim</div>
<div class="btn btn-immortal mid-mid-text btn--disabled">stake</div>
<div class="btn btn-immortal mid-mid-text btn--disabled">Stake</div>
</div>
<div class="text-center">You can claim, once the cycle is over</div>
</template>
@@ -103,7 +109,7 @@ import { useTokenStore } from "@/stores/tokens";
import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useRouter } from "vue-router";
import { useToast } from "vue-toastification";
import { formatBigIntDivision } from "@/helper/helper.js";
import { formatNumber } from "@/helper/helper.js";
import { showSuccessToast } from "@/helper/toast.js";
const toast = useToast();
@@ -158,7 +164,7 @@ async function stakeAndClaimAllCycles() {
//
console.log("rewardData", rewardData);
//ClaimedReward (address staker, uint256 reward)
const outputClaim = formatBigIntDivision(BigInt(rewardData.topics[2]), 10n ** tokenStore.memeToken.decimals);
const outputClaim = formatNumber(BigInt(rewardData.topics[2]), 10n ** tokenStore.memeToken.decimals);
showSuccessToast(
outputClaim,
"Success!",
@@ -189,7 +195,7 @@ async function claimAll() {
//
console.log("rewardData", rewardData);
//ClaimedReward (address staker, uint256 reward)
const outputClaim = formatBigIntDivision(BigInt(rewardData.topics[2]), 10n ** tokenStore.memeToken.decimals);
const outputClaim = formatNumber(BigInt(rewardData.topics[2]), 10n ** tokenStore.memeToken.decimals);
showSuccessToast(
outputClaim,
"Success!",
+10 -19
View File
@@ -11,22 +11,19 @@
>
<div class="connector-icon">
<template v-if="connector.id === 'injected'">
<font-awesome-icon :icon="['fas', 'wallet']" />
<template v-if="connector.name === 'MetaMask'">
<img :src="`/assets/img/connectors/metaMask.svg`" :alt="`${connector.name} Logo`" />
</template>
<template v-else>
<font-awesome-icon :icon="['fas', 'wallet']" />
</template>
</template>
<template v-else>
<img :src="`/assets/img/connectors/${connector.id}.svg`" :alt="`${connector.name} Logo`" />
</template>
</div>
<div class="connector-name">
<template
v-if="
connector.id !== 'metaMask' ||
(connector.id === 'metaMask' && isMetaMaskInstalled(connector))
"
>
{{ connector.name }}
</template>
<template v-else> Install {{ connector.name }} </template>
{{ connector.name }}
</div>
</div>
</div>
@@ -52,10 +49,7 @@
<token-name-price
:name="tokenStore.getToken(token.contractAddress).name"
:price="
formatBigIntDivision(
token.balanceOf,
10n ** tokenStore.getToken(token.contractAddress).decimals
)
formatNumber(token.balanceOf, 10n ** tokenStore.getToken(token.contractAddress).decimals)
"
></token-name-price>
<div class="connected-token-button">
@@ -85,7 +79,7 @@ import TokenNamePrice from "./TokenNamePrice.vue";
import TokenLogo from "./TokenLogo.vue";
import StakeComponentV1 from "@/components/StakeComponentV1.vue";
import { getAddressShortName, getblocky, formatBigIntDivision } from "@/helper/helper.js";
import { getAddressShortName, getblocky, formatNumber } from "@/helper/helper.js";
import { useRoute, useRouter } from "vue-router";
import { disconnect } from "@wagmi/core";
@@ -136,10 +130,7 @@ function badgeClick(token) {
//special case for metaMask, but I think that is the most used wallet
async function connectWallet(connector) {
if (connector.id === "metaMask" && !isMetaMaskInstalled(connector)) {
window.open(" https://metamask.io/", "_blank");
return;
}
console.log("connector", connector);
instance.parent.emit("update:modelValue", false);
await walletStore.connectWallet(toRaw(connector));
}
+3 -1
View File
@@ -1,7 +1,8 @@
<template>
<div class="rewards-wrapper">
<div class="rewards-headline low-mid-text">
{{ props.title }}
<div class="rewards-title">{{ props.title }}</div>
<div class="rewards-sub-title" v-if="props.subTitle">{{ props.subTitle }}</div>
</div>
<div class="rewards-inner">
<token-name-price name="$BLOOD" :price="props.amount"></token-name-price>
@@ -16,6 +17,7 @@ import TokenLogo from "@/components/TokenLogo.vue";
const props = defineProps({
title: String,
subTitle: String,
info: String,
amount: [String, Number],
image: String,
+4 -4
View File
@@ -59,7 +59,7 @@
<template v-slot:message-end v-if="activeWalletToken?.balanceOf >= 0">
<div class="input-balance tiny-text">
Balance:
{{ formatBigIntDivision(activeWalletToken?.balanceOf, 10n ** activeToken.decimals) }}
{{ formatNumber(activeWalletToken?.balanceOf, 10n ** activeToken.decimals) }}
</div>
<div class="input-max tiny-text" @click="addMaxTokens">Max</div>
</template>
@@ -79,7 +79,7 @@
<div class="sacrifice-to-body">
<token-name-price
name="$BLOOD"
:price="`≈${formatBigIntDivision(output, 10n ** activeToken.decimals)}`"
:price="`≈${formatNumber(output, 10n ** activeToken.decimals)}`"
></token-name-price>
<token-logo :img="activeToken.vamp.logo" :size="64" :alt="activeToken.vamp.name"></token-logo>
</div>
@@ -101,7 +101,7 @@
No Staking Bonus
</div>
<div class="mid-mid-text" v-else>
+ {{ formatBigIntDivision(stakingOutput, 10n ** activeToken.decimals) }} Staking Bonus
+ {{ formatNumber(stakingOutput, 10n ** activeToken.decimals) }} Staking Bonus
</div>
<div class="icon">
<font-awesome-icon icon="chevron-down" />
@@ -186,7 +186,7 @@ const cycleStore = useCycleStore();
const sacrificeStore = useSacrificeStore();
const toast = useToast();
import { debounce, formatBigIntDivision } from "@/helper/helper.js";
import { debounce, formatNumber } from "@/helper/helper.js";
const isMobile = inject("isMobile");
const showPanel = inject("showPanel");
+10 -10
View File
@@ -32,7 +32,7 @@
<slot name="body">
<token-name-price
name="$BLOOD staked"
:price="formatBigIntDivision(walletStore.staked, 10n ** tokenStore.memeToken.decimals)"
:price="formatNumber(walletStore.staked, 10n ** tokenStore.memeToken.decimals)"
></token-name-price>
<token-logo img="/assets/img/token/bloodline.png" :alt="'bloodline-token'"></token-logo>
<token-name-price :variant="true" class="stake-reward" name="Bonus" price="+25%"></token-name-price>
@@ -55,13 +55,13 @@
Stake
</div>
<div
v-if="(walletStore.memeToken?.staked === 0 && !stakeonly) || cycleStore.currentCycle === 1"
v-if="(walletStore.memeToken?.staked === 0n && !stakeonly) || cycleStore.currentCycle === 1"
class="btn btn-immortal btn--disabled mid-mid-text"
>
Unstake
</div>
<div v-else-if="!stakeonly" class="btn btn-immortal mid-mid-text" @click="openUnstake">
Unstake
Order Unstake
</div>
</template>
<template v-else-if="walletStore.connected && ableToUnstake">
@@ -111,7 +111,7 @@
<template v-slot:message-end>
<div class="input-balance">
Balance:
{{ formatBigIntDivision(walletStore.balanceOf, 10n ** tokenStore.memeToken.decimals) }}
{{ formatNumber(walletStore.balanceOf, 10n ** tokenStore.memeToken.decimals) }}
</div>
</template>
</stake-menu>
@@ -139,7 +139,7 @@
</div>
</div>
</Transition>
<div class="connected-stake-first-round small-text text-center" v-if="cycleStore.currentCycle === 0">
<div class="connected-stake-first-round small-text text-center" v-if="cycleStore.currentCycle === 1">
No $BLOOD on the market. Staking is activated after the first cycle is finished.
</div>
<div
@@ -147,7 +147,7 @@
v-if="walletStore.orderedUnstakedAmount > 0n && !ableToUnstake"
>
You can claim
{{ formatBigIntDivision(walletStore.orderedUnstakedAmount, 10n ** tokenStore.memeToken.decimals) }}
{{ formatNumber(walletStore.orderedUnstakedAmount, 10n ** tokenStore.memeToken.decimals) }}
$BLOOD next cycle.
</div>
</slot>
@@ -170,7 +170,7 @@ import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useWalletStoreV2 } from "@/stores/walletV2";
import { useTokenStore } from "@/stores/tokens";
import { useToast } from "vue-toastification";
import { formatBigIntDivision } from "@/helper/helper.js";
import { formatNumber } from "@/helper/helper.js";
const toast = useToast();
const walletStore = useWalletStoreV2();
@@ -239,7 +239,7 @@ async function unstake() {
});
console.log("rewardData", rewardData);
const outputClaim = formatBigIntDivision(BigInt(rewardData.topics[3]), 10n ** tokenStore.memeToken.decimals);
const outputClaim = formatNumber(BigInt(rewardData.topics[3]), 10n ** tokenStore.memeToken.decimals);
showSuccessToast(outputClaim, "Success!", "You just unstaked");
await walletStore.loadWalletData();
} catch (error) {
@@ -265,7 +265,7 @@ async function orderUnstake() {
});
console.log("rewardData", rewardData);
const outputClaim = formatBigIntDivision(BigInt(rewardData.topics[3]), 10n ** tokenStore.memeToken.decimals);
const outputClaim = formatNumber(BigInt(rewardData.topics[3]), 10n ** tokenStore.memeToken.decimals);
showSuccessToast(outputClaim, "Success!", "You just unstaked", "You can claim your stake next cycle.");
stakeMenu.value = false;
} catch (error) {
@@ -293,7 +293,7 @@ async function stakeToken() {
//
console.log("rewardData", rewardData);
const outputClaim = formatBigIntDivision(BigInt(rewardData.topics[3]), 10n ** tokenStore.memeToken.decimals);
const outputClaim = formatNumber(BigInt(rewardData.topics[3]), 10n ** tokenStore.memeToken.decimals);
console.log("data", data);
state.value = 0;
showSuccessToast(
+1 -1
View File
@@ -36,7 +36,7 @@ import { useWalletStoreV2 } from "@/stores/walletV2";
import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useTokenStore } from "@/stores/tokens";
import { createPermitObject, getSignatureRSV } from "@/helper/blockchain.js";
import { formatBigIntDivision } from "@/helper/helper.js";
import { formatNumber } from "@/helper/helper.js";
import { signTypedData } from "@wagmi/core";
+23 -10
View File
@@ -23,19 +23,20 @@
<rewards-wrapper
title="Sacrafice Reward"
coin="$BLOOD"
:amount="formatBigIntDivision(rewardsSacrifice, 10n ** tokenStore.memeToken.decimals)"
:amount="formatNumber(rewardsSacrifice, 10n ** tokenStore.memeToken.decimals)"
image="/assets/img/vampir.png"
/>
<rewards-wrapper
title="Staking Bonus"
coin="$BLOOD"
:amount="formatBigIntDivision(rewardsStaking, 10n ** tokenStore.memeToken.decimals)"
:amount="formatNumber(rewardsStaking, 10n ** tokenStore.memeToken.decimals)"
image="/assets/img/vampir.png"
/>
<rewards-wrapper
title="Clan Bonus"
:subTitle="rewardsClan > 0 ? clanBonusPercentage : null"
coin="$BLOOD"
:amount="formatBigIntDivision(rewardsClan, 10n ** tokenStore.memeToken.decimals)"
:amount="formatNumber(rewardsClan, 10n ** tokenStore.memeToken.decimals)"
:image="
activeCycle === currentCycle || !cycleStore.getCurrentCycleData?.winner.vamplogo
? '/assets/img/token/notoken.png'
@@ -47,13 +48,13 @@
<div class="rewards-total-headline sub-header">Total Reward</div>
<div
class="rewards-total-inner bloodline-border bloodline-border--variant1"
:class="{ purple: rewardsTotal > 0 && activeCycle !== currentCycle }"
:class="{ purple: rewardsTotal > 0n && activeCycle !== currentCycle }"
>
<token-name-price
name="$BLOOD"
:price="formatBigIntDivision(rewardsTotal, 10n ** tokenStore.memeToken.decimals)"
:price="formatNumber(rewardsTotal, 10n ** tokenStore.memeToken.decimals)"
></token-name-price>
<token-logo img="/assets/img/vampir.png" :alt="'vampire'"></token-logo>
<token-logo img="/assets/img/vampir.png" :size="64" :alt="'vampire'"></token-logo>
</div>
</div>
<div class="claim-button">
@@ -86,7 +87,9 @@
<div class="btn btn-immortal sub-header" disabled v-if="stateClaimedComp === 3">
<loading-component></loading-component>
</div>
<div class="btn btn-immortal sub-header" @click="openStake">Stake</div>
<div class="btn btn-immortal sub-header" v-if="stateClaimedComp === 0" @click="openStake">
Stake
</div>
</div>
</Transition>
<Transition name="smooth">
@@ -157,7 +160,7 @@ import { waitForTransaction } from "@wagmi/core";
import LoadingComponent from "@/components/LoadingComponent.vue";
import TokenNamePrice from "@/components/TokenNamePrice.vue";
import TokenLogo from "@/components/TokenLogo.vue";
import { formatBigIntDivision } from "@/helper/helper.js";
import { formatNumber, formatBigIntDivision } from "@/helper/helper.js";
import { showSuccessToast } from "@/helper/toast.js";
const showPanel = inject("showPanel");
@@ -212,7 +215,7 @@ async function stakeAndClaim() {
const outputClaim = BigInt(rewardData?.topics[2]);
const outputStaked = BigInt(stakeData?.topics[3]);
showSuccessToast(
formatBigIntDivision(outputClaim + outputStaked, 10n ** tokenStore.memeToken.decimals),
formatNumber(outputClaim + outputStaked, 10n ** tokenStore.memeToken.decimals),
"Success!",
"You just claimed and staked",
"Join the next cycle to increase your rewards and win with your clan."
@@ -260,7 +263,7 @@ async function claimRewards() {
//
console.log("rewardData", rewardData);
const outputClaim = formatBigIntDivision(BigInt(rewardData.topics[2]), 10n ** tokenStore.memeToken.decimals);
const outputClaim = formatNumber(BigInt(rewardData.topics[2]), 10n ** tokenStore.memeToken.decimals);
showSuccessToast(
outputClaim,
"Success!",
@@ -276,6 +279,16 @@ async function claimRewards() {
}
}
const clanBonusPercentage = computed(() => {
return (
(
(formatBigIntDivision(rewardsClan.value, 10n ** tokenStore.memeToken.decimals, 8) /
formatBigIntDivision(rewardsTotal.value, 10n ** tokenStore.memeToken.decimals, 8)) *
100
).toFixed(2) + "%"
);
});
const stateClaimedComp = computed(() => {
let returnState = 0;
if (stateClaim.value === 2) {
+1
View File
@@ -7,6 +7,7 @@
:value="props.modelValue"
:placeholder="0"
type="number"
pattern="\d*"
/>
<div class="value-adder">
<slot class="value-adder" name="message"></slot>
+22 -20
View File
@@ -3,31 +3,33 @@ export function getPercentage(amount, goal) {
return ((Number(amount) / Number(goal)) * 100).toFixed(2);
}
// input type bigint
export function formatBigIntDivision(nominator, denominator) {
console.log("nominator", nominator);
console.log("denominator", denominator);
if (!nominator) {
return 0n
}
let integer = Number(nominator / denominator)
integer = formatNumber(integer).toString();
// pick how much digits after point to show
const fraction = (nominator % denominator).toString().substring(0,2);
// output type string
return integer + '.' + fraction;
export function formatNumber(nominator, denominator) {
let number = formatBigIntDivision(nominator, denominator);
number = InsertCommaNumber(number).toString();
return number;
}
export function formatNumber(number) {
const options = {
style: "decimal",
minimumFractionDigits: 0,
maximumFractionDigits: 0,
};
export function formatBigIntDivision(nominator, denominator, digits = 2) {
console.log("nominator", nominator);
console.log("denominator", denominator);
if (!nominator) {
return 0n
}
let integer = Number(nominator / denominator);
// pick how much digits after point to show
const fraction = (nominator % denominator).toString().substring(0, digits);
// output type number
return Number(integer + "." + fraction);
}
export function InsertCommaNumber(number) {
if (!number) {
return 0
}
const formattedWithOptions = number.toLocaleString("en-US", options);
const formattedWithOptions = number.toLocaleString("en-US");
return formattedWithOptions;
}
+7 -6
View File
@@ -38,7 +38,7 @@ import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
/* import specific icons */
import { faArrowDown, faArrowRight, faSpinner, faPlus, faCaretLeft, faCaretRight, faBars, faAnglesRight, faChevronDown, faChevronUp, faArrowRightToBracket, faArrowRightFromBracket, faDroplet, faMoon, faPerson, faWallet } from "@fortawesome/free-solid-svg-icons";
import { faArrowDown, faArrowRight, faSpinner, faPlus, faCaretLeft, faCaretRight, faBars, faAnglesRight, faChevronDown, faChevronUp, faArrowRightToBracket, faArrowRightFromBracket, faDroplet, faMoon, faPerson, faWallet, faBlog } from "@fortawesome/free-solid-svg-icons";
import { faDiscord, faTwitter, faTelegram } from "@fortawesome/free-brands-svg-icons";
@@ -65,10 +65,11 @@ library.add(
faArrowRightFromBracket,
faChevronDown,
faChevronUp,
faDroplet,
faMoon,
faPerson,
faWallet
faDroplet,
faMoon,
faPerson,
faWallet,
faBlog
);
var logging = localStorage.getItem("LOGGING");
@@ -152,7 +153,7 @@ try {
appName: "wagmi demo",
},
}),
new MetaMaskConnector({ chains }),
// new MetaMaskConnector({ chains }),
new InjectedConnector({
chains,
getProvider: () => (typeof window !== "undefined" ? window.myInjectedWallet : undefined),
+58 -58
View File
@@ -9,7 +9,7 @@ import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useTokenStore } from "@/stores/tokens";
import { waitForTransaction, readContract, watchBlockNumber, multicall } from "@wagmi/core";
import { showSuccessToast } from "@/helper/toast.js";
import { formatBigIntDivision } from "@/helper/helper.js";
import { formatNumber } from "@/helper/helper.js";
export const useSacrificeStore = defineStore("sacrifice", {
state: () => ({
@@ -19,21 +19,20 @@ export const useSacrificeStore = defineStore("sacrifice", {
getters: {},
actions: {
async sacrificeToken(amount, token) {
console.log("sacrificeToken", { amount, token });
console.log("sacrificeToken", { amount, token });
const memeburnerStore = useMemeburnerStore();
const walletStore = useWalletStoreV2();
const tokenStore = useTokenStore();
const cycleStore = useCycleStore();
const tokenStore = useTokenStore();
const cycleStore = useCycleStore();
try {
this.sacrificeState = 2;
const getRewards = await this.getRewardsFor(amount, token);
console.log("getRewards", getRewards);
this.sacrificeState = 2;
const getRewards = await this.getRewardsFor(amount, token);
console.log("getRewards", getRewards);
let hash = null;
if (getRewards.variant === "sacrifice") {
console.log("sacrifice");
console.log("sacrifice");
hash = await memeburnerStore.sacrificeMeme(amount, getRewards.minETH);
console.log("hash", hash);
} else {
@@ -53,22 +52,22 @@ export const useSacrificeStore = defineStore("sacrifice", {
// return logObject.topics.find(
// (topic) => topic === "0x5e60ccd3c81486143d815dce24867a494d7fee585a0a44282cf479b19a5186ee"
// );
// });
// });
var rewardData = data.logs.filter((logObject) => {
var rewardData = data.logs.filter((logObject) => {
return logObject.topics.find(
(topic) => topic === "0x5e60ccd3c81486143d815dce24867a494d7fee585a0a44282cf479b19a5186ee"
);
});
console.log("rewardData", rewardData);
//output
console.log("rewardData", rewardData);
//output
let outputSacrifice = rewardData.reduce((x, y) => {
return x + BigInt(y.data);
}, 0n);
outputSacrifice = formatBigIntDivision(outputSacrifice, 10n ** token.decimals);
console.log("outputSacrifice", outputSacrifice);
outputSacrifice = formatNumber(outputSacrifice, 10n ** token.decimals);
console.log("outputSacrifice", outputSacrifice);
token.allowance = await tokenStore.allowance();
this.sacrificeState = 4;
this.sacrificeState = 4;
showSuccessToast(
outputSacrifice,
@@ -76,50 +75,51 @@ export const useSacrificeStore = defineStore("sacrifice", {
"You turned your meme into:",
"You can claim once the current cycle is finished and your clan bonus was calculated."
);
await walletStore.loadWalletData();
console.log("cycleStore.currentCycle", cycleStore.currentCycle);
await walletStore.loadWalletData();
console.log("cycleStore.currentCycle", cycleStore.currentCycle);
await cycleStore.fillCycle(cycleStore.currentCycle, true);
return true;
} catch (error) {
//we should show the user an issue
throw new Error(error);
} finally {
return true;
} catch (error) {
//we should show the user an issue
throw new Error(error);
} finally {
this.sacrificeState = 0;
}
}
},
async getRewardsFor(amount, token) {
console.log("getRewardsFor", {amount, token});
async getRewardsFor(amount, token) {
console.log("getRewardsFor", { amount, token });
const memeburnerStore = useMemeburnerStore();
const uniswapStore = useUniswapStore();
const walletStore = useWalletStoreV2();
const rewardLockerStore = useRewardLockerStore();
const walletStore = useWalletStoreV2();
const rewardLockerStore = useRewardLockerStore();
let output = 0n;
let minBLOOD;
try {
try {
if (!amount) {
this.sacrificeState = 0;
return {
output: 0n,
};
return {
output: 0n,
};
}
const amountETHBase = await memeburnerStore.getAmountETHBase(amount);
const amountETHBase = await memeburnerStore.getAmountETHBase(amount);
// take 99.5% of amount ETH got for selling meme, 0.5% allowed slippage
const minETH = (amountETHBase[1] * 995n) / 1000n;
const rewardsForResult = await memeburnerStore.getRewardFor(amount);
const rewardsForResultSum = rewardsForResult[0] + rewardsForResult[1];
// quote blood amount against ETH base amount
var quoteRewards = await uniswapStore.quoteExactInputSingle(amount, amountETHBase[0]);
var quoteRewards = await uniswapStore.quoteExactInputSingle(amountETHBase[0]);
let variant = "sacrifice";
// here you are setting only variant, let's show by default rewardsForResultSum
output = rewardsForResultSum;
if (quoteRewards.result) {
// take 99.5% of quoted amount, 0.5% allowed slippage
minBLOOD = quoteRewards.amount * 995n / 1000n;
minBLOOD = (quoteRewards.amount * 995n) / 1000n;
if (quoteRewards.amount * 95n / 100n > rewardsForResultSum) {
if ((quoteRewards.amount * 95n) / 100n > rewardsForResultSum) {
variant = "buy";
console.log("use Buy-function", {
quoteRewardsNumber: quoteRewards.amount,
@@ -131,13 +131,6 @@ export const useSacrificeStore = defineStore("sacrifice", {
rewardsForResultSum,
});
}
} else {
/**
* case 4
* quoter threw an error
*/
//
output = rewardsForResultSum;
}
console.log("variant", variant);
console.log("amount", amount);
@@ -149,15 +142,23 @@ export const useSacrificeStore = defineStore("sacrifice", {
*/
output = rewardsForResultSum;
if (variant === "buy") {
output = quoteRewards.amount
output = quoteRewards.amount;
}
} else if (walletStore.connected && variant === "sacrifice") {
} else if (walletStore.connected && variant === "sacrifice" && token.allowance >= amount) {
/**
* case 2
* user is logged in and allowance is greater or equal input and variant is sacrifice
*/
output = rewardsForResultSum;
} else if (walletStore.connected && variant === "buy") {
// in this case you should use eth_call, so you are showing exact reward in cases of completing cycles
const amountSacrifice = await readContract({
address: memeburnerStore.contract.address,
abi: memeburnerStore.contract.abi,
functionName: "sacrificeMeme",
args: [token.contractAddress, amount.toString(), minETH.toString()],
account: walletStore.address,
});
output = amountSacrifice;
} else if (walletStore.connected && variant === "buy" && token.allowance >= amount) {
/**
* case 3
* user is logged in and allowance is greater or equal input and variant is buy
@@ -179,7 +180,7 @@ export const useSacrificeStore = defineStore("sacrifice", {
account: walletStore.address,
});
if (amountBuy * 95n / 100n > amountSacrifice) {
if ((amountBuy * 95n) / 100n > amountSacrifice) {
variant = "buy";
output = amountBuy;
console.log("use buy after comparison sacrificeMemeAndBuyBLOOD and sacrificeMeme");
@@ -188,16 +189,16 @@ export const useSacrificeStore = defineStore("sacrifice", {
output = amountSacrifice;
console.log("use sacrifice after comparison sacrificeMemeAndBuyBLOOD and sacrificeMeme");
}
}
//potential staking rewards
let stakingRewardsNumber = 0;
if (output > 0 && walletStore.connected) {
}
//potential staking rewards
let stakingRewardsNumber = 0;
if (output > 0 && walletStore.connected) {
const stakingReward = await rewardLockerStore.getStakeRewardForSacrificeReward(
token.contractAddress,
output
);
stakingRewardsNumber = stakingReward
}
stakingRewardsNumber = stakingReward;
}
return {
output: output,
variant: variant,
@@ -205,9 +206,8 @@ export const useSacrificeStore = defineStore("sacrifice", {
minBLOOD: minBLOOD,
staking: stakingRewardsNumber,
};
} catch (error) {
console.error("getRewardsFor", error);
console.error("getRewardsFor", error);
}
},
},
+3 -3
View File
@@ -58,15 +58,15 @@ export const useTokenStore = defineStore("token", {
addSteps: [
{
amount: 1000000000000000000000000n,
name: "10m",
name: "1m",
},
{
amount: 10000000000000000000000000n,
name: "100m",
name: "10m",
},
{
amount: 100000000000000000000000000n,
name: "1b",
name: "100m",
},
],
},
+1 -1
View File
@@ -2,7 +2,7 @@ import { defineStore } from "pinia";
import { markRaw } from "vue";
import { useTokenStore } from "./tokens";
import { useRewardLockerStore } from "./rewardlocker";
import { formatBigIntDivision } from "@/helper/helper.js";
import { formatNumber } from "@/helper/helper.js";
import {
createConfig,
configureChains,
+5 -4
View File
@@ -2,8 +2,9 @@
<div class="cycle-page">
<div class="cycle-header container container--variant1">
<div class="bloodline-page-headline header" ref="observerElement">Bloodline Cycle</div>
<div class="bloodline-page-description low-mid-text">
Claim and trade your $BDL at each cycle's end. Become the most powerful bloodline and win extra rewards.
<div class="bloodline-page-description mid-mid-text">
Claim and trade your $BLOOD at each cycle's end. Become the most powerful bloodline and win extra
rewards.
</div>
</div>
<div class="slider-wrapper" :class="{ sticking: sticking }" ref="target">
@@ -28,7 +29,7 @@
<template v-if="difference > 0">
<div class="round-finish-info-key">Sacrifice Goal:</div>
<div class="round-finish-info-value">
{{ cycleStore.getCurrentCycleData?.goalInBLD / 10n ** tokenStore.memeToken.decimals }} $BDL
{{ cycleStore.getCurrentCycleData?.goalInBLD / 10n ** tokenStore.memeToken.decimals }} $BLOOD
</div>
<div class="round-finish-info-key">Time left:</div>
<div class="round-finish-info-value">{{ days }} {{ hours }} {{ minutes }}</div>
@@ -42,7 +43,7 @@
<div class="cycle-winner-left">
<div class="cycle-winner-headline">Cycle Winner</div>
<div class="cycle-winner-subheadline">
+25% Clan Bonus on {{ cycleStore.getCycleWinner.name }} Sacrifice
+ Clan Bonus on {{ cycleStore.getCycleWinner.name }} Sacrifice
</div>
</div>
<div class="cycle-winner-right">
+4 -3
View File
@@ -66,6 +66,7 @@ function openTutorialFunc(e) {
text-align: center
margin-top: 24px
margin-bottom: 48px
padding: 0 12px
@media (min-width: 992px)
font-size: 48px
margin-top: 0px
@@ -73,6 +74,7 @@ function openTutorialFunc(e) {
text-shadow: unset
line-height: 80px
font-weight: 600
padding: 0
.chart-wrapper-coin
display: flex
@@ -106,8 +108,7 @@ function openTutorialFunc(e) {
margin-right: auto
pointer-events: none
user-select: none
@media (min-width: 992px)
width: 100%
width: 100%
.chart-wrapper
width: 600px
height: 600px
@@ -129,7 +130,7 @@ function openTutorialFunc(e) {
#section-header-container
margin: 72px 0
margin: 48px 0
scroll-margin: 150px
.tutorial-header
display: flex