fill round update + notification update + visual fixes
This commit is contained in:
@@ -106,6 +106,7 @@ import RewardsWrapper from "@/components/RewardsWrapper.vue";
|
||||
import { inject, ref, onMounted, computed } from "vue";
|
||||
import { useRewardLockerStore } from "@/stores/rewardlocker";
|
||||
import { useWalletStoreV2 } from "@/stores/walletV2";
|
||||
import { useTokenStore } from "@/stores/tokens";
|
||||
import { useRoundsStore } from "@/stores/rounds";
|
||||
import { useRouter } from "vue-router";
|
||||
import StakeMenu from "@/components/StakeMenu.vue";
|
||||
@@ -120,6 +121,8 @@ const isMobile = inject("isMobile");
|
||||
const showPanel = inject("showPanel");
|
||||
const rewardLockerStore = useRewardLockerStore();
|
||||
const walletStore = useWalletStoreV2();
|
||||
const tokenStore = useTokenStore();
|
||||
|
||||
const roundStore = useRoundsStore();
|
||||
const { address } = storeToRefs(walletStore);
|
||||
const router = useRouter();
|
||||
@@ -132,10 +135,34 @@ const tokenNumber = ref(null);
|
||||
const stateClaim = ref(0);
|
||||
|
||||
async function stakeAndClaim() {
|
||||
console.log(tokenNumber.value);
|
||||
console.log(getCurrentRoundData.value.rewards_total);
|
||||
const coefficient = (10000 * tokenNumber.value) / getCurrentRoundData.value.rewards_total;
|
||||
var result = await rewardLockerStore.stakeAndClaimRound(coefficient, roundStore.activeRound);
|
||||
try {
|
||||
console.log(tokenNumber.value);
|
||||
console.log(getCurrentRoundData.value.rewards_total);
|
||||
const coefficient = (10000 * tokenNumber.value) / getCurrentRoundData.value.rewards_total;
|
||||
var hash = await rewardLockerStore.stakeAndClaimRound(coefficient, roundStore.activeRound);
|
||||
const data = await waitForTransaction({
|
||||
hash: hash,
|
||||
});
|
||||
//ClaimedReward (address staker, uint256 reward)
|
||||
var rewardData = data.logs.find((logObject) => {
|
||||
return logObject.topics.find(
|
||||
(topic) => topic === "0xf86340d97020c624010a208b733db95795281fbc45cb6e6a40d161f91fa3e4a0"
|
||||
);
|
||||
});
|
||||
//
|
||||
console.log("rewardData", rewardData);
|
||||
const outputClaim = Number(rewardData.topics[2]) / Math.pow(10, tokenStore.memeToken.decimals);
|
||||
showSuccessToast(
|
||||
outputClaim.toFixed(5),
|
||||
"Success!",
|
||||
"You just claimed and staked",
|
||||
"Join the next cycle to increase your rewards and win with your clan."
|
||||
);
|
||||
const walletStore = useWalletStoreV2();
|
||||
await walletStore.loadWalletData();
|
||||
} catch (error) {
|
||||
console.error("stakeAndClaim", error);
|
||||
}
|
||||
}
|
||||
|
||||
function openStake() {
|
||||
@@ -157,7 +184,23 @@ async function claimRewards() {
|
||||
hash: hash,
|
||||
});
|
||||
stateClaim.value = 4;
|
||||
//reload
|
||||
// ClaimedReward (address staker, uint256 reward)
|
||||
var rewardData = data.logs.find((logObject) => {
|
||||
return logObject.topics.find(
|
||||
(topic) => topic === "0xd0813ff03c470dcc7baa9ce36914dc2febdfd276d639deffaac383fd3db42ba3"
|
||||
);
|
||||
});
|
||||
//
|
||||
console.log("rewardData", rewardData);
|
||||
|
||||
const outputClaim = Number(rewardData.topics[2]) / Math.pow(10, tokenStore.memeToken.decimals);
|
||||
showSuccessToast(
|
||||
outputClaim.toFixed(5),
|
||||
"Success!",
|
||||
"You just claimed",
|
||||
"Join the next cycle to increase your rewards and win with your clan."
|
||||
);
|
||||
|
||||
await roundStore.fillRound(activeRound.value, true);
|
||||
await walletStore.loadWalletData();
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user