contracts update
This commit is contained in:
Generated
+14207
-16585
File diff suppressed because it is too large
Load Diff
+34
-36
@@ -1,38 +1,36 @@
|
||||
{
|
||||
"name": "vue-ethereum2",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
||||
"@fortawesome/free-brands-svg-icons": "^6.4.0",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
||||
"@fortawesome/vue-fontawesome": "^3.0.3",
|
||||
"@walletconnect/ethereum-provider": "^2.9.0",
|
||||
"@walletconnect/modal": "^2.6.0",
|
||||
"@walletconnect/web3-provider": "^1.8.0",
|
||||
"@web3modal/html": "^2.7.0",
|
||||
"abi-decoder": "^2.4.0",
|
||||
"ethers": "^6.6.3",
|
||||
"pinia": "^2.0.36",
|
||||
"pinia-plugin-persistedstate": "^3.1.0",
|
||||
"sass": "^1.62.1",
|
||||
"swiper": "^9.4.1",
|
||||
"vue": "^3.3.2",
|
||||
"vue-router": "^4.2.0",
|
||||
"web3": "^v1.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
||||
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
||||
"@vitejs/plugin-vue": "^4.2.3",
|
||||
"eslint": "^8.39.0",
|
||||
"eslint-plugin-vue": "^9.11.0",
|
||||
"vite": "^4.3.5"
|
||||
}
|
||||
"name": "vue-ethereum2",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
||||
"@fortawesome/free-brands-svg-icons": "^6.4.0",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
||||
"@fortawesome/vue-fontawesome": "^3.0.3",
|
||||
"@wagmi/core": "^1.3.8",
|
||||
"abi-decoder": "^2.4.0",
|
||||
"ethers": "^6.6.3",
|
||||
"pinia": "^2.0.36",
|
||||
"pinia-plugin-persistedstate": "^3.1.0",
|
||||
"sass": "^1.62.1",
|
||||
"swiper": "^9.4.1",
|
||||
"viem": "^1.4.1",
|
||||
"vue": "^3.3.2",
|
||||
"vue-router": "^4.2.0",
|
||||
"web3": "^v1.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
||||
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
||||
"@vitejs/plugin-vue": "^4.2.3",
|
||||
"eslint": "^8.39.0",
|
||||
"eslint-plugin-vue": "^9.11.0",
|
||||
"vite": "^4.3.5"
|
||||
}
|
||||
}
|
||||
|
||||
+35
-12
@@ -4,7 +4,6 @@ import { storeToRefs } from "pinia";
|
||||
|
||||
import Navbar from "./components/Navbar.vue";
|
||||
import { useWalletStoreV2 } from "@/stores/walletV2";
|
||||
const walletStore = useWalletStoreV2();
|
||||
import { useTokenStore } from "@/stores/tokens";
|
||||
import { useContractStore } from "@/stores/contracts";
|
||||
import { useMemeburnerStore } from "@/stores/memeburner";
|
||||
@@ -15,7 +14,12 @@ import { useRoundsStore } from "@/stores/rounds";
|
||||
import SlideoutPanel from "./components/SlideoutPanel.vue";
|
||||
import ConnectWallet from "./components/ConnectWallet.vue";
|
||||
|
||||
import { watchAccount, getPublicClient, getWalletClient } from "@wagmi/core";
|
||||
import {
|
||||
watchAccount,
|
||||
watchNetwork,
|
||||
getPublicClient,
|
||||
getWalletClient,
|
||||
} from "@wagmi/core";
|
||||
|
||||
const tokenStore = useTokenStore();
|
||||
const contractStore = useContractStore();
|
||||
@@ -23,17 +27,20 @@ const memeBurnerStore = useMemeburnerStore();
|
||||
const rewardLockerStore = useRewardLockerStore();
|
||||
const multiCallStore = useMultiCallStore();
|
||||
const roundsStore = useRoundsStore();
|
||||
const walletStore = useWalletStoreV2();
|
||||
const { memeBurner, token } = storeToRefs(tokenStore);
|
||||
const { list } = storeToRefs(contractStore);
|
||||
const isMobile = ref(false);
|
||||
const showPanel = ref(false);
|
||||
const eventWatch = ref(null);
|
||||
const netWorkEvent = ref(null);
|
||||
|
||||
isMobile.value = isMobileFunc();
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener("resize", handleWindowSizeChange);
|
||||
|
||||
eventWatch.value();
|
||||
netWorkEvent.value();
|
||||
console.log("unsubscribe");
|
||||
});
|
||||
const handleWindowSizeChange = () => {
|
||||
@@ -62,32 +69,48 @@ onMounted(async () => {
|
||||
await walletStore.init();
|
||||
await tokenStore.initV2();
|
||||
await memeBurnerStore.init();
|
||||
// await rewardLockerStore.init();
|
||||
// await memeBurnerStore.init();
|
||||
await rewardLockerStore.init();
|
||||
await memeBurnerStore.init();
|
||||
// await multiCallStore.init();
|
||||
//Memeburner Contract
|
||||
|
||||
//init
|
||||
// roundsStore.currentRound = parseInt(
|
||||
// await memeBurnerStore.getCurrentRound()
|
||||
// );
|
||||
// console.log("roundsStore.currentRound", roundsStore.currentRound);
|
||||
// roundsStore.activeRound = roundsStore.currentRound;
|
||||
// await roundsStore.fillRound(roundsStore.activeRound);
|
||||
roundsStore.currentRound = parseInt(
|
||||
await memeBurnerStore.getCurrentRound()
|
||||
);
|
||||
console.log("roundsStore.currentRound", roundsStore.currentRound);
|
||||
roundsStore.activeRound = roundsStore.currentRound;
|
||||
await roundsStore.fillRound(roundsStore.activeRound);
|
||||
|
||||
//events
|
||||
eventWatch.value = watchAccount(async (account) => {
|
||||
console.log("account123", account);
|
||||
const publicClient = getPublicClient();
|
||||
const publicClient = await getPublicClient();
|
||||
console.log("publicClient", publicClient);
|
||||
var walletClient = await getWalletClient();
|
||||
|
||||
// {chainId: }
|
||||
console.log("walletClient", walletClient);
|
||||
if (account.address) {
|
||||
walletStore.address = account.address;
|
||||
walletStore.connected = true;
|
||||
var walletClient = await getWalletClient({
|
||||
chainId: walletStore.chain.id,
|
||||
});
|
||||
walletStore.walletClient = walletClient;
|
||||
await memeBurnerStore.init();
|
||||
} else {
|
||||
walletStore.address = null;
|
||||
walletStore.connected = false;
|
||||
walletStore.walletClient = null;
|
||||
}
|
||||
});
|
||||
|
||||
netWorkEvent.value = watchNetwork((network) => {
|
||||
console.log("network123", network);
|
||||
if (network.chain) {
|
||||
walletStore.chain = network.chain;
|
||||
} else {
|
||||
walletStore.chain = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<h3>Connect Wallet</h3>
|
||||
<div class="connectors-wrapper">
|
||||
<div class="connectors-element" v-for="connector in walletStore.connectors" @click="connectWallet(connector)">
|
||||
<div class="connectors-element" v-for="connector in walletStore.config?.connectors" @click="connectWallet(connector)">
|
||||
<div class="connector-icon">
|
||||
<img :src="`/assets/img/connectors/${connector.id}.svg`" :alt="`${connector.name} Logo`">
|
||||
</div>
|
||||
@@ -9,7 +9,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div @click="disconnectWallet">disconnect</div>
|
||||
<div @click="getWalletClientTest">getwalletclient</div>
|
||||
<div>Connected: {{ walletStore.connected }}</div>
|
||||
</template>
|
||||
|
||||
@@ -28,7 +27,6 @@ import {
|
||||
disconnect,
|
||||
InjectedConnector,
|
||||
watchAccount,
|
||||
getWalletClient,
|
||||
} from "@wagmi/core";
|
||||
|
||||
const walletStore = useWalletStoreV2();
|
||||
@@ -81,21 +79,6 @@ async function disconnectWallet() {
|
||||
}
|
||||
}
|
||||
|
||||
async function getWalletClientTest() {
|
||||
const walletClient = await getWalletClient();
|
||||
console.log("walletClient", walletClient);
|
||||
const contract = getContract({
|
||||
address: Meme1Json.contractAddress,
|
||||
abi: Meme1Json.abi,
|
||||
walletClient,
|
||||
});
|
||||
const result = await contract.read.totalSupply();
|
||||
console.log("result", result);
|
||||
|
||||
// console.log("obj", obj);
|
||||
// });
|
||||
}
|
||||
|
||||
async function connectWallet(connector) {
|
||||
instance.parent.emit("update:modelValue", false);
|
||||
await walletStore.connectWallet(toRaw(connector));
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from "pinia";
|
||||
import { ref, onMounted, onBeforeUnmount, inject } from "vue";
|
||||
import { useWalletStore } from "@/stores/wallet";
|
||||
const walletStore = useWalletStore();
|
||||
import { useWalletStoreV2 } from "@/stores/walletV2";
|
||||
const emit = defineEmits(["showPanel"]);
|
||||
|
||||
const walletStore = useWalletStoreV2();
|
||||
const { connected, address } = storeToRefs(walletStore);
|
||||
const isMobile = inject("isMobile");
|
||||
|
||||
const showPanel = ref(false);
|
||||
|
||||
const showNavbar = ref(true);
|
||||
const lastScrollPosition = ref(0);
|
||||
|
||||
@@ -62,8 +66,9 @@ onBeforeUnmount(() => {
|
||||
</div>
|
||||
<div class="navbar-end">
|
||||
<div v-if="!isMobile">
|
||||
<div v-if="!connected" class="btn btn-immortal" @click="walletStore.connectWallet">connect</div>
|
||||
<span v-else> {{ address }}</span>
|
||||
<!-- <div v-if="!connected" class="btn btn-immortal" @click="walletStore.connectWallet">connect</div> -->
|
||||
<div v-if="!address" class="btn btn-immortal" @click="$emit('showPanel', true)">connect</div>
|
||||
<span v-else @click="$emit('showPanel', true)"> {{ address }}</span>
|
||||
</div>
|
||||
<div v-else class="hamburger-menu">
|
||||
<font-awesome-icon :icon="['fas', 'bars']" />
|
||||
|
||||
@@ -6,7 +6,8 @@ export function getImageUrl(url) {
|
||||
export function getPercentage(amount, goal) {
|
||||
console.log("amount", amount);
|
||||
console.log("goal", goal);
|
||||
return ((amount / goal) * 100).toFixed(2);
|
||||
|
||||
return ((Number(amount) / Number(goal)) * 100).toFixed(2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+29
-26
@@ -6,7 +6,7 @@ import { useWalletStore } from "./wallet";
|
||||
import { useWalletStoreV2 } from "./walletV2";
|
||||
import { useRoundsStore } from "@/stores/rounds";
|
||||
|
||||
import { multicall, getContract, fetchToken } from "@wagmi/core";
|
||||
import { multicall, getContract, fetchToken, waitForTransaction } from "@wagmi/core";
|
||||
|
||||
|
||||
export const useMemeburnerStore = defineStore("memeburner", {
|
||||
@@ -21,15 +21,14 @@ export const useMemeburnerStore = defineStore("memeburner", {
|
||||
console.log("-----------init memeburner-------------");
|
||||
const walletStore = useWalletStoreV2();
|
||||
// const roundsStore = useRoundsStore();
|
||||
|
||||
console.log("walletStore.walletClient", walletStore.walletClient);
|
||||
// this.contract = new walletStore.web3.eth.Contract(this.config.abi, this.config.contractAddress);
|
||||
this.contract = getContract({
|
||||
address: this.config.contractAddress,
|
||||
abi: this.config.abi,
|
||||
PublicClient: walletStore.publicClient,
|
||||
WalletClient: walletStore.walletClient,
|
||||
});
|
||||
|
||||
abi: this.config.abi,
|
||||
walletClient: walletStore.walletClient || walletStore.publicClient,
|
||||
});
|
||||
console.log("this.contract", this.contract);
|
||||
// const websocketMemeBurner = new walletStore.web3socket.eth.Contract(
|
||||
// this.config.abi,
|
||||
// this.config.contractAddress
|
||||
@@ -56,35 +55,36 @@ export const useMemeburnerStore = defineStore("memeburner", {
|
||||
return rewards;
|
||||
},
|
||||
async getCurrentRound() {
|
||||
return await this.contract.methods.currentRound().call();
|
||||
return await this.contract.read.currentRound();
|
||||
},
|
||||
async getGoal(roundnumber) {
|
||||
return await this.contract.methods.rounds(roundnumber).call();
|
||||
return await this.contract.read.rounds([roundnumber]);
|
||||
},
|
||||
//returns participated, amount achieved
|
||||
async getSacrificedMeme(roundnumber, tokenAddress) {
|
||||
return await this.contract.methods.getSacrificedMeme(roundnumber, tokenAddress).call();
|
||||
return await this.contract.read.getSacrificedMeme([roundnumber, tokenAddress]);
|
||||
},
|
||||
async getAmountToReachGoal(tokenAddress) {
|
||||
return await this.contract.methods.getAmountToReachGoal(tokenAddress).call();
|
||||
return await this.contract.read.getAmountToReachGoal([tokenAddress]);
|
||||
},
|
||||
async getSacrificedRound(roundnumber) {
|
||||
console.log("getSacrificedRound", roundnumber);
|
||||
const tokenStore = useTokenStore();
|
||||
const calls = [];
|
||||
// const calls1 = [];
|
||||
const contracts = [];
|
||||
for (let index = 0; index < tokenStore.token.length; index++) {
|
||||
const token = tokenStore.token[index];
|
||||
console.log("token.contractAddress", token.contractAddress);
|
||||
console.log("roundnumber", roundnumber);
|
||||
var test = await this.getSacrificedMeme(roundnumber, token.contractAddress);
|
||||
console.log(token.name, test);
|
||||
calls.push(this.contract.methods.getSacrificedMeme(roundnumber, token.contractAddress));
|
||||
// calls1.push(this.contract.methods.getAmountToReachGoal(token.contractAddress));
|
||||
// contracts.push(this.contract.methods.getSacrificedMeme(roundnumber, token.contractAddress));
|
||||
contracts.push({ ...this.contract, functionName: "getSacrificedMeme", args: [roundnumber, token.contractAddress] });
|
||||
}
|
||||
console.log("this.contract", this.contract);
|
||||
const multicallStore = useMultiCallStore();
|
||||
return await multicallStore.aggregate(calls);
|
||||
// console.log("this.contract", this.contract);
|
||||
// const multicallStore = useMultiCallStore();
|
||||
// return await multicallStore.aggregate(calls);
|
||||
const data = await multicall({
|
||||
contracts,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
async sacrificeMeme(amount) {
|
||||
const walletStore = useWalletStore();
|
||||
@@ -97,11 +97,14 @@ export const useMemeburnerStore = defineStore("memeburner", {
|
||||
}
|
||||
this.loading = true;
|
||||
const amountDecimal = BigInt(amount * Math.pow(10, tokenStore.activeToken.decimals));
|
||||
var reward = await this.contract.methods
|
||||
.sacrificeMeme(tokenStore.activeToken.contractAddress, amountDecimal)
|
||||
.send({ from: walletStore.address });
|
||||
console.log("reward", reward);
|
||||
tokenStore.activeToken.allowance = await tokenStore.allowance();
|
||||
console.log("this.contract", this.contract);
|
||||
var hash = await this.contract.write
|
||||
.sacrificeMeme([tokenStore.activeToken.contractAddress, amountDecimal])
|
||||
console.log("hash", hash);
|
||||
const data = await waitForTransaction({
|
||||
hash: hash,
|
||||
});
|
||||
tokenStore.activeToken.allowance = await tokenStore.allowance();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
@@ -109,7 +112,7 @@ export const useMemeburnerStore = defineStore("memeburner", {
|
||||
}
|
||||
},
|
||||
async getGoalInBLD(roundNumber) {
|
||||
return await this.contract.methods.getGoalInBLD(roundNumber).call();
|
||||
return await this.contract.read.getGoalInBLD([roundNumber]);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
+31
-14
@@ -3,7 +3,10 @@ import RewardLockerJson from "@/assets/contracts/RewardLocker.json";
|
||||
import { useTokenStore } from "./tokens";
|
||||
import { useMultiCallStore } from "./multicall";
|
||||
import { useWalletStore } from "./wallet";
|
||||
import { useWalletStoreV2 } from "./walletV2";
|
||||
import { ethers } from "ethers";
|
||||
import { multicall, getContract } from "@wagmi/core";
|
||||
|
||||
|
||||
export const useRewardLockerStore = defineStore("rewardlocker", {
|
||||
state: () => ({
|
||||
@@ -15,8 +18,13 @@ export const useRewardLockerStore = defineStore("rewardlocker", {
|
||||
actions: {
|
||||
async init() {
|
||||
console.log("-----------init rewardlocker-------------");
|
||||
const walletStore = useWalletStore();
|
||||
this.contract = new walletStore.web3.eth.Contract(this.config.abi, this.config.contractAddress);
|
||||
const walletStore = useWalletStoreV2();
|
||||
this.contract = getContract({
|
||||
address: this.config.contractAddress,
|
||||
abi: this.config.abi,
|
||||
walletClient: walletStore.walletClient || walletStore.publicClient,
|
||||
});
|
||||
// this.contract = new walletStore.web3.eth.Contract(this.config.abi, this.config.contractAddress);
|
||||
},
|
||||
/*
|
||||
* @param {*} walletAddress
|
||||
@@ -25,34 +33,43 @@ export const useRewardLockerStore = defineStore("rewardlocker", {
|
||||
* @returns Rewards for specific token and specific round
|
||||
*/
|
||||
async getRewards(walletAddress, roundNumber, tokenAddress) {
|
||||
return await this.contract.methods.rewards(walletAddress, roundNumber, tokenAddress).call();
|
||||
return await this.contract.read.rewards([walletAddress, roundNumber, tokenAddress]);
|
||||
},
|
||||
async getRewardsForAllToken(roundNumber) {
|
||||
console.log("getRewardsForAllToken");
|
||||
const tokenStore = useTokenStore();
|
||||
const walletStore = useWalletStore();
|
||||
const calls = [];
|
||||
const walletStore = useWalletStoreV2();
|
||||
const contracts = [];
|
||||
for (let index = 0; index < tokenStore.token.length; index++) {
|
||||
const token = tokenStore.token[index];
|
||||
calls.push(this.contract.methods.rewards(walletStore.address, roundNumber, token.contractAddress));
|
||||
}
|
||||
const multicallStore = useMultiCallStore();
|
||||
return await multicallStore.aggregate(calls);
|
||||
// calls.push(this.contract.methods.rewards(walletStore.address, roundNumber, token.contractAddress));
|
||||
contracts.push({
|
||||
...this.contract,
|
||||
functionName: "rewards",
|
||||
args: [walletStore.address, roundNumber, token.contractAddress],
|
||||
});
|
||||
}
|
||||
const data = await multicall({
|
||||
contracts,
|
||||
});
|
||||
// const multicallStore = useMultiCallStore();
|
||||
return data
|
||||
},
|
||||
async getSacrificedTokenCoefficient(roundNumber, sacrificedToken) {
|
||||
return await this.contract.methods.getSacrificedTokenCoefficient(roundNumber, sacrificedToken).call();
|
||||
return await this.contract.read.getSacrificedTokenCoefficient([roundNumber, sacrificedToken]);
|
||||
},
|
||||
async lastCompletedRound() {
|
||||
return await this.contract.methods.lastCompletedRound().call();
|
||||
return await this.contract.read.lastCompletedRound();
|
||||
},
|
||||
async claim(round) {
|
||||
const walletStore = useWalletStore();
|
||||
const walletStore = useWalletStoreV2();
|
||||
// return await this.contract.methods.claim(round).call();
|
||||
console.log(this.contract.methods.claim(round));
|
||||
return await this.contract.methods.claim(round).send({from: walletStore.address, to: this.contractAddress});
|
||||
// return await this.contract.methods.claim(round).send({from: walletStore.address, to: this.contractAddress});
|
||||
return await this.contract.write.claim([round]);
|
||||
},
|
||||
async getTotalRewardsOf(address, rounds) {
|
||||
return await this.contract.methods.getTotalRewardsOf(address, rounds).call();
|
||||
return await this.contract.read.getTotalRewardsOf([address, rounds]);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
+12
-10
@@ -3,6 +3,7 @@ import { useMemeburnerStore } from "./memeburner";
|
||||
import { useTokenStore } from "./tokens";
|
||||
import { useRewardLockerStore } from "./rewardlocker";
|
||||
import { useWalletStore } from "./wallet";
|
||||
import { useWalletStoreV2 } from "./walletV2";
|
||||
|
||||
|
||||
export const useRoundsStore = defineStore("rounds", {
|
||||
@@ -34,7 +35,7 @@ export const useRoundsStore = defineStore("rounds", {
|
||||
console.log("fillRound");
|
||||
const memeBurnerStore = useMemeburnerStore();
|
||||
const tokenStore = useTokenStore();
|
||||
const walletStore = useWalletStore();
|
||||
const walletStore = useWalletStoreV2();
|
||||
const rewardLockerStore = useRewardLockerStore();
|
||||
|
||||
// if (this.activeRound === this.currentRound) {
|
||||
@@ -51,7 +52,7 @@ export const useRoundsStore = defineStore("rounds", {
|
||||
console.log("rewardData123", rewardData);
|
||||
|
||||
var goal = await memeBurnerStore.getGoal(this.activeRound);
|
||||
|
||||
console.log("goal", goal);
|
||||
var tokenArray = []
|
||||
var rewards_clan = BigInt(0);
|
||||
var rewards_sacrifice = BigInt(0);
|
||||
@@ -66,9 +67,10 @@ export const useRoundsStore = defineStore("rounds", {
|
||||
tokenData.contractAddress = token.contractAddress;
|
||||
tokenData.vamplogo = token.vamp.logo;
|
||||
tokenData.vampname = token.vamp.name;
|
||||
tokenData.amount = data[index][1];
|
||||
tokenData.amount = data[index].result[1];
|
||||
tokenData.getAmountToReachGoal= await memeBurnerStore.getAmountToReachGoal(token.contractAddress);
|
||||
if (this.currentRound !== this.activeRound && await walletStore.isConnected()) {
|
||||
if (this.currentRound !== this.activeRound && walletStore.connected) {
|
||||
console.log("rewarddata", rewardData);
|
||||
const clanwin = BigInt((testcoef / 10000 - 1) * rewardData[index]);
|
||||
const sacrificeRewards = BigInt(rewardData[index]) - clanwin;
|
||||
tokenData.rewards_ges = rewardData[index];
|
||||
@@ -80,17 +82,17 @@ export const useRoundsStore = defineStore("rounds", {
|
||||
}
|
||||
tokenArray.push(tokenData);
|
||||
}
|
||||
|
||||
const goalInBLD = await memeBurnerStore.getGoalInBLD(this.activeRound);
|
||||
this.rounds[this.activeRound] = {
|
||||
goal: goal.goal,
|
||||
goalInBLD: goalInBLD /Math.pow(10, tokenStore.memeToken.decimals),
|
||||
expirationTimestamp: goal.expirationTimestamp,
|
||||
goal: goal[0],
|
||||
goalInBLD: goalInBLD / BigInt(Math.pow(10, tokenStore.memeToken.decimals)),
|
||||
expirationTimestamp: goal[1],
|
||||
rewards_clan: rewards_clan,
|
||||
rewards_sacrifice: rewards_sacrifice,
|
||||
rewards_total: rewards_clan + rewards_sacrifice,
|
||||
rewards_sacrifice: rewards_sacrifice,
|
||||
rewards_total: rewards_clan + rewards_sacrifice,
|
||||
token: tokenArray,
|
||||
};
|
||||
console.log("this.rounds[this.activeRound]", this.rounds[this.activeRound]);
|
||||
} else {
|
||||
console.log("round already filled");
|
||||
}
|
||||
|
||||
@@ -78,9 +78,8 @@ export const useTokenStore = defineStore("token", {
|
||||
token.contract = getContract({
|
||||
address: token.contractAddress,
|
||||
abi: token.abi,
|
||||
PublicClient: walletStore.publicClient,
|
||||
WalletClient: walletStore.walletClient
|
||||
});
|
||||
WalletClient: walletStore.walletClient || walletStore.publicClient,
|
||||
});
|
||||
contracts.push({...token.contract, functionName: "decimals"})
|
||||
|
||||
}
|
||||
@@ -137,6 +136,7 @@ export const useTokenStore = defineStore("token", {
|
||||
const decimals = this.activeToken.decimals;
|
||||
|
||||
allowance = BigInt(allowance / BigInt(Math.pow(10, decimals)));
|
||||
console.log("allowance", allowance);
|
||||
return allowance;
|
||||
},
|
||||
async approveToken(amount) {
|
||||
|
||||
@@ -9,8 +9,6 @@ import {
|
||||
getAccount,
|
||||
getContract,
|
||||
connect,
|
||||
getWalletClient,
|
||||
getPublicClient,
|
||||
disconnect,
|
||||
InjectedConnector,
|
||||
watchAccount,
|
||||
@@ -36,7 +34,8 @@ export const useWalletStoreV2 = defineStore("walletV2", {
|
||||
client: null,
|
||||
publicClient: null,
|
||||
walletClient: null,
|
||||
config: null
|
||||
config: null,
|
||||
chain: null,
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
@@ -51,6 +50,7 @@ export const useWalletStoreV2 = defineStore("walletV2", {
|
||||
[alchemyProvider({ apiKey: goerliKey }), publicProvider()]
|
||||
);
|
||||
|
||||
|
||||
this.config = createConfig({
|
||||
autoConnect: true,
|
||||
connectors: [
|
||||
@@ -79,7 +79,6 @@ export const useWalletStoreV2 = defineStore("walletV2", {
|
||||
webSocketPublicClient,
|
||||
});
|
||||
this.publicClient = publicClient;
|
||||
this.walletClient = await getWalletClient();
|
||||
// await this.isConnected();
|
||||
// const goerliKey = import.meta.env.VITE_GOERLI_KEY;
|
||||
// if (this.connected) {
|
||||
|
||||
@@ -50,7 +50,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
function timeBetweenDates() {
|
||||
const dateEntered = new Date(
|
||||
getCurrentRoundData.value?.expirationTimestamp * 1000
|
||||
Number(getCurrentRoundData.value?.expirationTimestamp) * 1000
|
||||
);
|
||||
|
||||
if (dateEntered) {
|
||||
@@ -153,7 +153,8 @@ function timeBetweenDates() {
|
||||
<tr>
|
||||
<td>Sacrifice:</td>
|
||||
<td class="divider"></td>
|
||||
<td>{{ getCurrentRoundData?.goalInBLD?.toFixed(2) }} $BDL</td>
|
||||
<!-- <td>{{ getCurrentRoundData?.goalInBLD?.toFixed(2) }} $BDL</td> -->
|
||||
<td>{{ getCurrentRoundData?.goalInBLD }} $BDL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Time left:</td>
|
||||
|
||||
Reference in New Issue
Block a user