Author SHA1 Message Date
butterscotch a2f8b90cdd comments: proposal how to format output to show fraction. 2023-10-19 16:23:50 +03:00
butterscotch a719ee5989 comments: rewardlocker.js 2023-10-18 21:36:41 +03:00
butterscotch 5e6f373293 comments: sacrifice.js 2023-10-18 21:35:54 +03:00
butterscotch 0b9e14c628 comments: cycle.js 2023-10-18 21:34:04 +03:00
46 changed files with 2771 additions and 3411 deletions
+3 -185
View File
@@ -20,7 +20,6 @@
"sass": "^1.62.1", "sass": "^1.62.1",
"swiper": "^9.4.1", "swiper": "^9.4.1",
"viem": "^1.4.1", "viem": "^1.4.1",
"vite-svg-loader": "^4.0.0",
"vue": "^3.3.2", "vue": "^3.3.2",
"vue-collapsed": "^1.2.8", "vue-collapsed": "^1.2.8",
"vue-router": "^4.2.0", "vue-router": "^4.2.0",
@@ -1535,14 +1534,6 @@
"@stablelib/wipe": "^1.0.1" "@stablelib/wipe": "^1.0.1"
} }
}, },
"node_modules/@trysound/sax": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz",
"integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==",
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/@types/connect": { "node_modules/@types/connect": {
"version": "3.4.35", "version": "3.4.35",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
@@ -2481,7 +2472,8 @@
"node_modules/boolbase": { "node_modules/boolbase": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
"integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",
"dev": true
}, },
"node_modules/borsh": { "node_modules/borsh": {
"version": "0.7.0", "version": "0.7.0",
@@ -2720,44 +2712,6 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/css-select": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz",
"integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==",
"dependencies": {
"boolbase": "^1.0.0",
"css-what": "^6.1.0",
"domhandler": "^5.0.2",
"domutils": "^3.0.1",
"nth-check": "^2.0.1"
},
"funding": {
"url": "https://github.com/sponsors/fb55"
}
},
"node_modules/css-tree": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz",
"integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==",
"dependencies": {
"mdn-data": "2.0.30",
"source-map-js": "^1.0.1"
},
"engines": {
"node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0"
}
},
"node_modules/css-what": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz",
"integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==",
"engines": {
"node": ">= 6"
},
"funding": {
"url": "https://github.com/sponsors/fb55"
}
},
"node_modules/cssesc": { "node_modules/cssesc": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
@@ -2770,36 +2724,6 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/csso": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz",
"integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==",
"dependencies": {
"css-tree": "~2.2.0"
},
"engines": {
"node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/csso/node_modules/css-tree": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz",
"integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==",
"dependencies": {
"mdn-data": "2.0.28",
"source-map-js": "^1.0.1"
},
"engines": {
"node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/csso/node_modules/mdn-data": {
"version": "2.0.28",
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz",
"integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g=="
},
"node_modules/csstype": { "node_modules/csstype": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
@@ -2876,57 +2800,6 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/dom-serializer": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
"integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==",
"dependencies": {
"domelementtype": "^2.3.0",
"domhandler": "^5.0.2",
"entities": "^4.2.0"
},
"funding": {
"url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
}
},
"node_modules/domelementtype": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
"integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/fb55"
}
]
},
"node_modules/domhandler": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",
"integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==",
"dependencies": {
"domelementtype": "^2.3.0"
},
"engines": {
"node": ">= 4"
},
"funding": {
"url": "https://github.com/fb55/domhandler?sponsor=1"
}
},
"node_modules/domutils": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz",
"integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==",
"dependencies": {
"dom-serializer": "^2.0.0",
"domelementtype": "^2.3.0",
"domhandler": "^5.0.3"
},
"funding": {
"url": "https://github.com/fb55/domutils?sponsor=1"
}
},
"node_modules/duplexify": { "node_modules/duplexify": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.2.tgz", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.2.tgz",
@@ -2975,17 +2848,6 @@
"once": "^1.4.0" "once": "^1.4.0"
} }
}, },
"node_modules/entities": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
"engines": {
"node": ">=0.12"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/es6-promise": { "node_modules/es6-promise": {
"version": "4.2.8", "version": "4.2.8",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
@@ -4133,11 +3995,6 @@
"sourcemap-codec": "^1.4.8" "sourcemap-codec": "^1.4.8"
} }
}, },
"node_modules/mdn-data": {
"version": "2.0.30",
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz",
"integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA=="
},
"node_modules/micro-ftch": { "node_modules/micro-ftch": {
"version": "0.3.1", "version": "0.3.1",
"resolved": "https://registry.npmjs.org/micro-ftch/-/micro-ftch-0.3.1.tgz", "resolved": "https://registry.npmjs.org/micro-ftch/-/micro-ftch-0.3.1.tgz",
@@ -4257,6 +4114,7 @@
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",
"integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==",
"dev": true,
"dependencies": { "dependencies": {
"boolbase": "^1.0.0" "boolbase": "^1.0.0"
}, },
@@ -5146,37 +5004,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/svgo": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/svgo/-/svgo-3.0.2.tgz",
"integrity": "sha512-Z706C1U2pb1+JGP48fbazf3KxHrWOsLme6Rv7imFBn5EnuanDW1GPaA/P1/dvObE670JDePC3mnj0k0B7P0jjQ==",
"dependencies": {
"@trysound/sax": "0.2.0",
"commander": "^7.2.0",
"css-select": "^5.1.0",
"css-tree": "^2.2.1",
"csso": "^5.0.5",
"picocolors": "^1.0.0"
},
"bin": {
"svgo": "bin/svgo"
},
"engines": {
"node": ">=14.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/svgo"
}
},
"node_modules/svgo/node_modules/commander": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
"engines": {
"node": ">= 10"
}
},
"node_modules/swiper": { "node_modules/swiper": {
"version": "9.4.1", "version": "9.4.1",
"resolved": "https://registry.npmjs.org/swiper/-/swiper-9.4.1.tgz", "resolved": "https://registry.npmjs.org/swiper/-/swiper-9.4.1.tgz",
@@ -5554,15 +5381,6 @@
} }
} }
}, },
"node_modules/vite-svg-loader": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/vite-svg-loader/-/vite-svg-loader-4.0.0.tgz",
"integrity": "sha512-0MMf1yzzSYlV4MGePsLVAOqXsbF5IVxbn4EEzqRnWxTQl8BJg/cfwIzfQNmNQxZp5XXwd4kyRKF1LytuHZTnqA==",
"dependencies": {
"@vue/compiler-sfc": "^3.2.20",
"svgo": "^3.0.2"
}
},
"node_modules/vite/node_modules/@esbuild/android-arm": { "node_modules/vite/node_modules/@esbuild/android-arm": {
"version": "0.18.20", "version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz",
-1
View File
@@ -21,7 +21,6 @@
"sass": "^1.62.1", "sass": "^1.62.1",
"swiper": "^9.4.1", "swiper": "^9.4.1",
"viem": "^1.4.1", "viem": "^1.4.1",
"vite-svg-loader": "^4.0.0",
"vue": "^3.3.2", "vue": "^3.3.2",
"vue-collapsed": "^1.2.8", "vue-collapsed": "^1.2.8",
"vue-router": "^4.2.0", "vue-router": "^4.2.0",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

+8 -37
View File
@@ -16,10 +16,6 @@ import ConnectWallet from "./components/ConnectWallet.vue";
import BloodSplash from "./components/BloodSplash.vue"; import BloodSplash from "./components/BloodSplash.vue";
import { getNetwork, fetchTransaction } from "@wagmi/core"; import { getNetwork, fetchTransaction } from "@wagmi/core";
import profileIcon from "@/assets/img/profile-icon.svg?component";
import cycleIcon from "@/assets/img/cycle-icon.svg?component";
import homeIcon from "@/assets/img/home-icon.svg?component";
const isMobile = ref(false); const isMobile = ref(false);
const showPanel = ref(false); const showPanel = ref(false);
const splashBlood = ref(0); const splashBlood = ref(0);
@@ -105,7 +101,7 @@ onMounted(async () => {
<div class="footer"> <div class="footer">
<div class="footer-inner"> <div class="footer-inner">
<div class="footer-headline" v-if="!isMobile">Join Bloodline</div> <div class="footer-headline">Join Bloodline</div>
<div class="footer-social-links"> <div class="footer-social-links">
<div class="social-bloodline-badge"> <div class="social-bloodline-badge">
@@ -123,29 +119,18 @@ onMounted(async () => {
<font-awesome-icon icon="fa-brands fa-twitter" /> <font-awesome-icon icon="fa-brands fa-twitter" />
</div> </div>
</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> </div>
</div> </div>
<div class="mobile-navigation-bar" v-if="isMobile"> <div class="mobile-navigation-bar" v-if="isMobile">
<div @click="changeRoute('home')" :class="{ active: route.name === 'home' }"> <div @click="changeRoute('home')" :class="{ active: route.name === 'home' }">
<!-- <font-awesome-icon icon="fa-droplet" /> --> <font-awesome-icon icon="fa-droplet" />
<!-- <img src="/assets/img/sacrifice-icon.png" alt="sacrifice-icon" /> -->
<homeIcon />
</div> </div>
<div @click="changeRoute('cycle')" :class="{ active: route.name === 'cycle' }"> <div @click="changeRoute('cycle')" :class="{ active: route.name === 'cycle' }">
<!-- <font-awesome-icon icon="fa-moon" /> --> <font-awesome-icon icon="fa-moon" />
<!-- <img src="/assets/img/cycle-icon.png" alt="cycle-icon" /> -->
<cycleIcon />
</div> </div>
<div @click="changeRoute('profile')" :class="{ active: route.name === 'profile' }"> <div @click="changeRoute('profile')" :class="{ active: route.name === 'profile' }">
<!-- <img src="/assets/img/profile-icon.svg " alt="profile-icon" /> --> <font-awesome-icon icon="fa-person" />
<profileIcon />
<!-- <font-awesome-icon icon="fa-person" /> -->
</div> </div>
</div> </div>
</template> </template>
@@ -154,30 +139,22 @@ onMounted(async () => {
.footer .footer
height: auto height: auto
background-color: #2D2D2D background-color: var(--midnight-black)
padding-bottom: 72px
@media (min-width: 992px) @media (min-width: 992px)
background-color: var(--midnight-black)
height: 150px height: 150px
min-height: 150px min-height: 150px
display: flex display: flex
flex-direction: column flex-direction: column
justify-content: center justify-content: center
padding-bottom: unset
margin-top: auto
.footer-inner .footer-inner
padding: 24px 0 padding: 16px 0 24px 0
font-size: 24px font-size: 24px
display: flex display: flex
flex-direction: column flex-direction: column
gap: 16px gap: 16px
align-items: center align-items: center
border-top: 1px solid #000
@media (min-width: 992px) @media (min-width: 992px)
padding: 16px 0 24px 0
justify-content: center justify-content: center
border-top: unset
background-color: transparent
.footer-headline .footer-headline
font-size: 16px font-size: 16px
.footer-social-links .footer-social-links
@@ -224,14 +201,8 @@ onMounted(async () => {
div div
font-size: 40px font-size: 40px
cursor: pointer cursor: pointer
-webkit-tap-highlight-color: transparent
&.active &.active
svg color: var(--purple)
path
color: var(--purple)
fill: var(--purple)
.modal-overlay .modal-overlay
background-color: rgb(15, 15, 15, 0.7) background-color: rgb(15, 15, 15, 0.7)
@@ -257,7 +228,7 @@ onMounted(async () => {
z-index: 100 z-index: 100
gap: 16px gap: 16px
@media (min-width: 992px) @media (min-width: 992px)
top: 10% top: 142px
right: 24px right: 24px
left: unset left: unset
transform: unset transform: unset
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"contractName": "Bloodline", "contractName": "Bloodline",
"contractAddress": "0x16351Cd1f3F1eb010758ff9FCf7013f48B0f5495", "contractAddress": "0x51bF3df58D123e8EA43fb2189f18027FD36a08Af",
"abi": [ "abi": [
{ {
"inputs": [ "inputs": [
+1 -97
View File
@@ -1,6 +1,6 @@
{ {
"contractName": "LiquidityOwner", "contractName": "LiquidityOwner",
"contractAddress": "0x460f41499B6dA662ce289b57ba62A75FBd753b5c", "contractAddress": "0xF8bc4Ce13263DD4e12070e3192be50310eF7C95a",
"abi": [ "abi": [
{ {
"inputs": [ "inputs": [
@@ -132,35 +132,6 @@
"stateMutability": "pure", "stateMutability": "pure",
"type": "function" "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": [ "inputs": [
{ {
@@ -198,54 +169,6 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "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": [ "inputs": [
{ {
@@ -288,25 +211,6 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "cycleTicks",
"outputs": [
{
"internalType": "int24",
"name": "",
"type": "int24"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "memeAltar", "name": "memeAltar",
+106 -46
View File
@@ -1,6 +1,6 @@
{ {
"contractName": "MemeAltar", "contractName": "MemeAltar",
"contractAddress": "0xAa72C9dB8332c28b4ebcC36D927e967EFC98D78C", "contractAddress": "0xE4F42F3f8B0E57b1054D457fe3b49a1A10B1aCEa",
"abi": [ "abi": [
{ {
"inputs": [ "inputs": [
@@ -53,11 +53,6 @@
"name": "CycleCompletedRegistrationFailed", "name": "CycleCompletedRegistrationFailed",
"type": "error" "type": "error"
}, },
{
"inputs": [],
"name": "GoalCannotBeZero",
"type": "error"
},
{ {
"inputs": [], "inputs": [],
"name": "InsufficientOutputAmount", "name": "InsufficientOutputAmount",
@@ -220,16 +215,42 @@
"anonymous": false, "anonymous": false,
"inputs": [ "inputs": [
{ {
"indexed": true, "components": [
"internalType": "uint64", {
"name": "b", "internalType": "uint40",
"type": "uint64" "name": "b1",
}, "type": "uint40"
{ },
"indexed": true, {
"internalType": "uint64", "internalType": "uint40",
"name": "m", "name": "m1",
"type": "uint64" "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", "name": "NewBM",
@@ -288,14 +309,41 @@
{ {
"inputs": [ "inputs": [
{ {
"internalType": "uint64", "components": [
"name": "newB", {
"type": "uint64" "internalType": "uint40",
}, "name": "b1",
{ "type": "uint40"
"internalType": "uint64", },
"name": "newM", {
"type": "uint64" "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", "name": "adjustBM",
@@ -362,12 +410,12 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "b", "name": "bloodline",
"outputs": [ "outputs": [
{ {
"internalType": "uint64", "internalType": "contract Bloodline",
"name": "", "name": "",
"type": "uint64" "type": "address"
} }
], ],
"stateMutability": "view", "stateMutability": "view",
@@ -375,12 +423,37 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "bloodline", "name": "bm",
"outputs": [ "outputs": [
{ {
"internalType": "contract Bloodline", "internalType": "uint40",
"name": "", "name": "b1",
"type": "address" "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", "stateMutability": "view",
@@ -589,9 +662,9 @@
"name": "issuancePrice", "name": "issuancePrice",
"outputs": [ "outputs": [
{ {
"internalType": "uint128", "internalType": "uint256",
"name": "", "name": "",
"type": "uint128" "type": "uint256"
} }
], ],
"stateMutability": "view", "stateMutability": "view",
@@ -610,19 +683,6 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "m",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"contractName": "RewardLocker", "contractName": "RewardLocker",
"contractAddress": "0x8b15b2CB5b019472C31aEf487BF700037c321F85", "contractAddress": "0x2952253374973DE0ffbFe35269Ca13FaF28B935F",
"abi": [ "abi": [
{ {
"inputs": [ "inputs": [
File diff suppressed because one or more lines are too long
-5
View File
@@ -1,5 +0,0 @@
{
"contractName": "WETH",
"contractAddress": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
"contractAddressMainnet": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
}
-3
View File
@@ -1,3 +0,0 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5332 0.223612C14.5688 -0.68935 16.3324 1.37298 15.6956 3.16362C13.5347 9.2395 14.8624 16.1404 19.3476 20.6276C23.8556 25.1377 30.7963 26.4633 36.8868 24.2619C38.659 23.6213 40.6637 25.369 39.7876 27.3579C39.7616 27.4167 39.7355 27.4752 39.7091 27.534C38.1498 30.9948 35.6553 34.2494 32.4281 36.4315C28.9883 38.7574 24.9319 40 20.7803 40H20.7783C15.9506 39.9948 11.2749 38.3095 7.5529 35.2332C3.83085 32.1569 1.2942 27.8809 0.377993 23.1382C-0.538209 18.3955 0.22314 13.4818 2.53147 9.23928C4.71976 5.21736 8.39949 2.09189 12.4733 0.250546L12.5332 0.223612Z" fill="#F9F9FA"/>
</svg>

Before

Width:  |  Height:  |  Size: 731 B

-3
View File
@@ -1,3 +0,0 @@
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M16.4808 0.762253C16.1401 0.28454 15.5867 0 14.9994 0C14.4107 0 13.8586 0.283234 13.5153 0.762253C9.85024 5.87744 0.667969 19.3317 0.667969 25.6686C0.667969 33.5835 7.08316 40 14.9981 40C22.9143 40 29.3308 33.5835 29.3308 25.6686C29.3321 19.3317 20.1459 5.87744 16.4808 0.762253Z" fill="#F9F9FA"/>
</svg>

Before

Width:  |  Height:  |  Size: 410 B

-12
View File
@@ -1,12 +0,0 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1478_31440)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.8333 12C11.8333 7.58797 15.498 7.6 19.9997 7.6C24.5035 7.6 28.1661 7.58797 28.1661 12C28.1661 16.412 24.5035 20 19.9997 20C15.498 20 11.8333 16.412 11.8333 12ZM39.9114 35.2719C38.4271 28.5539 33.7845 23.5959 27.674 21.3459C30.912 18.7919 32.8005 14.6619 32.1063 10.1399C31.302 4.89386 26.8472 0.695954 21.4697 0.0839537C14.0464 -0.762046 7.75014 4.89797 7.75014 12C7.75014 15.78 9.53858 19.1479 12.3274 21.3459C6.21487 23.5959 1.57433 28.5539 0.088048 35.2719C-0.450933 37.7139 1.558 40 4.10795 40H35.8915C38.4434 40 40.4524 37.7139 39.9114 35.2719Z" fill="#F9F9FA"/>
<path d="M17.2809 18.8008L16.4813 16.4008L15.2025 15.2008L19.3594 15.2008L18.0813 16.4008L17.2809 18.8008Z" fill="#F9F9FA"/>
<path d="M23.359 18.8008L22.5594 16.4008L21.2806 15.2008L25.4375 15.2008L24.1594 16.4008L23.359 18.8008Z" fill="#F9F9FA"/>
</g>
<defs>
<clipPath id="clip0_1478_31440">
<rect width="40" height="40" fill="white"/>
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

-1
View File
@@ -20,6 +20,5 @@
&[disabled], &.btn--disabled &[disabled], &.btn--disabled
background-color: darken($purple, 10%) background-color: darken($purple, 10%)
cursor: not-allowed cursor: not-allowed
color: var(--white-dark)
&:hover,&:focus,&:active &:hover,&:focus,&:active
background-color: darken($purple, 10%), background-color: darken($purple, 10%),
+2
View File
@@ -34,6 +34,8 @@ body
display: flex display: flex
flex-direction: column flex-direction: column
height: 100vh height: 100vh
.footer
margin-top: auto
.container .container
margin-right: auto margin-right: auto
+1 -11
View File
@@ -9,7 +9,6 @@ $tertiary-dark: darken($tertiary, 20%)
$tertiary-light: lighten($tertiary, 20%) $tertiary-light: lighten($tertiary, 20%)
$white: #F9F9FA $white: #F9F9FA
$white-dark: darken($white, 20%)
$black: #0F0F0F $black: #0F0F0F
$grey: #858585 $grey: #858585
$grey-light: lighten($grey, 20%) $grey-light: lighten($grey, 20%)
@@ -32,8 +31,7 @@ $button-background-color: $black
--tertiary: #{$tertiary} --tertiary: #{$tertiary}
--tertiary-light: #{$tertiary-light} --tertiary-light: #{$tertiary-light}
--tertiary-dark: #{$tertiary-dark} --tertiary-dark: #{$tertiary-dark}
--white: #{$white} --white: #{#F9F9FA}
--white-dark: #{$white-dark}
--grey: #{$grey} --grey: #{$grey}
--grey-light: #{$grey-light} --grey-light: #{$grey-light}
--grey2: #{$grey2} --grey2: #{$grey2}
@@ -101,14 +99,6 @@ $button-background-color: $black
line-height: normal line-height: normal
// @media (min-width: 992px) // @media (min-width: 992px)
// font-size: 30px // font-size: 30px
.sub-header-2
font-family: Inter
font-style: normal
font-weight: 400
line-height: normal
font-size: 24px
@media (min-width: 992px)
font-size: 32px
// :root // :root
// --font-size-text: 16px // --font-size-text: 16px
+15 -37
View File
@@ -14,15 +14,14 @@
:slidesPerView="3" :slidesPerView="3"
:centeredSlides="false" :centeredSlides="false"
:initial-slide="0" :initial-slide="0"
:spaceBetween="0" :spaceBetween="IsMobile ? 35 : 0"
@swiper="onSwiper" @swiper="onSwiper"
> >
<swiper-slide class="blood-chart-element" v-for="coin in token" :key="coin.name"> <swiper-slide class="blood-chart-element" v-for="coin in token" :key="coin.name">
<div class="blood-chart-element-header"> <div class="blood-chart-element-header">
<div class="blood-chart-coin"> <div class="blood-chart-coin">
<template v-if="cycleStore.getCycleWinner.contractAddress === coin.contractAddress"> <template v-if="cycleStore.getCycleWinner.contractAddress === coin.contractAddress">
<img class="logo" :src="coin.vamplogo" alt="logo" /> <img :src="coin.vampwinner2" alt="logo" />
<img class="crown" src="/assets/img/winnerCrown.png" alt="" />
</template> </template>
<template v-else> <template v-else>
<img :src="coin.vamplogo" alt="logo" /> <img :src="coin.vamplogo" alt="logo" />
@@ -72,13 +71,8 @@
</div> </div>
</div> </div>
<div class="blood-chart-element-footer"> <div class="blood-chart-element-footer">
<div <div class="blood-chart-amount">
class="blood-chart-amount" {{ formatNumber(coin.amountInBLD / 10n ** tokenStore.memeToken.decimals) }}
:title="formatBigIntDivision(coin.amountInBLD, 10n ** tokenStore.memeToken.decimals)"
>
{{
compactNumber(formatBigIntDivision(coin.amountInBLD, 10n ** tokenStore.memeToken.decimals))
}}
</div> </div>
<div>$BLOOD</div> <div>$BLOOD</div>
</div> </div>
@@ -101,7 +95,7 @@
<script setup> <script setup>
import { computed, ref, inject, onMounted } from "vue"; import { computed, ref, inject, onMounted } from "vue";
import { getPercentage, formatNumber, compactNumber, formatBigIntDivision } from "@/helper/helper.js"; import { getPercentage, compactNumber, formatNumber } from "@/helper/helper.js";
import { useCycleStore } from "@/stores/cycles"; import { useCycleStore } from "@/stores/cycles";
import { useMemeburnerStore } from "@/stores/memeburner"; import { useMemeburnerStore } from "@/stores/memeburner";
@@ -117,8 +111,6 @@ import "swiper/css/pagination";
const cycleStore = useCycleStore(); const cycleStore = useCycleStore();
const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
const isMobile = inject("isMobile");
const props = defineProps({ const props = defineProps({
data: Object, data: Object,
}); });
@@ -133,15 +125,13 @@ function onSwiper(swiper) {
swiperInstance.value = swiper; swiperInstance.value = swiper;
} }
const token = computed(() => { const token = computed(() => props.data?.token);
return props.data?.token.sort((a, b) => (a.amount > b.amount ? -1 : b.amount > a.amount ? 1 : 0));
});
//start with visual 8% of the filled bar, because otherwise the percentage number is not visible //start with visual 5% of the filled bar, because otherwise the percentage number is not visible
function getPercentageBloodChart(amount, goal) { function getPercentageBloodChart(amount, goal) {
let returnNumber = 8; let returnNumber = 5;
if ((Number(amount) / Number(goal)) * 100 < 8) { if ((Number(amount) / Number(goal)) * 100 < 5) {
returnNumber = 8; returnNumber = 5;
} else { } else {
returnNumber = (Number(amount) / Number(goal)) * 100; returnNumber = (Number(amount) / Number(goal)) * 100;
} }
@@ -156,13 +146,11 @@ function getPercentageBloodChart(amount, goal) {
justify-content: center justify-content: center
// margin-bottom: 80px // margin-bottom: 80px
position: relative position: relative
margin-top: 24px
.blood-chart .blood-chart
height: 560px height: 750px
width: 100% width: 100%
justify-content: space-around justify-content: space-around
display: inline-flex display: inline-flex
overflow: unset
@media (min-width: 992px) @media (min-width: 992px)
gap: 32px gap: 32px
width: unset width: unset
@@ -184,31 +172,21 @@ function getPercentageBloodChart(amount, goal) {
margin-right: auto margin-right: auto
position: relative position: relative
margin-bottom: 16px margin-bottom: 16px
// overflow: hidden overflow: hidden
height: 80px height: 80px
width: 80px width: 80px
@media (min-width: 992px) @media (min-width: 992px)
height: 72px height: 72px
width: 72px width: 72px
img img
&.logo height: 100%
height: 100% width: 100%
width: 100%
border: 1px solid yellow
border-radius: 50%
img
&.crown
position: absolute
top: -10px
transform: translate(-50%, -50%)
left: 50%
.blood-chart-coin-title .blood-chart-coin-title
text-align: center text-align: center
margin-bottom: 32px margin-bottom: 32px
.blood-chart-element-body .blood-chart-element-body
background-color: rgba(233, 233, 233, 0.2) background-color: rgba(233, 233, 233, 0.2)
flex: 1 1 100% flex: 0 0 500px
width: 60px width: 60px
border-radius: 8px 8px 40px 40px border-radius: 8px 8px 40px 40px
text-align: left text-align: left
+1
View File
@@ -69,6 +69,7 @@ const props = defineProps({
display: flex display: flex
text-align: left text-align: left
gap: 16px gap: 16px
height: 56px
.token-logo .token-logo
margin-left: auto margin-left: auto
.connected-stake-buttons .connected-stake-buttons
+17 -35
View File
@@ -4,12 +4,12 @@
<template v-slot:body> <template v-slot:body>
<token-name-price <token-name-price
:name="tokenStore.getToken(walletStore.memeToken?.contractAddress)?.name" :name="tokenStore.getToken(walletStore.memeToken?.contractAddress)?.name"
:price="formatNumber(walletStore.unclaimedRewards, 10n ** tokenStore.memeToken.decimals)" :price="formatNumber(walletStore.unclaimedRewards)"
></token-name-price> ></token-name-price>
<token-logo img="/assets/img/token/bloodline.png" :alt="'bloodline logo'"></token-logo> <token-logo img="/assets/img/token/bloodline.png" :alt="'bloodline logo'"></token-logo>
</template> </template>
<template v-slot:actions> <template v-slot:actions>
<template v-if="walletStore.unclaimedRewards > 0n"> <template v-if="walletStore.unclaimedRewards > 0">
<Transition name="smooth"> <Transition name="smooth">
<div class="connected-stake-buttons" v-show="!stakeMenu"> <div class="connected-stake-buttons" v-show="!stakeMenu">
<div class="btn btn-immortal mid-mid-text" @click="claimAll" v-if="stateStake === 0">Claim</div> <div class="btn btn-immortal mid-mid-text" @click="claimAll" v-if="stateStake === 0">Claim</div>
@@ -19,9 +19,7 @@
<div class="btn btn-immortal stake-button" disabled v-else-if="stateStake === 3"> <div class="btn btn-immortal stake-button" disabled v-else-if="stateStake === 3">
<loading-component></loading-component> <loading-component></loading-component>
</div> </div>
<div class="btn btn-immortal mid-mid-text" @click="openStake" v-if="stateStake === 0"> <div class="btn btn-immortal mid-mid-text" @click="openStake">Stake</div>
Stake
</div>
</div> </div>
</Transition> </Transition>
<Transition name="smooth"> <Transition name="smooth">
@@ -33,18 +31,7 @@
v-if="stakeMenu" v-if="stakeMenu"
> >
<template v-slot:body> <template v-slot:body>
<div <div class="btn btn-immortal stake-button" disabled v-if="stateClaimComp === 0">
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 Enter Amount
</div> </div>
<div <div
@@ -54,10 +41,10 @@
> >
Stake & Claim Rest Stake & Claim Rest
</div> </div>
<div class="btn btn-immortal stake-button" disabled v-else-if="stateClaimComp === 2"> <div class="btn btn-immortal stake-button" disabled v-if="stateClaimComp === 2">
Sign Transaction Sign Transaction
</div> </div>
<div class="btn btn-immortal stake-button" disabled v-else-if="stateClaimComp === 3"> <div class="btn btn-immortal stake-button" disabled v-if="stateClaimComp === 3">
<loading-component></loading-component> <loading-component></loading-component>
</div> </div>
<div <div
@@ -70,18 +57,14 @@
<template v-slot:message-end> <template v-slot:message-end>
<div class="input-balance"> <div class="input-balance">
Balance: Balance:
{{ formatNumber(walletStore.unclaimedRewards, 10n ** tokenStore.memeToken.decimals) }} {{ formatNumber(walletStore.unclaimedRewards) }}
</div> </div>
</template> </template>
</stake-menu> </stake-menu>
</Transition> </Transition>
</template> <div class="connected-stake-first-round small-text text-center">
<template v-else-if="cycleStore.rewardsSacrificeCurrentCycle > 0n"> You can claim, once the cycle is over.
<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> </div>
<div class="text-center">You can claim, once the cycle is over</div>
</template> </template>
<template v-else> <template v-else>
<div class="btn btn-immortal mid-mid-text text-center" @click="router.push({ name: 'home' })"> <div class="btn btn-immortal mid-mid-text text-center" @click="router.push({ name: 'home' })">
@@ -103,7 +86,6 @@ import { waitForTransaction } from "@wagmi/core";
import LoadingComponent from "@/components/LoadingComponent.vue"; import LoadingComponent from "@/components/LoadingComponent.vue";
import StakeSuccessToast from "@/components/toasts/StakeSuccessToast.vue"; import StakeSuccessToast from "@/components/toasts/StakeSuccessToast.vue";
import { useCycleStore } from "@/stores/cycles";
import { useWalletStoreV2 } from "@/stores/walletV2"; import { useWalletStoreV2 } from "@/stores/walletV2";
import { useTokenStore } from "@/stores/tokens"; import { useTokenStore } from "@/stores/tokens";
import { useRewardLockerStore } from "@/stores/rewardlocker"; import { useRewardLockerStore } from "@/stores/rewardlocker";
@@ -116,8 +98,6 @@ const toast = useToast();
const rewardLockerStore = useRewardLockerStore(); const rewardLockerStore = useRewardLockerStore();
const walletStore = useWalletStoreV2(); const walletStore = useWalletStoreV2();
const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
const cycleStore = useCycleStore();
const router = useRouter(); const router = useRouter();
const props = defineProps({ const props = defineProps({
@@ -148,8 +128,10 @@ function openStake() {
async function stakeAndClaimAllCycles() { async function stakeAndClaimAllCycles() {
try { try {
const unclaimedRewards = walletStore.memeToken?.unclaimedRewards / 10n ** tokenStore.memeToken.decimals;
stateClaim.value = 2; stateClaim.value = 2;
const coefficient = BigInt(10000 * tokenNumber.value) / walletStore.unclaimedRewards; console.log("unclaimedRewards", unclaimedRewards);
const coefficient = BigInt(10000 * tokenNumber.value) / unclaimedRewards;
var hash = await rewardLockerStore.stakeAndClaimAllCycles(coefficient); var hash = await rewardLockerStore.stakeAndClaimAllCycles(coefficient);
stateClaim.value = 3; stateClaim.value = 3;
const data = await waitForTransaction({ const data = await waitForTransaction({
@@ -164,9 +146,9 @@ async function stakeAndClaimAllCycles() {
// //
console.log("rewardData", rewardData); console.log("rewardData", rewardData);
//ClaimedReward (address staker, uint256 reward) //ClaimedReward (address staker, uint256 reward)
const outputClaim = formatNumber(BigInt(rewardData.topics[2]), 10n ** tokenStore.memeToken.decimals); const outputClaim = BigInt(rewardData.topics[2]) / 10n ** tokenStore.memeToken.decimals;
showSuccessToast( showSuccessToast(
outputClaim, formatNumber(outputClaim),
"Success!", "Success!",
"You just claimed and staked", "You just claimed and staked",
"Join the next cycle to increase your rewards and win with your clan" "Join the next cycle to increase your rewards and win with your clan"
@@ -195,9 +177,9 @@ async function claimAll() {
// //
console.log("rewardData", rewardData); console.log("rewardData", rewardData);
//ClaimedReward (address staker, uint256 reward) //ClaimedReward (address staker, uint256 reward)
const outputClaim = formatNumber(BigInt(rewardData.topics[2]), 10n ** tokenStore.memeToken.decimals); const outputClaim = rewardData.topics[2] / 10n ** tokenStore.memeToken.decimals;
showSuccessToast( showSuccessToast(
outputClaim, formatNumber(outputClaim),
"Success!", "Success!",
"You just claimed", "You just claimed",
"Join the next cycle to increase your rewards and win with your clan." "Join the next cycle to increase your rewards and win with your clan."
@@ -227,7 +209,7 @@ const stateClaimComp = computed(() => {
tokenNumber.value === null || tokenNumber.value === null ||
tokenNumber.value === "" || tokenNumber.value === "" ||
tokenNumber.value === 0 || tokenNumber.value === 0 ||
BigInt(tokenNumber.value) > walletStore.unclaimedRewards / 10n ** tokenStore.memeToken.decimals tokenNumber.value > walletStore.memeToken?.unclaimedRewards
) { ) {
returnState = 0; returnState = 0;
} else if (stateClaim.value === 2) { } else if (stateClaim.value === 2) {
+18 -13
View File
@@ -11,19 +11,22 @@
> >
<div class="connector-icon"> <div class="connector-icon">
<template v-if="connector.id === 'injected'"> <template v-if="connector.id === 'injected'">
<template v-if="connector.name === 'MetaMask'"> <font-awesome-icon :icon="['fas', 'wallet']" />
<img :src="`/assets/img/connectors/metaMask.svg`" :alt="`${connector.name} Logo`" />
</template>
<template v-else>
<font-awesome-icon :icon="['fas', 'wallet']" />
</template>
</template> </template>
<template v-else> <template v-else>
<img :src="`/assets/img/connectors/${connector.id}.svg`" :alt="`${connector.name} Logo`" /> <img :src="`/assets/img/connectors/${connector.id}.svg`" :alt="`${connector.name} Logo`" />
</template> </template>
</div> </div>
<div class="connector-name"> <div class="connector-name">
{{ connector.name }} <template
v-if="
connector.id !== 'metaMask' ||
(connector.id === 'metaMask' && isMetaMaskInstalled(connector))
"
>
{{ connector.name }}
</template>
<template v-else> Install {{ connector.name }} </template>
</div> </div>
</div> </div>
</div> </div>
@@ -36,7 +39,7 @@
<div class="connected-header-avatar"> <div class="connected-header-avatar">
<img :src="getblocky(walletStore.address)" alt="avatar" /> <img :src="getblocky(walletStore.address)" alt="avatar" />
</div> </div>
<div class="connected-header-address" :title="walletStore.address"> <div class="connected-header-address">
{{ getAddressShortName(walletStore.address) }} {{ getAddressShortName(walletStore.address) }}
</div> </div>
<div class="connected-header-logout" @click="disconnectWallet"> <div class="connected-header-logout" @click="disconnectWallet">
@@ -48,9 +51,7 @@
<div class="connected-token" v-for="token in walletStore.token"> <div class="connected-token" v-for="token in walletStore.token">
<token-name-price <token-name-price
:name="tokenStore.getToken(token.contractAddress).name" :name="tokenStore.getToken(token.contractAddress).name"
:price=" :price="token.balanceOf / 10n ** tokenStore.getToken(token.contractAddress).decimals"
formatNumber(token.balanceOf, 10n ** tokenStore.getToken(token.contractAddress).decimals)
"
></token-name-price> ></token-name-price>
<div class="connected-token-button"> <div class="connected-token-button">
<div class="bloodline-badge grey" @click="badgeClick(token)"> <div class="bloodline-badge grey" @click="badgeClick(token)">
@@ -79,7 +80,7 @@ import TokenNamePrice from "./TokenNamePrice.vue";
import TokenLogo from "./TokenLogo.vue"; import TokenLogo from "./TokenLogo.vue";
import StakeComponentV1 from "@/components/StakeComponentV1.vue"; import StakeComponentV1 from "@/components/StakeComponentV1.vue";
import { getAddressShortName, getblocky, formatNumber } from "@/helper/helper.js"; import { getAddressShortName, getblocky } from "@/helper/helper.js";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { disconnect } from "@wagmi/core"; import { disconnect } from "@wagmi/core";
@@ -130,7 +131,10 @@ function badgeClick(token) {
//special case for metaMask, but I think that is the most used wallet //special case for metaMask, but I think that is the most used wallet
async function connectWallet(connector) { async function connectWallet(connector) {
console.log("connector", connector); if (connector.id === "metaMask" && !isMetaMaskInstalled(connector)) {
window.open(" https://metamask.io/", "_blank");
return;
}
instance.parent.emit("update:modelValue", false); instance.parent.emit("update:modelValue", false);
await walletStore.connectWallet(toRaw(connector)); await walletStore.connectWallet(toRaw(connector));
} }
@@ -205,6 +209,7 @@ async function connectWallet(connector) {
display: flex display: flex
gap: 16px gap: 16px
align-items: center align-items: center
height: 56px
.connected-token-button .connected-token-button
margin-left: auto margin-left: auto
.bloodline-badge .bloodline-badge
+2 -3
View File
@@ -1,8 +1,7 @@
<template> <template>
<div class="rewards-wrapper"> <div class="rewards-wrapper">
<div class="rewards-headline low-mid-text"> <div class="rewards-headline low-mid-text">
<div class="rewards-title">{{ props.title }}</div> {{ props.title }}
<div class="rewards-sub-title" v-if="props.subTitle">{{ props.subTitle }}</div>
</div> </div>
<div class="rewards-inner"> <div class="rewards-inner">
<token-name-price name="$BLOOD" :price="props.amount"></token-name-price> <token-name-price name="$BLOOD" :price="props.amount"></token-name-price>
@@ -17,7 +16,6 @@ import TokenLogo from "@/components/TokenLogo.vue";
const props = defineProps({ const props = defineProps({
title: String, title: String,
subTitle: String,
info: String, info: String,
amount: [String, Number], amount: [String, Number],
image: String, image: String,
@@ -35,5 +33,6 @@ const props = defineProps({
padding: 0 6px 6px 6px padding: 0 6px 6px 6px
border-bottom: 1px solid var(--grey, #858585) border-bottom: 1px solid var(--grey, #858585)
justify-content: space-between justify-content: space-between
height: 56px
box-sizing: content-box box-sizing: content-box
</style> </style>
+12 -17
View File
@@ -1,6 +1,6 @@
<template> <template>
<div class="sacrifice-wrapper card card--glow"> <div class="sacrifice-wrapper card card--glow">
<div class="sacrifice-headline">Select Sacrifice</div> <div class="sacrifice-headline">Select Sacrifice {{ splashBlood }}</div>
<div class="sacrifice-select-tokens"> <div class="sacrifice-select-tokens">
<div class="sacrifice-tokens"> <div class="sacrifice-tokens">
<div <div
@@ -30,7 +30,7 @@
:modelValue="sacrificeStore.sacrificeNumber / 10n ** activeToken.decimals" :modelValue="sacrificeStore.sacrificeNumber / 10n ** activeToken.decimals"
@input=" @input="
($event) => { ($event) => {
const value = BigInt($event.target.value) * 10n ** activeToken.decimals; const value = BigInt($event.target.value) * 10n ** 18n;
sacrificeStore.sacrificeNumber = value; sacrificeStore.sacrificeNumber = value;
processChange(value); processChange(value);
} }
@@ -56,10 +56,10 @@
<template v-else> -{{ steps.name }} </template> <template v-else> -{{ steps.name }} </template>
</div> </div>
</template> </template>
<template v-slot:message-end v-if="activeWalletToken?.balanceOf >= 0"> <template v-slot:message-end v-if="activeWalletToken?.balanceOf">
<div class="input-balance tiny-text"> <div class="input-balance tiny-text">
Balance: Balance:
{{ formatNumber(activeWalletToken?.balanceOf, 10n ** activeToken.decimals) }} {{ BigInt(activeWalletToken?.balanceOf) / 10n ** activeToken.decimals }}
</div> </div>
<div class="input-max tiny-text" @click="addMaxTokens">Max</div> <div class="input-max tiny-text" @click="addMaxTokens">Max</div>
</template> </template>
@@ -77,10 +77,7 @@
}" }"
> >
<div class="sacrifice-to-body"> <div class="sacrifice-to-body">
<token-name-price <token-name-price name="$BLOOD" :price="`≈${formatNumber(output)}`"></token-name-price>
name="$BLOOD"
:price="`≈${formatNumber(output, 10n ** activeToken.decimals)}`"
></token-name-price>
<token-logo :img="activeToken.vamp.logo" :size="64" :alt="activeToken.vamp.name"></token-logo> <token-logo :img="activeToken.vamp.logo" :size="64" :alt="activeToken.vamp.name"></token-logo>
</div> </div>
@@ -100,9 +97,7 @@
> >
No Staking Bonus No Staking Bonus
</div> </div>
<div class="mid-mid-text" v-else> <div class="mid-mid-text" v-else>+ {{ stakingOutput }} Staking Bonus</div>
+ {{ formatNumber(stakingOutput, 10n ** activeToken.decimals) }} Staking Bonus
</div>
<div class="icon"> <div class="icon">
<font-awesome-icon icon="chevron-down" /> <font-awesome-icon icon="chevron-down" />
</div> </div>
@@ -248,7 +243,6 @@ const stateComputed = computed(() => {
}); });
const processChange = debounce(async (value) => { const processChange = debounce(async (value) => {
const rewardValue = await sacrificeStore.getRewardsFor(value, activeToken.value); const rewardValue = await sacrificeStore.getRewardsFor(value, activeToken.value);
console.log("rewardValue", rewardValue);
output.value = rewardValue.output; output.value = rewardValue.output;
stakingOutput.value = rewardValue.staking; stakingOutput.value = rewardValue.staking;
}); });
@@ -284,7 +278,7 @@ async function approveToken(amount) {
console.log("data", data); console.log("data", data);
activeToken.value.allowance = await tokenStore.allowance(); activeToken.value.allowance = await tokenStore.allowance();
sacrificeStore.sacrificeState = 1; sacrificeStore.sacrificeState = 1;
showApprovedToast(); approveToast.value = showApprovedToast();
} catch (error) { } catch (error) {
console.error(error); console.error(error);
throw new Error(error); throw new Error(error);
@@ -328,8 +322,10 @@ function showApprovedToast(value, header, subheader, info) {
subheader: subheader, subheader: subheader,
info: info, 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: { listeners: {
// sacrificed: showSplash, sacrificed: showSplash,
}, },
}; };
@@ -337,10 +333,10 @@ function showApprovedToast(value, header, subheader, info) {
return toast(content, { return toast(content, {
position: "top-right", position: "top-right",
icon: false, icon: false,
timeout: 5000,
closeOnClick: false, closeOnClick: false,
// toastClassName: "modal-overlay", // toastClassName: "modal-overlay",
hideProgressBar: true, hideProgressBar: true,
timeout: false,
toastClassName: "approve-toast toast-card", toastClassName: "approve-toast toast-card",
}); });
} }
@@ -351,7 +347,6 @@ function showSplash() {
//call function in the store and remove icon, //call function in the store and remove icon,
async function sacrificeToken() { async function sacrificeToken() {
console.log("activeToken.value", activeToken.value);
var result = await sacrificeStore.sacrificeToken(sacrificeStore.sacrificeNumber, activeToken.value); var result = await sacrificeStore.sacrificeToken(sacrificeStore.sacrificeNumber, activeToken.value);
if (result) { if (result) {
showSplash(); showSplash();
@@ -488,7 +483,6 @@ async function changeActiveToken(token) {
.value-adder .value-adder
display: flex display: flex
gap: 6px gap: 6px
flex-wrap: wrap
.sacrifice-adder-step .sacrifice-adder-step
font-size: 12px font-size: 12px
align-items: center align-items: center
@@ -519,6 +513,7 @@ async function changeActiveToken(token) {
.sacrifice-to-body .sacrifice-to-body
display: flex display: flex
justify-content: space-between justify-content: space-between
height: 56px
.sacrificed-info .sacrificed-info
display: flex display: flex
padding: 8px 24px padding: 8px 24px
+60 -96
View File
@@ -31,61 +31,56 @@
<div class="connected-stake-body"> <div class="connected-stake-body">
<slot name="body"> <slot name="body">
<token-name-price <token-name-price
name="$BLOOD staked" v-if="walletStore.memeToken?.staked"
:price="formatNumber(walletStore.staked, 10n ** tokenStore.memeToken.decimals)" :name="tokenStore.getToken(walletStore.memeToken?.contractAddress)?.name"
:price="formatNumber(walletStore.memeToken?.staked / 10n ** tokenStore.memeToken.decimals)"
></token-name-price> ></token-name-price>
<token-logo img="/assets/img/token/bloodline.png" :alt="'bloodline-token'"></token-logo> <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> <token-name-price class="stake-reward" name="Extra Reward" price="+25%"></token-name-price>
</slot> </slot>
</div> </div>
<slot name="actions"> <slot name="actions">
<div class="connected-stake-buttons" v-if="!stakeMenu"> <div class="connected-stake-buttons" v-if="!stakeMenu">
<template v-if="!walletStore.connected"> <div class="mid-mid-text text-center" disabled v-if="!walletStore.connected">
<div class="mid-mid-text text-center" disabled>Please Connect Your Wallet</div> Please Connect Your Wallet
</template> </div>
<template v-else-if="walletStore.connected && !ableToUnstake"> <div
<div class="btn btn-immortal mid-mid-text" disabled v-if="cycleStore.currentCycle === 1"> class="btn btn-immortal mid-mid-text"
Stake disabled
</div> v-if="walletStore.connected && cycleStore.currentCycle === 1"
<div >
class="btn btn-immortal mid-mid-text" Stake
v-else-if="cycleStore.currentCycle > 1" </div>
@click="openStake" <div
> class="btn btn-immortal mid-mid-text"
Stake v-else-if="walletStore.connected && cycleStore.currentCycle > 1"
</div> @click="openStake"
<div >
v-if="(walletStore.memeToken?.staked === 0n && !stakeonly) || cycleStore.currentCycle === 1" Stake
class="btn btn-immortal btn--disabled mid-mid-text" </div>
> <div
Unstake v-if="
</div> walletStore.connected &&
<div v-else-if="!stakeonly" class="btn btn-immortal mid-mid-text" @click="openUnstake"> ((walletStore.memeToken?.staked === 0 && !stakeonly) || cycleStore.currentCycle === 1)
Order Unstake "
</div> class="btn btn-immortal btn--disabled mid-mid-text"
</template> >
<template v-else-if="walletStore.connected && ableToUnstake"> Unstake
<div </div>
class="btn btn-immortal mid-mid-text text-center" <div
v-if="unstakeState === 0 && walletStore.orderedUnstakedAmount > 0n && ableToUnstake" v-else-if="walletStore.connected && !stakeonly"
@click="unstake" class="btn btn-immortal mid-mid-text"
> @click="openUnstake"
Claim Unstaked $BLOOD >
</div> Unstake
<div class="btn btn--disabled mid-mid-text text-center" v-else-if="unstakeState === 1"> </div>
Sign Transaction
</div>
<div class="btn btn--disabled mid-mid-text text-center" v-else-if="unstakeState === 2">
<loading-component></loading-component>
</div>
</template>
</div> </div>
<Transition name="smooth"> <Transition name="smooth">
<stake-menu <stake-menu
v-model="tokenNumber" v-model="tokenNumber"
@close="stakeMenu = false" @close="stakeMenu = false"
:stake="stake" :stake="stake"
:amount="walletStore.balanceOf" :amount="balanceOf"
v-if="stakeMenu & !unstakeMenu" v-if="stakeMenu & !unstakeMenu"
> >
<template v-slot:body> <template v-slot:body>
@@ -109,10 +104,7 @@
</div> </div>
</template> </template>
<template v-slot:message-end> <template v-slot:message-end>
<div class="input-balance"> <div class="input-balance">Balance: {{ formatNumber(balanceOf) }}</div>
Balance:
{{ formatNumber(walletStore.balanceOf, 10n ** tokenStore.memeToken.decimals) }}
</div>
</template> </template>
</stake-menu> </stake-menu>
<div class="unstake-menu" v-else-if="stakeMenu & unstakeMenu"> <div class="unstake-menu" v-else-if="stakeMenu & unstakeMenu">
@@ -139,16 +131,11 @@
</div> </div>
</div> </div>
</Transition> </Transition>
<div class="connected-stake-first-round small-text text-center" v-if="cycleStore.currentCycle === 1"> <div class="connected-stake-first-round small-text text-center" v-if="cycleStore.currentCycle === 0">
No $BLOOD on the market. Staking is activated after the first cycle is finished. No $BLOOD on the market. Staking is activated after the first cycle is finished.
</div> </div>
<div <div class="connected-stake-first-round small-text text-center" v-else>
class="connected-stake-first-round small-text text-center" You can claim your stake next cycle
v-if="walletStore.orderedUnstakedAmount > 0n && !ableToUnstake"
>
You can claim
{{ formatNumber(walletStore.orderedUnstakedAmount, 10n ** tokenStore.memeToken.decimals) }}
$BLOOD next cycle.
</div> </div>
</slot> </slot>
<slot></slot> <slot></slot>
@@ -210,7 +197,6 @@ const loading = ref(false);
* state 4 staked * state 4 staked
*/ */
const state = ref(0); const state = ref(0);
const unstakeState = ref(0);
function openStake() { function openStake() {
stake.value = true; stake.value = true;
@@ -224,31 +210,6 @@ function openUnstake() {
stakeMenu.value = true; stakeMenu.value = true;
} }
async function unstake() {
try {
unstakeState.value = 1;
const hash = await rewardLockerStore.unstake();
unstakeState.value = 2;
const data = await waitForTransaction({
hash: hash,
});
var rewardData = data.logs.find((logObject) => {
return logObject.topics.find(
(topic) => topic === "0xb89343427f692590c388d6346a8e42ea497eb6682a04db1a53f77ea81771ca91"
);
});
console.log("rewardData", rewardData);
const outputClaim = formatNumber(BigInt(rewardData.topics[3]), 10n ** tokenStore.memeToken.decimals);
showSuccessToast(outputClaim, "Success!", "You just unstaked");
await walletStore.loadWalletData();
} catch (error) {
console.error("unstake", error);
} finally {
unstakeState.value = 0;
}
}
async function orderUnstake() { async function orderUnstake() {
try { try {
state.value = 2; state.value = 2;
@@ -260,18 +221,22 @@ async function orderUnstake() {
state.value = 4; state.value = 4;
var rewardData = data.logs.find((logObject) => { var rewardData = data.logs.find((logObject) => {
return logObject.topics.find( return logObject.topics.find(
(topic) => topic === "0xf86340d97020c624010a208b733db95795281fbc45cb6e6a40d161f91fa3e4a0" (topic) => topic === "0xd0813ff03c470dcc7baa9ce36914dc2febdfd276d639deffaac383fd3db42ba3"
); );
}); });
console.log("rewardData", rewardData); console.log("rewardData", rewardData);
const outputClaim = formatNumber(BigInt(rewardData.topics[3]), 10n ** tokenStore.memeToken.decimals); const outputClaim = Number(rewardData.topics[2]) / 10n ** tokenStore.memeToken.decimals;
showSuccessToast(outputClaim, "Success!", "You just unstaked", "You can claim your stake next cycle."); showSuccessToast(
stakeMenu.value = false; formatNumber(outputClaim),
"Success!",
"You just unstaked",
"You can claim your stake next cycle."
);
await walletStore.loadWalletData();
} catch (error) { } catch (error) {
console.error("orderUnstake", error); console.error("orderUnstake", error);
} finally { } finally {
await walletStore.loadWalletData();
state.value = 0; state.value = 0;
} }
} }
@@ -293,17 +258,17 @@ async function stakeToken() {
// //
console.log("rewardData", rewardData); console.log("rewardData", rewardData);
const outputClaim = formatNumber(BigInt(rewardData.topics[3]), 10n ** tokenStore.memeToken.decimals); const outputClaim = BigInt(rewardData.topics[3]) / 10n ** tokenStore.memeToken.decimals;
console.log("data", data); console.log("data", data);
state.value = 0; state.value = 0;
await walletStore.loadWalletData();
showSuccessToast( showSuccessToast(
outputClaim, formatNumber(outputClaim),
"Success!", "Success!",
"You just staked", "You just staked",
"Your next sacrifice will get an extra staking bonus as a reward." "Your next sacrifice will get an extra staking bonus as a reward."
); );
await walletStore.loadWalletData(); //reload data
stakeMenu.value = false;
} catch (error) { } catch (error) {
console.error(error); console.error(error);
throw new Error(error); throw new Error(error);
@@ -312,13 +277,12 @@ async function stakeToken() {
} }
} }
const ableToUnstake = computed(() => { const balanceOf = computed(() => {
var cycleList = walletStore.memeToken?.orderedUnstakedCycles?.findIndex((obj) => obj.result > 0n); if (!walletStore.memeToken?.balanceOf) {
console.log("cycleList", cycleList); return 0n;
if (cycleList && cycleList > -1 && cycleList + 1 <= cycleStore.currentCycle) { } else {
return true; return walletStore.memeToken?.balanceOf / 10n ** tokenStore.memeToken.decimals;
} }
return false;
}); });
const stateStake = computed(() => { const stateStake = computed(() => {
+4 -13
View File
@@ -14,13 +14,7 @@
<div class="stake-menu-actions"> <div class="stake-menu-actions">
<slot name="body"> <slot name="body">
<div class="input-balance">Balance: {{ walletStore.memeToken.balanceOf }}</div> <div class="input-balance">Balance: {{ walletStore.memeToken.balanceOf }}</div>
<div <div class="btn btn-immortal stake-button" @click="stakeBloodline" v-if="props.stake">Stake</div>
class="btn btn-immortal stake-button"
@click="rewardLockerStore.stakeBloodline(tokenNumber)"
v-if="props.stake"
>
Stake
</div>
<div class="btn btn-immortal stake-button" @click="unstakeBloodline" v-else>Unstake for Next Cycle</div> <div class="btn btn-immortal stake-button" @click="unstakeBloodline" v-else>Unstake for Next Cycle</div>
<div class="btn btn-immortal black" @click="emit('close')">Cancel</div> <div class="btn btn-immortal black" @click="emit('close')">Cancel</div>
</slot> </slot>
@@ -36,7 +30,6 @@ import { useWalletStoreV2 } from "@/stores/walletV2";
import { useRewardLockerStore } from "@/stores/rewardlocker"; import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useTokenStore } from "@/stores/tokens"; import { useTokenStore } from "@/stores/tokens";
import { createPermitObject, getSignatureRSV } from "@/helper/blockchain.js"; import { createPermitObject, getSignatureRSV } from "@/helper/blockchain.js";
import { formatNumber } from "@/helper/helper.js";
import { signTypedData } from "@wagmi/core"; import { signTypedData } from "@wagmi/core";
@@ -57,17 +50,15 @@ async function addTokensPercent(value) {
console.log("props.amount", props.amount); console.log("props.amount", props.amount);
let amount; let amount;
if (props.amount !== undefined || props.amount !== null) { if (props.amount !== undefined || props.amount !== null) {
//todo function to calculate correct bigInt value (maybe use string and split) console.log("props.amount", props.amount);
amount = (BigInt(props.amount) * value) / 100n; amount = (props.amount * value) / 100n;
} else if (props.stake) { } else if (props.stake) {
amount = (walletStore.memeToken.balanceOf * value) / 100n; amount = (walletStore.memeToken.balanceOf * value) / 100n;
} else { } else {
amount = (walletStore.memeToken.staked * value) / 100n; amount = (walletStore.memeToken.staked * value) / 100n;
} }
console.log("amount123", amount);
amount = amount / 10n ** tokenStore.memeToken.decimals;
console.log("amount", amount); console.log("amount", amount);
emit("update:modelValue", amount); emit("update:modelValue", Number(amount));
} }
async function unstakeBloodline() { async function unstakeBloodline() {
+24 -73
View File
@@ -23,38 +23,30 @@
<rewards-wrapper <rewards-wrapper
title="Sacrafice Reward" title="Sacrafice Reward"
coin="$BLOOD" coin="$BLOOD"
:amount="formatNumber(rewardsSacrifice, 10n ** tokenStore.memeToken.decimals)" :amount="formatNumber(rewardsSacrifice)"
image="/assets/img/vampir.png" image="/assets/img/vampir.png"
/> />
<rewards-wrapper <rewards-wrapper
title="Staking Bonus" title="Staking Bonus"
coin="$BLOOD" coin="$BLOOD"
:amount="formatNumber(rewardsStaking, 10n ** tokenStore.memeToken.decimals)" :amount="formatNumber(rewardsStaking)"
image="/assets/img/vampir.png" image="/assets/img/vampir.png"
/> />
<rewards-wrapper <rewards-wrapper
title="Clan Bonus" title="Clan Bonus"
:subTitle="rewardsClan > 0 ? clanBonusPercentage : null"
coin="$BLOOD" coin="$BLOOD"
:amount="formatNumber(rewardsClan, 10n ** tokenStore.memeToken.decimals)" :amount="formatNumber(rewardsClan)"
:image=" image="/assets/img/vampir.png"
activeCycle === currentCycle || !cycleStore.getCurrentCycleData?.winner.vamplogo
? '/assets/img/token/notoken.png'
: cycleStore.getCurrentCycleData?.winner.vamplogo
"
/> />
</div> </div>
<div class="rewards-total-wrapper"> <div class="rewards-total-wrapper">
<div class="rewards-total-headline sub-header">Total Reward</div> <div class="rewards-total-headline sub-header">Total Reward</div>
<div <div
class="rewards-total-inner bloodline-border bloodline-border--variant1" class="rewards-total-inner bloodline-border bloodline-border--variant1"
:class="{ purple: rewardsTotal > 0n && activeCycle !== currentCycle }" :class="{ purple: rewardsTotal > 0 && activeCycle !== currentCycle }"
> >
<token-name-price <token-name-price name="$BLOOD" :price="formatNumber(rewardsTotal)"></token-name-price>
name="$BLOOD" <token-logo img="/assets/img/vampir.png" :alt="'vampire'"></token-logo>
:price="formatNumber(rewardsTotal, 10n ** tokenStore.memeToken.decimals)"
></token-name-price>
<token-logo img="/assets/img/vampir.png" :size="64" :alt="'vampire'"></token-logo>
</div> </div>
</div> </div>
<div class="claim-button"> <div class="claim-button">
@@ -62,34 +54,17 @@
<button class="btn btn-immortal sub-header" @click="showPanel = true">Connect</button> <button class="btn btn-immortal sub-header" @click="showPanel = true">Connect</button>
</template> </template>
<template v-else-if="activeCycle === currentCycle"> <template v-else-if="activeCycle === currentCycle">
<template v-if="rewardsSacrifice > 0n"> <button class="btn btn-immortal sub-header" @click="router.push({ name: 'home' })">Sacrifice</button>
<div class="stake-buttons">
<button class="btn btn-immortal sub-header btn--disabled">Claim</button>
<button class="btn btn-immortal sub-header btn--disabled">Stake</button>
</div>
<div>You can claim once the current cycle is finished and the clan bonus calculated</div>
</template>
<template v-else>
<button class="btn btn-immortal sub-header" @click="router.push({ name: 'home' })">
Sacrifice
</button>
</template>
</template> </template>
<template v-else-if="rewardsTotal > 0"> <template v-else-if="rewardsTotal > 0">
<Transition name="smooth"> <Transition name="smooth">
<div class="stake-buttons" v-show="!stakeMenu"> <div class="stake-buttons" v-show="!stakeMenu">
<div class="btn btn-immortal sub-header" v-if="stateClaimedComp === 0" @click="claimRewards"> <div class="btn btn-immortal" v-if="stateClaimedComp === 0" @click="claimRewards">Claim</div>
Claim <div class="btn btn-immortal" disabled v-if="stateClaimedComp === 2">Sign Transaction</div>
</div> <div class="btn btn-immortal" disabled v-if="stateClaimedComp === 3">
<div class="btn btn-immortal sub-header" disabled v-if="stateClaimedComp === 2">
Sign Transaction
</div>
<div class="btn btn-immortal sub-header" disabled v-if="stateClaimedComp === 3">
<loading-component></loading-component> <loading-component></loading-component>
</div> </div>
<div class="btn btn-immortal sub-header" v-if="stateClaimedComp === 0" @click="openStake"> <div class="btn btn-immortal" @click="openStake">Stake</div>
Stake
</div>
</div> </div>
</Transition> </Transition>
<Transition name="smooth"> <Transition name="smooth">
@@ -101,32 +76,20 @@
v-if="stakeMenu" v-if="stakeMenu"
> >
<template v-slot:body> <template v-slot:body>
<div <div class="btn btn-immortal stake-button" disabled v-if="stateStakeClaimComp === 0">
class="btn btn-immortal sub-header stake-button"
disabled
v-if="stateStakeClaimComp === 0"
>
Enter Amount Enter Amount
</div> </div>
<div <div
class="btn btn-immortal sub-header stake-button" class="btn btn-immortal stake-button"
v-else-if="stateStakeClaimComp === 1" v-else-if="stateStakeClaimComp === 1"
@click="stakeAndClaim" @click="stakeAndClaim"
> >
Stake & Claim Rest Stake & Claim Rest
</div> </div>
<div <div class="btn btn-immortal stake-button" disabled v-if="stateStakeClaimComp === 2">
class="btn btn-immortal sub-header stake-button"
disabled
v-if="stateStakeClaimComp === 2"
>
Sign Transaction Sign Transaction
</div> </div>
<div <div class="btn btn-immortal stake-button" disabled v-if="stateStakeClaimComp === 3">
class="btn btn-immortal sub-header stake-button"
disabled
v-if="stateStakeClaimComp === 3"
>
<loading-component></loading-component> <loading-component></loading-component>
</div> </div>
<div <div
@@ -160,7 +123,7 @@ import { waitForTransaction } from "@wagmi/core";
import LoadingComponent from "@/components/LoadingComponent.vue"; import LoadingComponent from "@/components/LoadingComponent.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";
import { formatNumber, formatBigIntDivision } from "@/helper/helper.js"; import { formatNumber } from "@/helper/helper.js";
import { showSuccessToast } from "@/helper/toast.js"; import { showSuccessToast } from "@/helper/toast.js";
const showPanel = inject("showPanel"); const showPanel = inject("showPanel");
@@ -212,10 +175,10 @@ async function stakeAndClaim() {
// //
console.log("rewardData", rewardData); console.log("rewardData", rewardData);
console.log("stakeData", stakeData); console.log("stakeData", stakeData);
const outputClaim = BigInt(rewardData?.topics[2]); const outputClaim = BigInt(rewardData?.topics[2]) / 10n ** tokenStore.memeToken.decimals;
const outputStaked = BigInt(stakeData?.topics[3]); const outputStaked = BigInt(stakeData?.topics[3]) / 10n ** tokenStore.memeToken.decimals;
showSuccessToast( showSuccessToast(
formatNumber(outputClaim + outputStaked, 10n ** tokenStore.memeToken.decimals), formatNumber(outputClaim + outputStaked),
"Success!", "Success!",
"You just claimed and staked", "You just claimed and staked",
"Join the next cycle to increase your rewards and win with your clan." "Join the next cycle to increase your rewards and win with your clan."
@@ -263,9 +226,9 @@ async function claimRewards() {
// //
console.log("rewardData", rewardData); console.log("rewardData", rewardData);
const outputClaim = formatNumber(BigInt(rewardData.topics[2]), 10n ** tokenStore.memeToken.decimals); const outputClaim = BigInt(rewardData.topics[2]) / 10n ** tokenStore.memeToken.decimals;
showSuccessToast( showSuccessToast(
outputClaim, formatNumber(outputClaim),
"Success!", "Success!",
"You just claimed", "You just claimed",
"Join the next cycle to increase your rewards and win with your clan." "Join the next cycle to increase your rewards and win with your clan."
@@ -279,16 +242,6 @@ 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(() => { const stateClaimedComp = computed(() => {
let returnState = 0; let returnState = 0;
if (stateClaim.value === 2) { if (stateClaim.value === 2) {
@@ -312,7 +265,7 @@ const stateStakeClaimComp = computed(() => {
tokenNumber.value === null || tokenNumber.value === null ||
tokenNumber.value === "" || tokenNumber.value === "" ||
tokenNumber.value === 0 || tokenNumber.value === 0 ||
BigInt(tokenNumber.value) > walletStore.unclaimedRewards / 10n ** tokenStore.memeToken.decimals tokenNumber.value > walletStore.unclaimedRewards
) { ) {
returnState = 0; returnState = 0;
} }
@@ -332,9 +285,6 @@ const stateStakeClaimComp = computed(() => {
text-align: left text-align: left
.claim-button .claim-button
text-align: center text-align: center
display: flex
flex-direction: column
gap: 24px
.stake-buttons .stake-buttons
display: flex display: flex
text-align: center text-align: center
@@ -358,6 +308,7 @@ const stateStakeClaimComp = computed(() => {
justify-content: space-between justify-content: space-between
text-align: left text-align: left
box-sizing: content-box box-sizing: content-box
height: 56px
.rewards-left .rewards-left
display: flex display: flex
flex-direction: column flex-direction: column
+2 -3
View File
@@ -7,7 +7,6 @@
:value="props.modelValue" :value="props.modelValue"
:placeholder="0" :placeholder="0"
type="number" type="number"
pattern="\d*"
/> />
<div class="value-adder"> <div class="value-adder">
<slot class="value-adder" name="message"></slot> <slot class="value-adder" name="message"></slot>
@@ -15,7 +14,7 @@
</div> </div>
</div> </div>
<div class="right-side"> <div class="right-side">
<token-logo v-if="props.logo" :img="props.logo" :alt="'vampir'"></token-logo> <token-logo img="/assets/img/vampir.png" :alt="'vampir'"></token-logo>
</div> </div>
</div> </div>
</div> </div>
@@ -27,7 +26,7 @@ import TokenLogo from "@/components/TokenLogo.vue";
const props = defineProps({ const props = defineProps({
modelValue: [String, Number], modelValue: [String, Number],
logo: String, logo: String,
max: [BigInt, Number], max: Number,
}); });
const emit = defineEmits(["update:modelValue"]); const emit = defineEmits(["update:modelValue"]);
+2 -9
View File
@@ -1,9 +1,7 @@
<template> <template>
<div class="token-price-wrapper"> <div class="token-price-wrapper">
<div class="token-name tiny-text">{{ props.name }}</div> <div class="token-name small-text">{{ props.name }}</div>
<div class="token-price" :class="{ 'sub-header-2': !props.variant, 'sub-header': props.variant }"> <div class="token-price sub-header">{{ props.price }}</div>
{{ props.price }}
</div>
</div> </div>
</template> </template>
@@ -11,11 +9,6 @@
const props = defineProps({ const props = defineProps({
name: String, name: String,
price: [Number, String], price: [Number, String],
variant: {
type: Boolean,
required: false,
default: false,
},
}); });
</script> </script>
+48 -1
View File
@@ -1,6 +1,18 @@
<template> <template>
<div class="approve-card"> <div class="approve-card">
<div class="left-side low-mid-text">Transaction Successful</div> <div class="left-side low-mid-text">
Transaction<br />
Successful
</div>
<div class="right-side">
<div class="btn btn-immortal tiny-text" v-if="stateComputed === 1" @click="sacrificeClick">
Sacrifice 🩸
</div>
<div class="btn btn-immortal tiny-text" disabled v-if="stateComputed === 2">Sign Transaction</div>
<div class="btn btn-immortal tiny-text" disabled v-if="stateComputed === 3">
<loading-component></loading-component>
</div>
</div>
</div> </div>
</template> </template>
<script setup> <script setup>
@@ -32,6 +44,41 @@ const splashBlood = inject("splashBlood");
function closeToast() { function closeToast() {
toast.dismiss(id); toast.dismiss(id);
} }
const stateComputed = computed(() => {
let returnState = 0;
if (
sacrificeStore.sacrificeNumber === null ||
sacrificeStore.sacrificeNumber === "" ||
sacrificeStore.sacrificeNumber === 0
) {
returnState = 0;
} else if (sacrificeStore.sacrificeState === 2) {
returnState = 2;
} else if (sacrificeStore.sacrificeState === 3) {
returnState = 3;
} else if (
sacrificeStore.sacrificeNumber !== null ||
sacrificeStore.sacrificeNumber !== "" ||
sacrificeStore.sacrificeNumber > 0
) {
returnState = 1;
}
return returnState;
});
async function sacrificeClick() {
try {
var result = await sacrificeStore.sacrificeToken(sacrificeStore.sacrificeNumber, tokenStore.activeToken);
if (result) {
emit("sacrificed");
}
} catch (error) {
console.error("error", error);
} finally {
closeToast();
}
}
</script> </script>
<style lang="sass"> <style lang="sass">
.Vue-Toastification__container .Vue-Toastification__container
+1 -1
View File
@@ -10,7 +10,7 @@
</div> </div>
<div class="amount-number"> <div class="amount-number">
<div class="token-amount number-mobile">{{ props.value }}</div> <div class="token-amount number-mobile">{{ props.value }}</div>
<div class="token-name">$BLOOD</div> <div class="token-name">$Blood</div>
</div> </div>
<div class="info toast-body"> <div class="info toast-body">
{{ props.info }} {{ props.info }}
@@ -1,86 +0,0 @@
<template>
<div class="network-switch-card">
<div>Please switch Network to</div>
<div>
<b>{{ props.network.chains[0].name }}</b>
</div>
</div>
</template>
<script setup>
import LoadingComponent from "@/components/LoadingComponent.vue";
import { getCurrentInstance, computed, watch, inject } from "vue";
import { useTokenStore } from "@/stores/tokens";
import { useSacrificeStore } from "@/stores/sacrifice";
import CardComponent from "@/components/CardComponent.vue";
import { useToast } from "vue-toastification";
const emit = defineEmits(["sacrificed"]);
const props = defineProps({
network: Object,
});
const toast = useToast();
const tokenStore = useTokenStore();
const sacrificeStore = useSacrificeStore();
const instance = getCurrentInstance();
const id = instance.attrs["toast-id"];
const splashBlood = inject("splashBlood");
function closeToast() {
toast.dismiss(id);
}
const stateComputed = computed(() => {
let returnState = 0;
if (
sacrificeStore.sacrificeNumber === null ||
sacrificeStore.sacrificeNumber === "" ||
sacrificeStore.sacrificeNumber === 0
) {
returnState = 0;
} else if (sacrificeStore.sacrificeState === 2) {
returnState = 2;
} else if (sacrificeStore.sacrificeState === 3) {
returnState = 3;
} else if (
sacrificeStore.sacrificeNumber !== null ||
sacrificeStore.sacrificeNumber !== "" ||
sacrificeStore.sacrificeNumber > 0
) {
returnState = 1;
}
return returnState;
});
async function sacrificeClick() {
try {
var result = await sacrificeStore.sacrificeToken(sacrificeStore.sacrificeNumber, tokenStore.activeToken);
if (result) {
emit("sacrificed");
}
} catch (error) {
console.error("error", error);
} finally {
closeToast();
}
}
</script>
<style lang="sass">
.Vue-Toastification__container
.Vue-Toastification__toast--default
&.approve-toast
background: transparent
&.toast-card
padding: 24px 16px
border-radius: 10px
border: 2px solid var(--dark-purple, #4B0082)
background: var(--midnight-black, #0F0F0F)
.Vue-Toastification__toast-component-body
.network-switch-card
display: flex
flex-direction: column
display: flex
</style>
+30 -25
View File
@@ -1,45 +1,43 @@
export function getImageUrl(url) {
return new URL(url, import.meta.url).href;
}
export function getPercentage(amount, goal) { export function getPercentage(amount, goal) {
return ((Number(amount) / Number(goal)) * 100).toFixed(2); return ((Number(amount) / Number(goal)) * 100).toFixed(2);
} }
export function compactNumber(number) { export function compactNumber(number) {
return Intl.NumberFormat("en-US", { return Intl.NumberFormat("en-US", {
notation: "compact", notation: "compact",
maximumFractionDigits: 2, maximumFractionDigits: 2,
}).format(number); }).format(parseInt(number));
} }
export function formatNumber(nominator, denominator) { export function formatNumber(number) {
let number = formatBigIntDivision(nominator, denominator); const options = {
number = InsertCommaNumber(number).toString(); style: "decimal",
minimumFractionDigits: 0,
return number; 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) { if (!number) {
return 0 return 0
} }
const formattedWithOptions = number.toLocaleString("en-US"); const formattedWithOptions = number.toLocaleString("en-US", options);
return formattedWithOptions; return formattedWithOptions;
} }
// input type bigint
export function formatBigIntDivision(nominator, denominator) {
const integer = (nominator / denominator).toString();
// pick how much digits after point to show
const fraction = (nominator % denominator).toString().substring(0,10);
// output type string
return integer + '.' + fraction;
}
export function getAddressShortName(address) { export function getAddressShortName(address) {
// const address = "0x66422602B2f4885c57EE794174f98d9E4DDBBBC6"; // const address = "0x66422602B2f4885c57EE794174f98d9E4DDBBBC6";
const addressBegin = address.substring(0, 6); const addressBegin = address.substring(0, 6);
@@ -48,6 +46,13 @@ export function getAddressShortName(address) {
} }
export function numberWithCommas(x, ) {
x = x.toString();
var pattern = /(-?\d+)(\d{3})/;
while (pattern.test(x)) x = x.replace(pattern, "$1,$2");
return x;
}
export function getblocky(address) { export function getblocky(address) {
var blockiesData = blockies var blockiesData = blockies
.create({ .create({
+11 -57
View File
@@ -38,15 +38,13 @@ import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
/* import specific icons */ /* import specific 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 { faArrowDown, faArrowRight, faSpinner, faPlus, faCaretLeft, faCaretRight, faBars, faAnglesRight, faChevronDown, faChevronUp, faArrowRightToBracket, faArrowRightFromBracket, faDroplet, faMoon, faPerson, faWallet } from "@fortawesome/free-solid-svg-icons";
import { faDiscord, faTwitter, faTelegram } from "@fortawesome/free-brands-svg-icons"; import { faDiscord, faTwitter, faTelegram } from "@fortawesome/free-brands-svg-icons";
import Toast from "vue-toastification"; import Toast from "vue-toastification";
// Import the CSS or use your own! // Import the CSS or use your own!
import "vue-toastification/dist/index.css"; import "vue-toastification/dist/index.css";
import SwitchNetworkToast from "@/components/toasts/SwitchNetworkToast.vue";
import { useToast } from "vue-toastification";
/* add icons to the library */ /* add icons to the library */
library.add( library.add(
@@ -65,11 +63,10 @@ library.add(
faArrowRightFromBracket, faArrowRightFromBracket,
faChevronDown, faChevronDown,
faChevronUp, faChevronUp,
faDroplet, faDroplet,
faMoon, faMoon,
faPerson, faPerson,
faWallet, faWallet
faBlog
); );
var logging = localStorage.getItem("LOGGING"); var logging = localStorage.getItem("LOGGING");
@@ -98,35 +95,6 @@ app.use(Toast, {
}); });
function showSwitchNetworkToast(network) {
const toast = useToast();
// Define the content object with the component, props and listeners
const content = {
component: SwitchNetworkToast,
// Any prop can be passed, but don't expect them to be reactive
props: {
network
},
// 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
return toast(content, {
position: "top-right",
icon: false,
closeOnClick: false,
// toastClassName: "modal-overlay",
hideProgressBar: true,
timeout: false,
toastClassName: "approve-toast toast-card",
});
}
try { try {
const walletStore = useWalletStoreV2(); const walletStore = useWalletStoreV2();
const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
@@ -139,8 +107,7 @@ try {
const projectId = "d8e5ecb0353c02e21d4c0867d4473ac5"; const projectId = "d8e5ecb0353c02e21d4c0867d4473ac5";
console.log("hier chains"); console.log("hier chains");
const { chains, publicClient, webSocketPublicClient } = configureChains( const { chains, publicClient, webSocketPublicClient } = configureChains(
// [goerli, mainnet], [goerli, mainnet],
[goerli],
[alchemyProvider({ apiKey: goerliKey }), publicProvider()] [alchemyProvider({ apiKey: goerliKey }), publicProvider()]
); );
@@ -153,7 +120,7 @@ try {
appName: "wagmi demo", appName: "wagmi demo",
}, },
}), }),
// new MetaMaskConnector({ chains }), new MetaMaskConnector({ chains }),
new InjectedConnector({ new InjectedConnector({
chains, chains,
getProvider: () => (typeof window !== "undefined" ? window.myInjectedWallet : undefined), getProvider: () => (typeof window !== "undefined" ? window.myInjectedWallet : undefined),
@@ -227,7 +194,8 @@ try {
await tokenStore.initV2(); await tokenStore.initV2();
await rewardLockerStore.init(); await rewardLockerStore.init();
await walletStore.loadWalletData(); await walletStore.loadWalletData();
await cycleStore.fillCycle(cycleStore.currentCycle, true); // console.log("cycleStore.currentCycle", cycleStore.currentCycle);
// await cycleStore.fillCycle(cycleStore.currentCycle);
await uniswapStore.init(); await uniswapStore.init();
} else { } else {
walletStore.address = null; walletStore.address = null;
@@ -236,25 +204,11 @@ try {
} }
}); });
watchNetwork((network) => { watchNetwork((network) => {
if (!network.chain?.network) {
return;
}
const chainAllowed = network.chains?.find((obj) => {
return obj.network === network.chain.network;
});
if (!chainAllowed) {
console.log("chain not allowed", network.chain);
showSwitchNetworkToast(network);
return
} else {
console.log("chain allowed", network.chain);
}
if (network.chain) { if (network.chain) {
walletStore.chain = network.chain; walletStore.chain = network.chain;
} }
}); });
await walletStore.init(); await walletStore.init();
+13 -19
View File
@@ -35,37 +35,28 @@ export const useCycleStore = defineStore("cycles", {
if (!this.cycles[this.activeCycle]?.rewards_sacrifice) { if (!this.cycles[this.activeCycle]?.rewards_sacrifice) {
return 0n; return 0n;
} }
return this.cycles[this.activeCycle]?.rewards_sacrifice; return this.cycles[this.activeCycle]?.rewards_sacrifice / 10n ** tokenStore.memeToken.decimals;
},
rewardsSacrificeCurrentCycle() {
const tokenStore = useTokenStore();
if (!this.cycles[this.currentCycle]?.rewards_sacrifice) {
return 0n;
}
return this.cycles[this.currentCycle]?.rewards_sacrifice;
}, },
rewardsStaking() { rewardsStaking() {
const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
if (!this.cycles[this.activeCycle]?.rewards_staking) { if (!this.cycles[this.activeCycle]?.rewards_staking) {
return 0n; return 0n;
} }
return this.cycles[this.activeCycle]?.rewards_staking; return this.cycles[this.activeCycle]?.rewards_staking / 10n ** tokenStore.memeToken.decimals;
}, },
rewardsClan() { rewardsClan() {
const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
if (!this.cycles[this.activeCycle]?.rewards_clan) { if (!this.cycles[this.activeCycle]?.rewards_clan) {
return 0n; return 0n;
} }
return this.cycles[this.activeCycle]?.rewards_clan; return this.cycles[this.activeCycle]?.rewards_clan / 10n ** tokenStore.memeToken.decimals;
}, },
rewardsTotal() { rewardsTotal() {
const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
if (!this.cycles[this.activeCycle]?.rewards_total) { if (!this.cycles[this.activeCycle]?.rewards_total) {
return 0n; return 0n;
} }
return this.cycles[this.activeCycle]?.rewards_total; return this.cycles[this.activeCycle]?.rewards_total / 10n ** tokenStore.memeToken.decimals;
}, },
}, },
actions: { actions: {
@@ -101,6 +92,7 @@ export const useCycleStore = defineStore("cycles", {
console.log("updateCurrentCycle"); console.log("updateCurrentCycle");
const memeBurnerStore = useMemeburnerStore(); const memeBurnerStore = useMemeburnerStore();
const rewardLockerStore = useRewardLockerStore(); const rewardLockerStore = useRewardLockerStore();
// TODO: Could be combined in one multicall and could be simplified to request data only for sacrificedToken
var data = await memeBurnerStore.getSacrificedCycle(this.currentCycle); var data = await memeBurnerStore.getSacrificedCycle(this.currentCycle);
var tokenTotalSacrificed = await rewardLockerStore.getTotalSacrificeRewardsForAllToken(this.currentCycle); var tokenTotalSacrificed = await rewardLockerStore.getTotalSacrificeRewardsForAllToken(this.currentCycle);
console.log("this.currentCycle", this.currentCycle); console.log("this.currentCycle", this.currentCycle);
@@ -110,6 +102,7 @@ export const useCycleStore = defineStore("cycles", {
(tokenData) => tokenData.contractAddress === sacrificedToken (tokenData) => tokenData.contractAddress === sacrificedToken
); );
this.cycles[this.currentCycle].token[tokenIndex].amount = data[tokenIndex].result[1]; this.cycles[this.currentCycle].token[tokenIndex].amount = data[tokenIndex].result[1];
// was missed update totalSacrificeRewards for sacrificedToken
this.cycles[this.currentCycle].token[tokenIndex].amountInBLD = tokenTotalSacrificed[tokenIndex].result; this.cycles[this.currentCycle].token[tokenIndex].amountInBLD = tokenTotalSacrificed[tokenIndex].result;
} }
}, },
@@ -170,7 +163,8 @@ export const useCycleStore = defineStore("cycles", {
const sacrificeClanReward = rewardData[index].result[1]; const sacrificeClanReward = rewardData[index].result[1];
let clanwin = 0n; let clanwin = 0n;
if (cycleNumber !== this.currentCycle) { if (cycleNumber !== this.currentCycle) {
clanwin = (sacrificeClanReward * coefficent) / 10000n - sacrificeClanReward; // previous version would not work due to missing remainder
clanwin = (sacrificeClanReward * coefficent / 10000n) - sacrificeClanReward;
console.log("clanwin", clanwin); console.log("clanwin", clanwin);
} }
const sacrificeRewards = sacrificeClanReward; const sacrificeRewards = sacrificeClanReward;
@@ -196,9 +190,9 @@ export const useCycleStore = defineStore("cycles", {
const winner = tokenArray.find((token) => token.amount === goalDecimal); const winner = tokenArray.find((token) => token.amount === goalDecimal);
const goalInBLD = await memeBurnerStore.getGoalInBLOOD(cycleNumber); const goalInBLD = await memeBurnerStore.getGoalInBLOOD(cycleNumber);
//replace vamplogo cause it will automatically change the token for the cycle view (new design) //replace vamplogo cause it will automatically change the token for the cycle view (new design)
// if (winner) { if (winner) {
// winner.vamplogo = winner.vampwinner; winner.vamplogo = winner.vampwinner;
// } }
this.cycles[cycleNumber] = { this.cycles[cycleNumber] = {
goal: goal[0], goal: goal[0],
goalInBLD: goalInBLD, goalInBLD: goalInBLD,
@@ -220,10 +214,10 @@ export const useCycleStore = defineStore("cycles", {
const array = []; const array = [];
const rewardLockerStore = useRewardLockerStore(); const rewardLockerStore = useRewardLockerStore();
const lastCompletedCycle = await rewardLockerStore.lastCompletedCycle(); const lastCompletedCycle = await rewardLockerStore.lastCompletedCycle();
for (let index = 1; index <= Number(lastCompletedCycle); index++) { // Question: cycle 0 doesn't exist, does it make sense to start from index 1?
for (let index = 0; index <= Number(lastCompletedCycle); index++) {
array.push(index); array.push(index);
} }
console.log("array123", array);
return array; return array;
}, },
}, },
+3 -2
View File
@@ -97,10 +97,11 @@ export const useMemeburnerStore = defineStore("memeburner", {
async sacrificeMemeAndBuyBLOOD(amount, minBLOOD) { async sacrificeMemeAndBuyBLOOD(amount, minBLOOD) {
const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
const amountDecimal = BigInt(amount) * 10n ** BigInt(tokenStore.activeToken.decimals);
var hash = await this.contract.write.sacrificeMemeAndBuyBLOOD([ var hash = await this.contract.write.sacrificeMemeAndBuyBLOOD([
tokenStore.activeToken.contractAddress, tokenStore.activeToken.contractAddress,
amount, amountDecimal.toString(),
minBLOOD, minBLOOD.toString()
]); ]);
return hash; return hash;
}, },
+16 -34
View File
@@ -32,6 +32,7 @@ export const useRewardLockerStore = defineStore("rewardlocker", {
*/ */
async getRewards(walletAddress, cycleNumber, tokenAddress) { async getRewards(walletAddress, cycleNumber, tokenAddress) {
try { try {
// rewards function doesn't exist, getRewards instead
return await this.contract.read.getRewards([walletAddress, cycleNumber, tokenAddress]); return await this.contract.read.getRewards([walletAddress, cycleNumber, tokenAddress]);
} catch (error) { } catch (error) {
console.error("getRewards", error); console.error("getRewards", error);
@@ -50,9 +51,9 @@ export const useRewardLockerStore = defineStore("rewardlocker", {
functionName: "getRewards", functionName: "getRewards",
args: [walletStore.address, cycleNumber, token.contractAddress], args: [walletStore.address, cycleNumber, token.contractAddress],
}); });
} }
const data = await multicall({ const data = await multicall({
contracts, contracts,
}); });
return data; return data;
}, },
@@ -80,15 +81,16 @@ export const useRewardLockerStore = defineStore("rewardlocker", {
async getSacrificedTokenCoefficient(cycleNumber, sacrificedToken) { async getSacrificedTokenCoefficient(cycleNumber, sacrificedToken) {
return await this.contract.read.getSacrificedTokenCoefficient([cycleNumber, sacrificedToken]); return await this.contract.read.getSacrificedTokenCoefficient([cycleNumber, sacrificedToken]);
}, },
async getStakeRewardForSacrificeReward(sacrificedToken, reward) { async getStakeRewardForSacrificeReward(sacrificedToken, reward) {
const walletStore = useWalletStoreV2(); const walletStore = useWalletStoreV2();
const cycleStore = useCycleStore(); const cycleStore = useCycleStore();
return await this.contract.read.getStakeRewardForSacrificeReward([ return await this.contract.read.getStakeRewardForSacrificeReward([
walletStore.address, walletStore.address,
sacrificedToken, sacrificedToken,
reward, reward,
]); ]);
},
},
async lastCompletedCycle() { async lastCompletedCycle() {
return await this.contract.read.lastCompletedCycle(); return await this.contract.read.lastCompletedCycle();
}, },
@@ -116,18 +118,15 @@ export const useRewardLockerStore = defineStore("rewardlocker", {
async getStaked(address) { async getStaked(address) {
return await this.contract.read.staked([address]); return await this.contract.read.staked([address]);
}, },
async getUnstakeOrdered(address, cycleNumber) {
// returns unstake amount of BDL ordered and ready to be unstaked in a cycleNumber
return await this.contract.read.unstakeOrdered([cycleNumber,address]);
},
async orderUnstake() { async orderUnstake() {
return await this.contract.write.orderUnstake(); return await this.contract.write.orderUnstake();
}, },
async unstake() { async unstake(unstakeCycle) {
const walletStore = useWalletStoreV2(); return await this.contract.write.unstake([unstakeCycle]);
const cycleStore = useCycleStore();
var cycleList = walletStore.memeToken.orderedUnstakedCycles.findIndex((obj) => obj.result > 0n);
if (cycleList && cycleList + 1 <= cycleStore.currentCycle) {
console.log("cycleList", cycleList);
const hash = await this.contract.write.unstake([cycleList + 1]);
return hash;
}
}, },
async stakeBloodline(tokenNumber) { async stakeBloodline(tokenNumber) {
console.log("tokenNumber", tokenNumber); console.log("tokenNumber", tokenNumber);
@@ -136,6 +135,7 @@ export const useRewardLockerStore = defineStore("rewardlocker", {
const fromAddress = walletStore.address; const fromAddress = walletStore.address;
const spender = this.config.contractAddress; const spender = this.config.contractAddress;
// timestamp is denominated in seconds
const deadline = BigInt(Date.now()) / 1000n + 1200n; const deadline = BigInt(Date.now()) / 1000n + 1200n;
const decimals = tokenStore.getToken(walletStore.memeToken.contractAddress).decimals; const decimals = tokenStore.getToken(walletStore.memeToken.contractAddress).decimals;
const value = BigInt(tokenNumber) * 10n ** decimals; const value = BigInt(tokenNumber) * 10n ** decimals;
@@ -177,23 +177,5 @@ export const useRewardLockerStore = defineStore("rewardlocker", {
const hash = await this.contract.write.stakeAndClaim([stakeCoefficient, cycles, addresses]); const hash = await this.contract.write.stakeAndClaim([stakeCoefficient, cycles, addresses]);
return hash; return hash;
}, },
async unstakeOrdered() {
const cycleStore = useCycleStore();
const walletStore = useWalletStoreV2();
const contracts = [];
for (let index = 1; index < cycleStore.currentCycle + 2; index++) {
contracts.push({
...this.contract,
functionName: "unstakeOrdered",
args: [index, walletStore.address],
});
}
const data = await multicall({
contracts,
});
console.log("data123", data);
return data;
},
}, },
}); });
+60 -65
View File
@@ -9,7 +9,7 @@ import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useTokenStore } from "@/stores/tokens"; import { useTokenStore } from "@/stores/tokens";
import { waitForTransaction, readContract, watchBlockNumber, multicall } from "@wagmi/core"; import { waitForTransaction, readContract, watchBlockNumber, multicall } from "@wagmi/core";
import { showSuccessToast } from "@/helper/toast.js"; import { showSuccessToast } from "@/helper/toast.js";
import { formatNumber } from "@/helper/helper.js"; import { formatNumber, formatBigIntDivision } from "@/helper/helper.js";
export const useSacrificeStore = defineStore("sacrifice", { export const useSacrificeStore = defineStore("sacrifice", {
state: () => ({ state: () => ({
@@ -19,17 +19,20 @@ export const useSacrificeStore = defineStore("sacrifice", {
getters: {}, getters: {},
actions: { actions: {
async sacrificeToken(amount, token) { async sacrificeToken(amount, token) {
console.log("sacrificeToken", { amount, token }); console.log("sacrificeToken", { amount, token });
const memeburnerStore = useMemeburnerStore(); const memeburnerStore = useMemeburnerStore();
const walletStore = useWalletStoreV2(); const walletStore = useWalletStoreV2();
const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
const cycleStore = useCycleStore(); const cycleStore = useCycleStore();
try { try {
this.sacrificeState = 2; this.sacrificeState = 2;
const getRewards = await this.getRewardsFor(amount, token); console.log("hier");
console.log("getRewards", getRewards); const getRewards = await this.getRewardsFor(amount, token);
console.log("hier1");
console.log("getRewards", getRewards);
let hash = null; let hash = null;
if (getRewards.variant === "sacrifice") { if (getRewards.variant === "sacrifice") {
console.log("sacrifice"); console.log("sacrifice");
@@ -52,74 +55,72 @@ export const useSacrificeStore = defineStore("sacrifice", {
// return logObject.topics.find( // return logObject.topics.find(
// (topic) => topic === "0x5e60ccd3c81486143d815dce24867a494d7fee585a0a44282cf479b19a5186ee" // (topic) => topic === "0x5e60ccd3c81486143d815dce24867a494d7fee585a0a44282cf479b19a5186ee"
// ); // );
// }); // });
var rewardData = data.logs.filter((logObject) => { var rewardData = data.logs.filter((logObject) => {
return logObject.topics.find( return logObject.topics.find(
(topic) => topic === "0x5e60ccd3c81486143d815dce24867a494d7fee585a0a44282cf479b19a5186ee" (topic) => topic === "0x5e60ccd3c81486143d815dce24867a494d7fee585a0a44282cf479b19a5186ee"
); );
}); });
console.log("rewardData", rewardData); console.log("rewardData", rewardData);
//output //output
let outputSacrifice = rewardData.reduce((x, y) => { let outputSacrifice = rewardData.reduce((x, y) => {
return x + BigInt(y.data); return x + BigInt(y.data);
}, 0n); }, 0n);
outputSacrifice = formatNumber(outputSacrifice, 10n ** token.decimals); outputSacrifice = formatBigIntDivision(outputSacrifice, 10n ** token.decimals);
console.log("outputSacrifice", outputSacrifice);
console.log("outputSacrifice", outputSacrifice);
token.allowance = await tokenStore.allowance(); token.allowance = await tokenStore.allowance();
this.sacrificeState = 4; this.sacrificeState = 4;
showSuccessToast( showSuccessToast(
outputSacrifice, outputSacrifice,
"Success!", "Success!",
"You turned your meme into:", "You turned your meme into:",
"You can claim once the current cycle is finished and your clan bonus was calculated." "You can claim once the current cycle is finished and your clan bonus was calculated."
); );
await walletStore.loadWalletData(); await walletStore.loadWalletData();
console.log("cycleStore.currentCycle", cycleStore.currentCycle); console.log("cycleStore.currentCycle", cycleStore.currentCycle);
await cycleStore.fillCycle(cycleStore.currentCycle, true); await cycleStore.fillCycle(cycleStore.currentCycle, true);
return true; return true;
} catch (error) { } catch (error) {
//we should show the user an issue //we should show the user an issue
throw new Error(error); throw new Error(error);
} finally { } finally {
this.sacrificeState = 0; this.sacrificeState = 0;
} }
}, },
async getRewardsFor(amount, token) { async getRewardsFor(amount, token) {
console.log("getRewardsFor", { amount, token }); console.log("getRewardsFor", {amount, token});
const memeburnerStore = useMemeburnerStore(); const memeburnerStore = useMemeburnerStore();
const uniswapStore = useUniswapStore(); const uniswapStore = useUniswapStore();
const walletStore = useWalletStoreV2(); const walletStore = useWalletStoreV2();
const rewardLockerStore = useRewardLockerStore(); const rewardLockerStore = useRewardLockerStore();
let output = 0n; let output = 0;
let minBLOOD; let minBLOOD;
try { try {
if (!amount) { if (!amount) {
this.sacrificeState = 0; this.sacrificeState = 0;
return { return output;
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 // take 99.5% of amount ETH got for selling meme, 0.5% allowed slippage
const minETH = (amountETHBase[1] * 995n) / 1000n; const minETH = (amountETHBase[1] * 995n) / 1000n;
const rewardsForResult = await memeburnerStore.getRewardFor(amount); const rewardsForResult = await memeburnerStore.getRewardFor(amount);
const rewardsForResultSum = rewardsForResult[0] + rewardsForResult[1]; const rewardsForResultSum = rewardsForResult[0] + rewardsForResult[1];
// quote blood amount against ETH base amount // quote blood amount against ETH base amount
var quoteRewards = await uniswapStore.quoteExactInputSingle(amountETHBase[0]); var quoteRewards = await uniswapStore.quoteExactInputSingle(amount, amountETHBase[0]);
let variant = "sacrifice"; let variant = "sacrifice";
// here you are setting only variant, let's show by default rewardsForResultSum
output = rewardsForResultSum;
if (quoteRewards.result) { if (quoteRewards.result) {
// take 99.5% of quoted amount, 0.5% allowed slippage // 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"; variant = "buy";
console.log("use Buy-function", { console.log("use Buy-function", {
quoteRewardsNumber: quoteRewards.amount, quoteRewardsNumber: quoteRewards.amount,
@@ -131,6 +132,13 @@ export const useSacrificeStore = defineStore("sacrifice", {
rewardsForResultSum, rewardsForResultSum,
}); });
} }
} else {
/**
* case 4
* quoter threw an error
*/
//
output = rewardsForResultSum;
} }
console.log("variant", variant); console.log("variant", variant);
console.log("amount", amount); console.log("amount", amount);
@@ -142,23 +150,15 @@ export const useSacrificeStore = defineStore("sacrifice", {
*/ */
output = rewardsForResultSum; output = rewardsForResultSum;
if (variant === "buy") { if (variant === "buy") {
output = quoteRewards.amount; output = quoteRewards.amount
} }
} else if (walletStore.connected && variant === "sacrifice" && token.allowance >= amount) { } else if (walletStore.connected && variant === "sacrifice") {
/** /**
* case 2 * case 2
* user is logged in and allowance is greater or equal input and variant is sacrifice * user is logged in and allowance is greater or equal input and variant is sacrifice
*/ */
// in this case you should use eth_call, so you are showing exact reward in cases of completing cycles output = rewardsForResultSum;
const amountSacrifice = await readContract({ } else if (walletStore.connected && variant === "buy") {
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 * case 3
* user is logged in and allowance is greater or equal input and variant is buy * user is logged in and allowance is greater or equal input and variant is buy
@@ -180,7 +180,7 @@ export const useSacrificeStore = defineStore("sacrifice", {
account: walletStore.address, account: walletStore.address,
}); });
if ((amountBuy * 95n) / 100n > amountSacrifice) { if (amountBuy * 95n / 100n > amountSacrifice) {
variant = "buy"; variant = "buy";
output = amountBuy; output = amountBuy;
console.log("use buy after comparison sacrificeMemeAndBuyBLOOD and sacrificeMeme"); console.log("use buy after comparison sacrificeMemeAndBuyBLOOD and sacrificeMeme");
@@ -189,25 +189,20 @@ export const useSacrificeStore = defineStore("sacrifice", {
output = amountSacrifice; output = amountSacrifice;
console.log("use sacrifice after comparison sacrificeMemeAndBuyBLOOD and sacrificeMeme"); console.log("use sacrifice after comparison sacrificeMemeAndBuyBLOOD and sacrificeMeme");
} }
} }
//potential staking rewards //potential staking rewards
let stakingRewardsNumber = 0; let stakingRewardsNumber = 0;
if (output > 0 && walletStore.connected) { if (output > 0 && walletStore.connected) {
const stakingReward = await rewardLockerStore.getStakeRewardForSacrificeReward( const stakingReward = await rewardLockerStore.getStakeRewardForSacrificeReward(
token.contractAddress, token.contractAddress,
output output
); );
stakingRewardsNumber = stakingReward; stakingRewardsNumber = stakingReward / 10n ** token.decimals
} }
return { const outputNumber = output / 10n ** BigInt(token.decimals);
output: output, return { output: outputNumber, variant: variant, minETH: minETH, minBLOOD: minBLOOD, staking: stakingRewardsNumber };
variant: variant,
minETH: minETH,
minBLOOD: minBLOOD,
staking: stakingRewardsNumber,
};
} catch (error) { } catch (error) {
console.error("getRewardsFor", error); console.error("getRewardsFor", error);
} }
}, },
}, },
+5 -5
View File
@@ -58,16 +58,16 @@ export const useTokenStore = defineStore("token", {
addSteps: [ addSteps: [
{ {
amount: 1000000000000000000000000n, amount: 1000000000000000000000000n,
name: "1m",
},
{
amount: 10000000000000000000000000n,
name: "10m", name: "10m",
}, },
{ {
amount: 100000000000000000000000000n, amount: 10000000000000000000000000n,
name: "100m", name: "100m",
}, },
{
amount: 100000000000000000000000000n,
name: "1b",
},
], ],
}, },
{ {
+59 -15
View File
@@ -1,17 +1,23 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { useWalletStoreV2 } from "@/stores/walletV2"; import { useWalletStoreV2 } from "@/stores/walletV2";
import QuoterJson from "@/assets/contracts/Quoter.json"; import QuoterJson from "@/assets/contracts/Quoter.json";
import WethJson from "@/assets/contracts/WETH.json"; import UniswapPoolJson from "@/assets/contracts/UniswapPool.json";
import BloodlineJson from "@/assets/contracts/Bloodline.json"; import BloodlineJson from "@/assets/contracts/Bloodline.json";
import { useMemeburnerStore } from "@/stores/memeburner";
import { useTokenStore } from "@/stores/tokens";
import { getContract, multicall } from "@wagmi/core"; import { getContract, multicall } from "@wagmi/core";
export const useUniswapStore = defineStore("uniswap", { export const useUniswapStore = defineStore("uniswap", {
state: () => ({ state: () => ({
quoateV3Contract: {}, quoateV3Contract: {},
tokenIn: WethJson.contractAddress, quoateV2Contract: {},
tokenOut: BloodlineJson.contractAddress, uniswapPoolContract: {},
fee: 10000n, poolData: {
token0: null,
token1: null,
fee: null,
},
}), }),
getters: {}, getters: {},
actions: { actions: {
@@ -25,25 +31,38 @@ export const useUniswapStore = defineStore("uniswap", {
walletClient: walletStore.walletClient || walletStore.publicClient, walletClient: walletStore.walletClient || walletStore.publicClient,
}); });
this.uniswapPoolContract = getContract({
address: UniswapPoolJson.contractAddress,
abi: UniswapPoolJson.abi,
walletClient: walletStore.walletClient || walletStore.publicClient,
});
this.getPoolData();
}, },
async quoteExactInputSingle(ethBase) { async quoteExactInputSingle(amount, ethBase) {
try { try {
console.log("quoteExactInputSingle"); console.log("quoteExactInputSingle");
const memeBurnerStore = useMemeburnerStore();
const tokenStore = useTokenStore();
const tokenOut = tokenStore.memeToken.contractAddress;
// tokenIn - WETH
const tokenIn = BigInt(this.poolData.token0) == BigInt(tokenOut) ? this.poolData.token1 : this.poolData.token0;
console.log("quoteExactInputSingle-parameter", { console.log("quoteExactInputSingle-parameter", {
tokenIn: this.tokenIn, // WETH tokenIn: tokenIn, // WETH
tokenOut: this.tokenOut, // BLOOD tokenOut: tokenOut, // BLOOD
fee: this.fee, fee: this.poolData.fee,
amountEthBase: ethBase, amountEthBase: ethBase,
pricelimit: 0n, //sqrtPriceLimitX96 pricelimit: 0, //sqrtPriceLimitX96
}); });
const quotedAmountOut = await this.quoateV3Contract.read.quoteExactInputSingle([ const quotedAmountOut = await this.quoateV3Contract.read.quoteExactInputSingle([
this.tokenIn, //weth tokenIn, //weth
this.tokenOut, //bloodline tokenOut, //bloodline
this.fee, this.poolData.fee,
ethBase, ethBase,
0n, //sqrtPriceLimitX96 0, //sqrtPriceLimitX96
]); ]);
console.log("quotedAmountOut", quotedAmountOut); console.log("quotedAmountOut", quotedAmountOut);
return {result: true, amount: quotedAmountOut}; return {result: true, amount: quotedAmountOut};
@@ -51,6 +70,31 @@ export const useUniswapStore = defineStore("uniswap", {
return { result: false, amount: null }; return { result: false, amount: null };
} }
} },
} 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;
console.log("this.poolData", this.poolData);
},
},
}); });
+8 -31
View File
@@ -2,7 +2,7 @@ import { defineStore } from "pinia";
import { markRaw } from "vue"; import { markRaw } from "vue";
import { useTokenStore } from "./tokens"; import { useTokenStore } from "./tokens";
import { useRewardLockerStore } from "./rewardlocker"; import { useRewardLockerStore } from "./rewardlocker";
import { formatNumber } from "@/helper/helper.js";
import { import {
createConfig, createConfig,
configureChains, configureChains,
@@ -15,7 +15,7 @@ import {
getWalletClient, getWalletClient,
fetchBalance, fetchBalance,
multicall, multicall,
getNetwork, getNetwork,
} from "@wagmi/core"; } from "@wagmi/core";
import { WalletConnectConnector } from "@wagmi/core/connectors/walletConnect"; import { WalletConnectConnector } from "@wagmi/core/connectors/walletConnect";
@@ -26,6 +26,7 @@ import { goerli, mainnet } from "@wagmi/core/chains";
import { publicProvider } from "@wagmi/core/providers/public"; import { publicProvider } from "@wagmi/core/providers/public";
import { alchemyProvider } from "@wagmi/core/providers/alchemy"; import { alchemyProvider } from "@wagmi/core/providers/alchemy";
export const useWalletStoreV2 = defineStore("walletV2", { export const useWalletStoreV2 = defineStore("walletV2", {
state: () => ({ state: () => ({
alchemy: null, alchemy: null,
@@ -53,29 +54,11 @@ export const useWalletStoreV2 = defineStore("walletV2", {
return obj.contractAddress === tokenStore.memeToken.contractAddress; return obj.contractAddress === tokenStore.memeToken.contractAddress;
}), }),
unclaimedRewards() { unclaimedRewards() {
if (!this.memeToken?.unclaimedRewards) { const tokenStore = useTokenStore();
return 0n; if (!this.memeToken?.unclaimedRewards) {
} return 0n;
return this.memeToken.unclaimedRewards; }
}, return this.memeToken.unclaimedRewards / 10n ** tokenStore.memeToken.decimals;
orderedUnstakedAmount() {
if (!this.memeToken?.orderedUnstakedAmount) {
return 0n;
}
return this.memeToken?.orderedUnstakedAmount;
},
staked() {
if (!this.memeToken?.staked) {
return 0n;
}
return this.memeToken?.staked;
},
balanceOf() {
if (!this.memeToken?.balanceOf) {
return 0n;
} else {
return this.memeToken?.balanceOf;
}
}, },
}, },
actions: { actions: {
@@ -146,12 +129,6 @@ export const useWalletStoreV2 = defineStore("walletV2", {
const unclaimedRewardsArray = await rewardlockerStore.getTotalRewards(this.address); const unclaimedRewardsArray = await rewardlockerStore.getTotalRewards(this.address);
const unclaimedRewards = unclaimedRewardsArray[0] + unclaimedRewardsArray[1]; const unclaimedRewards = unclaimedRewardsArray[0] + unclaimedRewardsArray[1];
this.memeToken.unclaimedRewards = unclaimedRewards; this.memeToken.unclaimedRewards = unclaimedRewards;
this.memeToken.orderedUnstakedCycles = await rewardlockerStore.unstakeOrdered();
console.log("this.memeToken.orderedUnstakedCycles", this.memeToken.orderedUnstakedCycles);
this.memeToken.orderedUnstakedAmount = this.memeToken.orderedUnstakedCycles.reduce((x, y) => {
return x + y.result;
}, 0n);
}, },
}, },
// persist: true, // persist: true,
+16 -31
View File
@@ -2,9 +2,8 @@
<div class="cycle-page"> <div class="cycle-page">
<div class="cycle-header container container--variant1"> <div class="cycle-header container container--variant1">
<div class="bloodline-page-headline header" ref="observerElement">Bloodline Cycle</div> <div class="bloodline-page-headline header" ref="observerElement">Bloodline Cycle</div>
<div class="bloodline-page-description mid-mid-text"> <div class="bloodline-page-description low-mid-text">
Claim and trade your $BLOOD at each cycle's end. Become the most powerful bloodline and win extra Claim and trade your $BDL at each cycle's end. Become the most powerful bloodline and win extra rewards.
rewards.
</div> </div>
</div> </div>
<div class="slider-wrapper" :class="{ sticking: sticking }" ref="target"> <div class="slider-wrapper" :class="{ sticking: sticking }" ref="target">
@@ -29,7 +28,7 @@
<template v-if="difference > 0"> <template v-if="difference > 0">
<div class="round-finish-info-key">Sacrifice Goal:</div> <div class="round-finish-info-key">Sacrifice Goal:</div>
<div class="round-finish-info-value"> <div class="round-finish-info-value">
{{ cycleStore.getCurrentCycleData?.goalInBLD / 10n ** tokenStore.memeToken.decimals }} $BLOOD {{ cycleStore.getCurrentCycleData?.goalInBLD / 10n ** tokenStore.memeToken.decimals }} $BDL
</div> </div>
<div class="round-finish-info-key">Time left:</div> <div class="round-finish-info-key">Time left:</div>
<div class="round-finish-info-value">{{ days }} {{ hours }} {{ minutes }}</div> <div class="round-finish-info-value">{{ days }} {{ hours }} {{ minutes }}</div>
@@ -41,15 +40,12 @@
<template v-if="cycleStore.currentCycle !== cycleStore.activeCycle"> <template v-if="cycleStore.currentCycle !== cycleStore.activeCycle">
<div class="bloodline-border bloodline-border purple cycle-winner" v-if="cycleStore.getCycleWinner"> <div class="bloodline-border bloodline-border purple cycle-winner" v-if="cycleStore.getCycleWinner">
<div class="cycle-winner-left"> <div class="cycle-winner-left">
<div class="cycle-winner-headline">Cycle Winner</div> <div class="cycle-winner-headline">Clan Winner</div>
<div class="cycle-winner-subheadline"> <div class="cycle-winner-subheadline">+25% Clan Bonus</div>
+ Clan Bonus on {{ cycleStore.getCycleWinner.name }} Sacrifice
</div>
</div> </div>
<div class="cycle-winner-right"> <div class="cycle-winner-right">
<div class="cycle-winner-logo"> <div class="cycle-winner-logo">
<img class="logo" :src="cycleStore.getCycleWinner.vamplogo" alt="" /> <img :src="cycleStore.getCycleWinner.vampwinner" alt="" />
<img class="crown" src="/assets/img/winnerCrown.png" alt="" />
</div> </div>
<div class="cycle-winner-name">{{ cycleStore.getCycleWinner.name }}</div> <div class="cycle-winner-name">{{ cycleStore.getCycleWinner.name }}</div>
</div> </div>
@@ -273,35 +269,24 @@ function timeBetweenDates(expirationTimestamp) {
.cycle-winner-headline .cycle-winner-headline
font-size: 24px font-size: 24px
.cycle-winner-subheadline .cycle-winner-subheadline
font-size: 14px font-size: 12px
.cycle-winner-right .cycle-winner-right
display: flex display: flex
flex-direction: column flex-direction: column
justify-content: space-between justify-content: space-between
align-items: center align-items: center
.cycle-winner-logo .cycle-winner-logo
height: 72px height: 48px
width: 72px width: 48px
position: relative position: relative
img img
&.logo height: 72px
height: 100% width: 72px
width: 100% border-radius: 50%
border: 1px solid yellow position: absolute
border-radius: 50% left: 50%
img top: 10px
&.crown transform: translate(-50%, -50%)
position: absolute
top: -10px
transform: translate(-50%, -50%)
left: 50%
// height: 72px
// width: 72px
// border-radius: 50%
// position: absolute
// left: 50%
// top: 10px
// transform: translate(-50%, -50%)
&.inactive &.inactive
img img
height: 100% height: 100%
+3 -4
View File
@@ -66,7 +66,6 @@ function openTutorialFunc(e) {
text-align: center text-align: center
margin-top: 24px margin-top: 24px
margin-bottom: 48px margin-bottom: 48px
padding: 0 12px
@media (min-width: 992px) @media (min-width: 992px)
font-size: 48px font-size: 48px
margin-top: 0px margin-top: 0px
@@ -74,7 +73,6 @@ function openTutorialFunc(e) {
text-shadow: unset text-shadow: unset
line-height: 80px line-height: 80px
font-weight: 600 font-weight: 600
padding: 0
.chart-wrapper-coin .chart-wrapper-coin
display: flex display: flex
@@ -108,7 +106,8 @@ function openTutorialFunc(e) {
margin-right: auto margin-right: auto
pointer-events: none pointer-events: none
user-select: none user-select: none
width: 100% @media (min-width: 992px)
width: 100%
.chart-wrapper .chart-wrapper
width: 600px width: 600px
height: 600px height: 600px
@@ -130,7 +129,7 @@ function openTutorialFunc(e) {
#section-header-container #section-header-container
margin: 48px 0 margin: 72px 0
scroll-margin: 150px scroll-margin: 150px
.tutorial-header .tutorial-header
display: flex display: flex
+1 -2
View File
@@ -1,5 +1,4 @@
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from 'node:url'
import svgLoader from "vite-svg-loader";
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import GlobalsPolyfills from "@esbuild-plugins/node-globals-polyfill"; import GlobalsPolyfills from "@esbuild-plugins/node-globals-polyfill";
@@ -10,7 +9,7 @@ import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
base: "./", base: "./",
plugins: [vue(), svgLoader()], plugins: [vue()],
optimizeDeps: { optimizeDeps: {
esbuildOptions: { esbuildOptions: {
plugins: [ plugins: [
+2214 -2328
View File
File diff suppressed because it is too large Load Diff