fix issues e + new contracts

This commit is contained in:
EmberSpirit
2023-10-22 21:37:15 +02:00
parent bf76e55fb5
commit 44df04cc23
12 changed files with 206 additions and 167 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"contractName": "Bloodline",
"contractAddress": "0x51bF3df58D123e8EA43fb2189f18027FD36a08Af",
"contractAddress": "0xfB97A4a863d75F72E6d3DCef4a47413E811c9D2E",
"abi": [
{
"inputs": [
+97 -1
View File
@@ -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",
+42 -102
View File
@@ -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"
"indexed": true,
"internalType": "uint64",
"name": "b",
"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"
}
],
"indexed": false,
"internalType": "struct MemeAltar.BM",
"name": "_bm",
"type": "tuple"
"indexed": true,
"internalType": "uint64",
"name": "m",
"type": "uint64"
}
],
"name": "NewBM",
@@ -309,41 +288,14 @@
{
"inputs": [
{
"components": [
{
"internalType": "uint40",
"name": "b1",
"type": "uint40"
"internalType": "uint64",
"name": "newB",
"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"
"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": [
{
+1 -1
View File
@@ -1,6 +1,6 @@
{
"contractName": "RewardLocker",
"contractAddress": "0x2952253374973DE0ffbFe35269Ca13FaF28B935F",
"contractAddress": "0x3342B37A0c06FEf2c3dD9481e31CCCF970e7235B",
"abi": [
{
"inputs": [
File diff suppressed because one or more lines are too long
+11 -4
View File
@@ -59,7 +59,7 @@
<template v-slot:message-end v-if="activeWalletToken?.balanceOf >= 0">
<div class="input-balance tiny-text">
Balance:
{{ BigInt(activeWalletToken?.balanceOf) / 10n ** activeToken.decimals }}
{{ formatBigIntDivision(activeWalletToken?.balanceOf, 10n ** activeToken.decimals) }}
</div>
<div class="input-max tiny-text" @click="addMaxTokens">Max</div>
</template>
@@ -77,7 +77,10 @@
}"
>
<div class="sacrifice-to-body">
<token-name-price name="$BLOOD" :price="`≈${output}`"></token-name-price>
<token-name-price
name="$BLOOD"
:price="`≈${formatBigIntDivision(output, 10n ** activeToken.decimals)}`"
></token-name-price>
<token-logo :img="activeToken.vamp.logo" :size="64" :alt="activeToken.vamp.name"></token-logo>
</div>
@@ -97,7 +100,9 @@
>
No Staking Bonus
</div>
<div class="mid-mid-text" v-else>+ {{ stakingOutput }} Staking Bonus</div>
<div class="mid-mid-text" v-else>
+ {{ formatBigIntDivision(stakingOutput, 10n ** activeToken.decimals) }} Staking Bonus
</div>
<div class="icon">
<font-awesome-icon icon="chevron-down" />
</div>
@@ -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
+6 -13
View File
@@ -85,7 +85,7 @@
v-model="tokenNumber"
@close="stakeMenu = false"
:stake="stake"
:amount="balanceOf"
:amount="walletStore.balanceOf"
v-if="stakeMenu & !unstakeMenu"
>
<template v-slot:body>
@@ -109,7 +109,10 @@
</div>
</template>
<template v-slot:message-end>
<div class="input-balance">Balance: {{ balanceOf }}</div>
<div class="input-balance">
Balance:
{{ formatBigIntDivision(walletStore.balanceOf, 10n ** tokenStore.memeToken.decimals) }}
</div>
</template>
</stake-menu>
<div class="unstake-menu" v-else-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.
</div>
</slot>
@@ -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) {
+6 -5
View File
@@ -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() {
+5 -5
View File
@@ -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;
},
},
+2 -3
View File
@@ -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;
},
+2 -5
View File
@@ -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,
+9 -3
View File
@@ -2,7 +2,7 @@ import { defineStore } from "pinia";
import { markRaw } from "vue";
import { useTokenStore } from "./tokens";
import { useRewardLockerStore } from "./rewardlocker";
import {formatBigIntDivision } from "@/helper/helper.js"
import { formatBigIntDivision } from "@/helper/helper.js";
import {
createConfig,
configureChains,
@@ -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,
@@ -61,7 +60,7 @@ export const useWalletStoreV2 = defineStore("walletV2", {
},
orderedUnstakedAmount() {
if (!this.memeToken?.orderedUnstakedAmount) {
return 0n
return 0n;
}
return this.memeToken?.orderedUnstakedAmount;
},
@@ -70,8 +69,15 @@ export const useWalletStoreV2 = defineStore("walletV2", {
return 0n;
}
return this.memeToken?.staked;
},
balanceOf() {
if (!this.memeToken?.balanceOf) {
return 0n;
} else {
return this.memeToken?.balanceOf;
}
},
},
actions: {
async init() {
console.log("wallet init");