diff --git a/src/assets/contracts/Bloodline.json b/src/assets/contracts/Bloodline.json index af00b23..63c7b8c 100644 --- a/src/assets/contracts/Bloodline.json +++ b/src/assets/contracts/Bloodline.json @@ -1,6 +1,6 @@ { "contractName": "Bloodline", - "contractAddress": "0x51bF3df58D123e8EA43fb2189f18027FD36a08Af", + "contractAddress": "0xfB97A4a863d75F72E6d3DCef4a47413E811c9D2E", "abi": [ { "inputs": [ diff --git a/src/assets/contracts/LiquidityOwner.json b/src/assets/contracts/LiquidityOwner.json index 2a53269..c900393 100644 --- a/src/assets/contracts/LiquidityOwner.json +++ b/src/assets/contracts/LiquidityOwner.json @@ -1,6 +1,6 @@ { "contractName": "LiquidityOwner", - "contractAddress": "0xF8bc4Ce13263DD4e12070e3192be50310eF7C95a", + "contractAddress": "0x0f18b2D23278E1f1d92cc2cE10a75604bDBE9Ad1", "abi": [ { "inputs": [ @@ -132,6 +132,35 @@ "stateMutability": "pure", "type": "function" }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "name": "_liquidityCanBeProvided", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -169,6 +198,54 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tickCycle", + "type": "int24" + } + ], + "name": "calculateTicksForRange1", + "outputs": [ + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tickCycle", + "type": "int24" + } + ], + "name": "calculateTicksForRange2", + "outputs": [ + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "stateMutability": "pure", + "type": "function" + }, { "inputs": [ { @@ -211,6 +288,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "cycleTicks", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "memeAltar", diff --git a/src/assets/contracts/MemeAltar.json b/src/assets/contracts/MemeAltar.json index fbdcb69..d96a15f 100644 --- a/src/assets/contracts/MemeAltar.json +++ b/src/assets/contracts/MemeAltar.json @@ -1,6 +1,6 @@ { "contractName": "MemeAltar", - "contractAddress": "0xE4F42F3f8B0E57b1054D457fe3b49a1A10B1aCEa", + "contractAddress": "0x5368264F18DD0e09ea074a79F3F8B504e2363d84", "abi": [ { "inputs": [ @@ -53,6 +53,11 @@ "name": "CycleCompletedRegistrationFailed", "type": "error" }, + { + "inputs": [], + "name": "GoalCannotBeZero", + "type": "error" + }, { "inputs": [], "name": "InsufficientOutputAmount", @@ -215,42 +220,16 @@ "anonymous": false, "inputs": [ { - "components": [ - { - "internalType": "uint40", - "name": "b1", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "m1", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "b2", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "m2", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "b3", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "m4", - "type": "uint40" - } - ], - "indexed": false, - "internalType": "struct MemeAltar.BM", - "name": "_bm", - "type": "tuple" + "indexed": true, + "internalType": "uint64", + "name": "b", + "type": "uint64" + }, + { + "indexed": true, + "internalType": "uint64", + "name": "m", + "type": "uint64" } ], "name": "NewBM", @@ -309,41 +288,14 @@ { "inputs": [ { - "components": [ - { - "internalType": "uint40", - "name": "b1", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "m1", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "b2", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "m2", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "b3", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "m4", - "type": "uint40" - } - ], - "internalType": "struct MemeAltar.BM", - "name": "newBM", - "type": "tuple" + "internalType": "uint64", + "name": "newB", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "newM", + "type": "uint64" } ], "name": "adjustBM", @@ -410,12 +362,12 @@ }, { "inputs": [], - "name": "bloodline", + "name": "b", "outputs": [ { - "internalType": "contract Bloodline", + "internalType": "uint64", "name": "", - "type": "address" + "type": "uint64" } ], "stateMutability": "view", @@ -423,37 +375,12 @@ }, { "inputs": [], - "name": "bm", + "name": "bloodline", "outputs": [ { - "internalType": "uint40", - "name": "b1", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "m1", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "b2", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "m2", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "b3", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "m4", - "type": "uint40" + "internalType": "contract Bloodline", + "name": "", + "type": "address" } ], "stateMutability": "view", @@ -662,9 +589,9 @@ "name": "issuancePrice", "outputs": [ { - "internalType": "uint256", + "internalType": "uint128", "name": "", - "type": "uint256" + "type": "uint128" } ], "stateMutability": "view", @@ -683,6 +610,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "m", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/src/assets/contracts/RewardLocker.json b/src/assets/contracts/RewardLocker.json index 5788079..ca9590f 100644 --- a/src/assets/contracts/RewardLocker.json +++ b/src/assets/contracts/RewardLocker.json @@ -1,6 +1,6 @@ { "contractName": "RewardLocker", - "contractAddress": "0x2952253374973DE0ffbFe35269Ca13FaF28B935F", + "contractAddress": "0x3342B37A0c06FEf2c3dD9481e31CCCF970e7235B", "abi": [ { "inputs": [ diff --git a/src/assets/contracts/UniswapPool.json b/src/assets/contracts/UniswapPool.json index 9e7a4b3..a91de7a 100644 --- a/src/assets/contracts/UniswapPool.json +++ b/src/assets/contracts/UniswapPool.json @@ -1,5 +1,5 @@ { "contractName": "OurUniV3Pool", - "contractAddress": "0xe00221498E85f4f0CC0179415afdE58d3ca205D3", + "contractAddress": "0xA9e5ee6C0C4119B0d7e14CFEBcB10e42225D98Ed", "abi": [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"CollectProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid1","type":"uint256"}],"name":"Flash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextOld","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextNew","type":"uint16"}],"name":"IncreaseObservationCardinalityNext","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Initialize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"feeProtocol0Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol0New","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1New","type":"uint8"}],"name":"SetFeeProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"int256","name":"amount0","type":"int256"},{"indexed":false,"internalType":"int256","name":"amount1","type":"int256"},{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collectProtocol","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal0X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal1X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"}],"name":"increaseObservationCardinalityNext","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"liquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLiquidityPerTick","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"blockTimestamp","type":"uint32"},{"internalType":"int56","name":"tickCumulative","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityCumulativeX128","type":"uint160"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"secondsAgos","type":"uint32[]"}],"name":"observe","outputs":[{"internalType":"int56[]","name":"tickCumulatives","type":"int56[]"},{"internalType":"uint160[]","name":"secondsPerLiquidityCumulativeX128s","type":"uint160[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"positions","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFees","outputs":[{"internalType":"uint128","name":"token0","type":"uint128"},{"internalType":"uint128","name":"token1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"feeProtocol0","type":"uint8"},{"internalType":"uint8","name":"feeProtocol1","type":"uint8"}],"name":"setFeeProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slot0","outputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"uint16","name":"observationIndex","type":"uint16"},{"internalType":"uint16","name":"observationCardinality","type":"uint16"},{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"},{"internalType":"uint8","name":"feeProtocol","type":"uint8"},{"internalType":"bool","name":"unlocked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"snapshotCumulativesInside","outputs":[{"internalType":"int56","name":"tickCumulativeInside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityInsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsInside","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"int256","name":"amountSpecified","type":"int256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[{"internalType":"int256","name":"amount0","type":"int256"},{"internalType":"int256","name":"amount1","type":"int256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int16","name":"","type":"int16"}],"name":"tickBitmap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"}],"name":"ticks","outputs":[{"internalType":"uint128","name":"liquidityGross","type":"uint128"},{"internalType":"int128","name":"liquidityNet","type":"int128"},{"internalType":"uint256","name":"feeGrowthOutside0X128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthOutside1X128","type":"uint256"},{"internalType":"int56","name":"tickCumulativeOutside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityOutsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsOutside","type":"uint32"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] } diff --git a/src/components/SacrificeToken.vue b/src/components/SacrificeToken.vue index 15ec38a..605d6e8 100644 --- a/src/components/SacrificeToken.vue +++ b/src/components/SacrificeToken.vue @@ -59,7 +59,7 @@ @@ -77,7 +77,10 @@ }" >
- +
@@ -97,7 +100,9 @@ > No Staking Bonus -
+ {{ stakingOutput }} Staking Bonus
+
+ + {{ formatBigIntDivision(stakingOutput, 10n ** activeToken.decimals) }} Staking Bonus +
@@ -181,7 +186,7 @@ const cycleStore = useCycleStore(); const sacrificeStore = useSacrificeStore(); const toast = useToast(); -import { debounce } from "@/helper/helper.js"; +import { debounce, formatBigIntDivision } from "@/helper/helper.js"; const isMobile = inject("isMobile"); const showPanel = inject("showPanel"); @@ -346,6 +351,7 @@ function showSplash() { //call function in the store and remove icon, async function sacrificeToken() { + console.log("activeToken.value", activeToken.value); var result = await sacrificeStore.sacrificeToken(sacrificeStore.sacrificeNumber, activeToken.value); if (result) { showSplash(); @@ -482,6 +488,7 @@ async function changeActiveToken(token) { .value-adder display: flex gap: 6px + flex-wrap: wrap .sacrifice-adder-step font-size: 12px align-items: center diff --git a/src/components/StakeComponentV1.vue b/src/components/StakeComponentV1.vue index f41c5ea..c86a160 100644 --- a/src/components/StakeComponentV1.vue +++ b/src/components/StakeComponentV1.vue @@ -85,7 +85,7 @@ v-model="tokenNumber" @close="stakeMenu = false" :stake="stake" - :amount="balanceOf" + :amount="walletStore.balanceOf" v-if="stakeMenu & !unstakeMenu" >
@@ -144,9 +147,7 @@ v-if="walletStore.orderedUnstakedAmount > 0n && !ableToUnstake" > You can claim - {{ - formatBigIntDivision(walletStore.orderedUnstakedAmount, 10n ** tokenStore.memeToken.decimals) - }} + {{ formatBigIntDivision(walletStore.orderedUnstakedAmount, 10n ** tokenStore.memeToken.decimals) }} $BLOOD next cycle.
@@ -320,14 +321,6 @@ const ableToUnstake = computed(() => { return false; }); -const balanceOf = computed(() => { - if (!walletStore.memeToken?.balanceOf) { - return 0n; - } else { - return formatBigIntDivision(walletStore.memeToken?.balanceOf, 10n ** tokenStore.memeToken.decimals); - } -}); - const stateStake = computed(() => { let returnState = 0; if (state.value === 2) { diff --git a/src/components/StakeMenu.vue b/src/components/StakeMenu.vue index be0c8f9..322f56b 100644 --- a/src/components/StakeMenu.vue +++ b/src/components/StakeMenu.vue @@ -36,6 +36,7 @@ import { useWalletStoreV2 } from "@/stores/walletV2"; import { useRewardLockerStore } from "@/stores/rewardlocker"; import { useTokenStore } from "@/stores/tokens"; import { createPermitObject, getSignatureRSV } from "@/helper/blockchain.js"; +import { formatBigIntDivision } from "@/helper/helper.js"; import { signTypedData } from "@wagmi/core"; @@ -54,19 +55,19 @@ const emit = defineEmits(["close", "update:modelValue"]); async function addTokensPercent(value) { console.log("value", value); console.log("props.amount", props.amount); - console.log("props.amount * 100)", props.amount * 1000); let amount; if (props.amount !== undefined || props.amount !== null) { - console.log("props.amount", props.amount); - console.log("value", value); - amount = (BigInt(props.amount * 1000) * value) / 100000n; + //todo function to calculate correct bigInt value (maybe use string and split) + amount = (BigInt(props.amount) * value) / 100n; } else if (props.stake) { amount = (walletStore.memeToken.balanceOf * value) / 100n; } else { amount = (walletStore.memeToken.staked * value) / 100n; } + console.log("amount123", amount); + amount = amount / 10n ** tokenStore.memeToken.decimals; console.log("amount", amount); - emit("update:modelValue", Number(amount)); + emit("update:modelValue", amount); } async function unstakeBloodline() { diff --git a/src/stores/cycles.js b/src/stores/cycles.js index 3e6a520..73cabe3 100644 --- a/src/stores/cycles.js +++ b/src/stores/cycles.js @@ -35,21 +35,21 @@ export const useCycleStore = defineStore("cycles", { if (!this.cycles[this.activeCycle]?.rewards_sacrifice) { return 0n; } - return this.cycles[this.activeCycle]?.rewards_sacrifice + return this.cycles[this.activeCycle]?.rewards_sacrifice; }, rewardsSacrificeCurrentCycle() { const tokenStore = useTokenStore(); if (!this.cycles[this.currentCycle]?.rewards_sacrifice) { return 0n; } - return this.cycles[this.currentCycle]?.rewards_sacrifice + return this.cycles[this.currentCycle]?.rewards_sacrifice; }, rewardsStaking() { const tokenStore = useTokenStore(); if (!this.cycles[this.activeCycle]?.rewards_staking) { return 0n; } - return this.cycles[this.activeCycle]?.rewards_staking + return this.cycles[this.activeCycle]?.rewards_staking; }, rewardsClan() { @@ -57,14 +57,14 @@ export const useCycleStore = defineStore("cycles", { if (!this.cycles[this.activeCycle]?.rewards_clan) { return 0n; } - return this.cycles[this.activeCycle]?.rewards_clan, 10n ** tokenStore.memeToken.decimals + return this.cycles[this.activeCycle]?.rewards_clan; }, rewardsTotal() { const tokenStore = useTokenStore(); if (!this.cycles[this.activeCycle]?.rewards_total) { return 0n; } - return this.cycles[this.activeCycle]?.rewards_total + return this.cycles[this.activeCycle]?.rewards_total; }, }, @@ -99,18 +99,18 @@ export const useCycleStore = defineStore("cycles", { //todo check if needed, or use fillcycle async updateCurrentCycle(sacrificedToken) { console.log("updateCurrentCycle"); - const memeBurnerStore = useMemeburnerStore(); - const rewardLockerStore = useRewardLockerStore(); - var data = await memeBurnerStore.getSacrificedCycle(this.currentCycle); - var tokenTotalSacrificed = await rewardLockerStore.getTotalSacrificeRewardsForAllToken(this.currentCycle); + const memeBurnerStore = useMemeburnerStore(); + const rewardLockerStore = useRewardLockerStore(); + var data = await memeBurnerStore.getSacrificedCycle(this.currentCycle); + var tokenTotalSacrificed = await rewardLockerStore.getTotalSacrificeRewardsForAllToken(this.currentCycle); console.log("this.currentCycle", this.currentCycle); console.log("this.cycles", this.cycles); if (this.cycles[this.currentCycle]) { var tokenIndex = this.cycles[this.currentCycle].token.findIndex( (tokenData) => tokenData.contractAddress === sacrificedToken ); - this.cycles[this.currentCycle].token[tokenIndex].amount = data[tokenIndex].result[1]; - this.cycles[this.currentCycle].token[tokenIndex].amountInBLD = tokenTotalSacrificed[tokenIndex].result; + this.cycles[this.currentCycle].token[tokenIndex].amount = data[tokenIndex].result[1]; + this.cycles[this.currentCycle].token[tokenIndex].amountInBLD = tokenTotalSacrificed[tokenIndex].result; } }, /** @@ -170,7 +170,7 @@ export const useCycleStore = defineStore("cycles", { const sacrificeClanReward = rewardData[index].result[1]; let clanwin = 0n; if (cycleNumber !== this.currentCycle) { - clanwin = (sacrificeClanReward * coefficent) / 10000n - sacrificeClanReward; + clanwin = (sacrificeClanReward * coefficent) / 10000n - sacrificeClanReward; console.log("clanwin", clanwin); } const sacrificeRewards = sacrificeClanReward; @@ -222,8 +222,8 @@ export const useCycleStore = defineStore("cycles", { const lastCompletedCycle = await rewardLockerStore.lastCompletedCycle(); for (let index = 1; index <= Number(lastCompletedCycle); index++) { array.push(index); - } - console.log("array123", array); + } + console.log("array123", array); return array; }, }, diff --git a/src/stores/memeburner.js b/src/stores/memeburner.js index ff16d4f..de7fbea 100644 --- a/src/stores/memeburner.js +++ b/src/stores/memeburner.js @@ -97,11 +97,10 @@ export const useMemeburnerStore = defineStore("memeburner", { async sacrificeMemeAndBuyBLOOD(amount, minBLOOD) { const tokenStore = useTokenStore(); - const amountDecimal = BigInt(amount) * 10n ** BigInt(tokenStore.activeToken.decimals); var hash = await this.contract.write.sacrificeMemeAndBuyBLOOD([ tokenStore.activeToken.contractAddress, - amountDecimal.toString(), - minBLOOD.toString() + amount, + minBLOOD, ]); return hash; }, diff --git a/src/stores/sacrifice.js b/src/stores/sacrifice.js index 71d6795..d3d1113 100644 --- a/src/stores/sacrifice.js +++ b/src/stores/sacrifice.js @@ -29,9 +29,7 @@ export const useSacrificeStore = defineStore("sacrifice", { try { this.sacrificeState = 2; - console.log("hier"); const getRewards = await this.getRewardsFor(amount, token); - console.log("hier1"); console.log("getRewards", getRewards); let hash = null; if (getRewards.variant === "sacrifice") { @@ -198,11 +196,10 @@ export const useSacrificeStore = defineStore("sacrifice", { token.contractAddress, output ); - stakingRewardsNumber = stakingReward / 10n ** token.decimals + stakingRewardsNumber = stakingReward } - const outputNumber = output / 10n ** BigInt(token.decimals); return { - output: outputNumber, + output: output, variant: variant, minETH: minETH, minBLOOD: minBLOOD, diff --git a/src/stores/walletV2.js b/src/stores/walletV2.js index d8af467..bad7db7 100644 --- a/src/stores/walletV2.js +++ b/src/stores/walletV2.js @@ -2,7 +2,7 @@ import { defineStore } from "pinia"; import { markRaw } from "vue"; import { useTokenStore } from "./tokens"; import { useRewardLockerStore } from "./rewardlocker"; -import {formatBigIntDivision } from "@/helper/helper.js" +import { formatBigIntDivision } from "@/helper/helper.js"; import { createConfig, configureChains, @@ -15,7 +15,7 @@ import { getWalletClient, fetchBalance, multicall, - getNetwork, + getNetwork, } from "@wagmi/core"; import { WalletConnectConnector } from "@wagmi/core/connectors/walletConnect"; @@ -26,7 +26,6 @@ import { goerli, mainnet } from "@wagmi/core/chains"; import { publicProvider } from "@wagmi/core/providers/public"; import { alchemyProvider } from "@wagmi/core/providers/alchemy"; - export const useWalletStoreV2 = defineStore("walletV2", { state: () => ({ alchemy: null, @@ -59,18 +58,25 @@ export const useWalletStoreV2 = defineStore("walletV2", { } return this.memeToken.unclaimedRewards; }, - orderedUnstakedAmount() { - if (!this.memeToken?.orderedUnstakedAmount) { - return 0n - } - return this.memeToken?.orderedUnstakedAmount; - }, - staked() { + orderedUnstakedAmount() { + if (!this.memeToken?.orderedUnstakedAmount) { + return 0n; + } + return this.memeToken?.orderedUnstakedAmount; + }, + staked() { if (!this.memeToken?.staked) { return 0n; } - return this.memeToken?.staked; - } + return this.memeToken?.staked; + }, + balanceOf() { + if (!this.memeToken?.balanceOf) { + return 0n; + } else { + return this.memeToken?.balanceOf; + } + }, }, actions: { async init() { @@ -141,7 +147,7 @@ export const useWalletStoreV2 = defineStore("walletV2", { const unclaimedRewards = unclaimedRewardsArray[0] + unclaimedRewardsArray[1]; 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;