comments + contract update +

smaller design issues
This commit is contained in:
EmberSpirit
2023-10-12 20:01:11 +02:00
parent 68cd720c59
commit b5c6f8af33
37 changed files with 714 additions and 1480 deletions
+13 -14
View File
@@ -2,7 +2,7 @@ import { defineStore } from "pinia";
import MemeAltarJson from "@/assets/contracts/MemeAltar.json";
import { useTokenStore } from "./tokens";
import { useWalletStoreV2 } from "./walletV2";
import { useRoundsStore } from "@/stores/rounds";
import { useCycleStore } from "@/stores/cycles";
import { multicall, getContract, fetchToken, waitForTransaction, getWalletClient } from "@wagmi/core";
@@ -18,7 +18,7 @@ export const useMemeburnerStore = defineStore("memeburner", {
async init() {
console.log("-----------init memeburner-------------");
const walletStore = useWalletStoreV2();
// const roundsStore = useRoundsStore();
// const cycleStore = useCycleStore();
console.log("walletStore.walletClient", walletStore.walletClient);
this.contract = getContract({
address: this.config.contractAddress,
@@ -37,30 +37,29 @@ export const useMemeburnerStore = defineStore("memeburner", {
console.log("rewards", rewards);
return rewards;
},
async getCurrentRound() {
return await this.contract.read.currentRound();
async getCurrentCycle() {
return await this.contract.read.currentCycle();
},
async getGoal(roundnumber) {
return await this.contract.read.rounds([roundnumber]);
async getGoal(cycleNumber) {
return await this.contract.read.cycles([cycleNumber]);
},
//returns participated, amount achieved
async getSacrificedMeme(roundnumber, tokenAddress) {
return await this.contract.read.getSacrificedMeme([roundnumber, tokenAddress]);
async getSacrificedMeme(cycleNumber, tokenAddress) {
return await this.contract.read.getSacrificedMeme([cycleNumber, tokenAddress]);
},
async getAmountToReachGoal(tokenAddress) {
return await this.contract.read.getAmountToReachGoal([tokenAddress, 0]);
},
async getSacrificedRound(roundnumber) {
console.log("getSacrificedRound", roundnumber);
async getSacrificedCycle(cycleNumber) {
console.log("getSacrificedCycle", cycleNumber);
const tokenStore = useTokenStore();
const contracts = [];
for (let index = 0; index < tokenStore.sacrificeToken.length; index++) {
const token = tokenStore.sacrificeToken[index];
// contracts.push(this.contract.methods.getSacrificedMeme(roundnumber, token.contractAddress));
contracts.push({
...this.contract,
functionName: "getSacrificedMeme",
args: [roundnumber, token.contractAddress],
args: [cycleNumber, token.contractAddress],
});
}
// console.log("this.contract", this.contract);
@@ -105,8 +104,8 @@ export const useMemeburnerStore = defineStore("memeburner", {
]);
return hash;
},
async getGoalInBLOOD(roundNumber) {
return await this.contract.read.getGoalInBLOOD([roundNumber]);
async getGoalInBLOOD(cycleNumber) {
return await this.contract.read.getGoalInBLOOD([cycleNumber]);
},
async getAmountETHBase(amount) {
console.log("getAmountETHBase");