new contracts + visual improvements + cyle end

This commit is contained in:
EmberSpirit
2023-07-20 20:28:21 +02:00
parent cb85a47a94
commit 994c440e2f
13 changed files with 398 additions and 128 deletions
+30 -33
View File
@@ -2,6 +2,7 @@ import { defineStore } from "pinia";
import { useMemeburnerStore } from "./memeburner";
import { useTokenStore } from "./tokens";
import { useRewardLockerStore } from "./rewardlocker";
import { useWalletStore } from "./wallet";
export const useRoundsStore = defineStore("rounds", {
@@ -33,6 +34,7 @@ export const useRoundsStore = defineStore("rounds", {
console.log("fillRound");
const memeBurnerStore = useMemeburnerStore();
const tokenStore = useTokenStore();
const walletStore = useWalletStore();
const rewardLockerStore = useRewardLockerStore();
// if (this.activeRound === this.currentRound) {
@@ -42,13 +44,12 @@ export const useRoundsStore = defineStore("rounds", {
console.log("round not filled --> fill round");
console.log("vor error");
var data = await memeBurnerStore.getSacrificedRound(this.activeRound)
var rewardData = await rewardLockerStore.getRewardsForAllToken(this.activeRound);
let rewardData = null;
if (await walletStore.isConnected()) {
rewardData = await rewardLockerStore.getRewardsForAllToken(this.activeRound);
}
var goal = await memeBurnerStore.getGoal(this.activeRound);
console.log("goal", goal);
console.log("this.activeRound", this.activeRound);
console.log("dataabc", data);
console.log("rewardData", rewardData);
console.log("pepecoin-rewards", rewardData[0]);
var tokenArray = []
var rewards_clan = BigInt(0);
@@ -56,43 +57,39 @@ export const useRoundsStore = defineStore("rounds", {
for (let index = 0; index < data.length; index++) {
var tokenData = {};
const token = tokenStore.token[index];
console.log("testabcv", token);
console.log("123abc", token.contractAddress);
var testcoef = await rewardLockerStore.getSacrificedTokenCoefficient(this.activeRound, token.contractAddress);
console.log("testcoef",);
console.log(`rewards ${token.name}`, BigInt(rewardData[index]));
console.log(`clanwin multiplier ${token.name}`, (testcoef / 10000));
const clanwin = BigInt((testcoef / 10000 -1) * rewardData[index]);
console.log(`clanwin ${token.name}`, clanwin);
const sacrificeRewards = BigInt(rewardData[index]) - clanwin;
console.log(`sacrifice rewards`, sacrificeRewards);
console.log("token", token);
tokenData.name = token.name;
tokenData.contractAddress = token.contractAddress;
tokenData.vamplogo = token.vamp.logo;
tokenData.vampname = token.vamp.name;
tokenData.amount = data[index][1];
tokenData.getAmountToReachGoal= await memeBurnerStore.getAmountToReachGoal(token.contractAddress);
tokenData.rewards_ges = rewardData[index];
if (this.currentRound !== this.activeRound) {
tokenData.rewards_clan = clanwin;
console.log("clanwin", clanwin);
tokenData.rewards_sacrifice = sacrificeRewards;
rewards_clan = rewards_clan + BigInt(clanwin / BigInt(Math.pow(10, token.decimals)));
rewards_sacrifice =
rewards_sacrifice + BigInt(sacrificeRewards / BigInt(Math.pow(10, token.decimals)));;
}
if (this.currentRound !== this.activeRound && await walletStore.isConnected()) {
const clanwin = BigInt((testcoef / 10000 - 1) * rewardData[index]);
const sacrificeRewards = BigInt(rewardData[index]) - clanwin;
tokenData.rewards_ges = rewardData[index];
tokenData.rewards_clan = clanwin;
tokenData.rewards_sacrifice = sacrificeRewards;
rewards_clan = rewards_clan + BigInt(clanwin / BigInt(Math.pow(10, token.decimals)));
rewards_sacrifice =
rewards_sacrifice + BigInt(sacrificeRewards / BigInt(Math.pow(10, token.decimals)));
}
tokenArray.push(tokenData);
}
console.log("Math.pow(10, tokenStore.memeToken.decimals)", Math.pow(10, tokenStore.memeToken.decimals));
console.log("goal", goal);
}
const goalInBLD = await memeBurnerStore.getGoalInBLD(this.activeRound);
this.rounds[this.activeRound] = {
goal: goal,
rewards_clan: rewards_clan,
goal: goal.goal,
goalInBLD: goalInBLD /Math.pow(10, tokenStore.memeToken.decimals),
expirationTimestamp: goal.expirationTimestamp,
rewards_clan: rewards_clan,
rewards_sacrifice: rewards_sacrifice,
token: tokenArray,
};
rewards_total: rewards_clan + rewards_sacrifice,
token: tokenArray,
};
} else {
console.log("round already filled");
}