diff --git a/src/components/staking/conversion.vue b/src/components/staking/conversion.vue
index 6971b30..a0b3ae0 100644
--- a/src/components/staking/conversion.vue
+++ b/src/components/staking/conversion.vue
@@ -11,7 +11,7 @@
- Lock esCEC for vesting over a one-year period, requiring an equivalent amount of CEC to be locked
+ To lock esCEC to vest within one year, you need to lock an equal amount of staked CEC
@@ -98,21 +98,19 @@ const dialogUnstakeText = ref({
conversionName: "CEC"
})
-
const conversionModal = () => {
- let amount = Number(priceCalculated(stakingStore.cecInfoData.CecStaked)) - Number(priceCalculated(stakingStore.cecInfoData.CecDisarm))
- console.log(amount)
- cecDialogVisible.value = true
- dialogUnstakeText.value = {
- title: "Vest esCEC",
- typeLabel: "Vest",
- tips: "Vest esCEC needs to lock amount of CEC",
- typeName: "es CEC",
- conversion: "CEC Locked",
- conversionName: "CEC",
- amount: stakingStore.cecInfoData.esCecBalance,
- btnText: 'Confirm'
- }
+
+ cecDialogVisible.value = true
+ dialogUnstakeText.value = {
+ title: "Vest esCEC",
+ typeLabel: "Vest",
+ tips: "Vest esCEC needs to lock amount of CEC",
+ typeName: "es CEC",
+ conversion: "CEC Locked",
+ conversionName: "CEC",
+ amount: stakingStore.cecInfoData.esCecBalance,
+ btnText: 'Confirm'
+ }
}
const withdrawModal = async () => {
@@ -142,22 +140,13 @@ const collectionModal = () => {
const eventBtnName = (val) => {
if(val.title == 'Vest esCEC') {
cecDeposit(val.amount)
- // } else if(val.title == 'Claim esCEC') {
- // claimCec()
}
}
// 转化
const cecDeposit = async (_amount) => {
- if(Number(priceCalculated(stakingStore.cecInfoData.CecStaked)) < Number(_amount)) {
- cecDialogVisible.value = false
- const confirmResult = await createModal(ConfirmDialog, {
- title: "",
- noBtnTitle: '',
- message: 'Please stake a sufficient amount of CEC, which will be used to lock the corresponding amount of CEC when the esCEC is vested.'
- }).show();
- } else {
- let amount = BigInt(_amount * 1e18)
+ if((Number(priceCalculated(stakingStore.cecInfoData.CecStaked)) - Number(priceCalculated(stakingStore.cecInfoData.CecDisarm))) == Number(_amount) || (Number(priceCalculated(stakingStore.cecInfoData.CecStaked)) - Number(priceCalculated(stakingStore.cecInfoData.CecDisarm))) > Number(_amount)) {
+ let amount = BigInt(_amount) * BigInt(1e18)
loadingDialogVisible.value = true
try {
let res = await bc.vester.deposit(amount)
@@ -177,6 +166,13 @@ const cecDeposit = async (_amount) => {
}
loadingDialogVisible.value = false
}
+ } else {
+ cecDialogVisible.value = false
+ const confirmResult = await createModal(ConfirmDialog, {
+ title: "",
+ noBtnTitle: '',
+ message: 'Please stake a sufficient amount of CEC, which will be used to lock the corresponding amount of CEC when the esCEC is vested.'
+ }).show();
}
}
diff --git a/src/components/staking/header.vue b/src/components/staking/header.vue
index 9e63132..6ecd048 100644
--- a/src/components/staking/header.vue
+++ b/src/components/staking/header.vue
@@ -18,7 +18,7 @@
CEC
-
{{ priceCalculated(stakingStore.cecInfoData.cecBalance,18) }}
+
{{ priceCalculated(stakingStore.cecInfoData.cecBalance) }}
@@ -231,15 +231,13 @@ const vipHandleClose = () => {
// }
watch(localWalletStore, () => {
- if(localWalletStore.token) {
- // getCode()
- }
+ // if(!localWalletStore.token) {
+ // stakingStore.cecInfoData = cecInfoData.value
+ // }
});
onMounted(() => {
- if (localWalletStore.address) {
- // getCecData();
- }
+
});
diff --git a/src/components/staking/index.vue b/src/components/staking/index.vue
index 6ed76b7..c2e6c61 100644
--- a/src/components/staking/index.vue
+++ b/src/components/staking/index.vue
@@ -287,7 +287,7 @@ const closeEsCecStakedText = () => {
// cec质押
const cecStaked = async (_amount) => {
- const amount = BigInt(_amount * 1e18)
+ const amount = BigInt(_amount) * BigInt(1e18)
loadingDialogVisible.value = true
try{
let allow = await bc.erc20.allowance(STAKING_ADDRESSES[chainId].cec, STAKING_ADDRESSES[chainId].stakedCecTracker)
@@ -317,7 +317,7 @@ const cecStaked = async (_amount) => {
// 取消质押
const closeStaked = async (type, _amount) => {
- let amount = BigInt(_amount * 1e18)
+ let amount = BigInt(_amount) * BigInt(1e18)
loadingDialogVisible.value = true
if(type == 'Unstake CEC') {
try {
@@ -405,7 +405,7 @@ const getCecCollection = async (type) => {
// esCec 质押
const esCecStaked = async (_amount) => {
- const amount = BigInt(_amount * 1e18)
+ const amount = BigInt(_amount) * BigInt(1e18)
loadingDialogVisible.value = true
try{
let res = await bc.staking.stakeEsCec(amount)
diff --git a/src/router/index.js b/src/router/index.js
index 210164b..f0f99c5 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -6,7 +6,7 @@ const routes = [
name: "index1",
component: StakingView,
meta: {
- title: "home",
+ title: "Staking",
canonical: "https://.counterfire.games",
},
},
diff --git a/src/store/wallet.js b/src/store/wallet.js
index 223610f..cb1c6e6 100644
--- a/src/store/wallet.js
+++ b/src/store/wallet.js
@@ -19,7 +19,7 @@ export const walletStore = defineStore(
const showAddress = computed(() => {
- if (address.value.length > 10) {
+ if (address.value?.length > 10) {
return `${address.value.slice(0, 6)}...${address.value.slice(-4)}`;
} else {
return address.value
diff --git a/src/views/StakingView.vue b/src/views/StakingView.vue
index 2b68ca4..f2de26a 100644
--- a/src/views/StakingView.vue
+++ b/src/views/StakingView.vue
@@ -35,7 +35,7 @@
-
{{ localWalletStore.showAddress }}
+
{{ localWalletStore?.showAddress }}

@@ -175,7 +175,7 @@ const getCecData = async () => {
cecInfoData.value.totalCollection = cecInfoData.value.CecCollection + cecInfoData.value.esCecCollection;
stakingStore.cecInfoData = cecInfoData.value;
console.log(cecInfoData.value);
- // getCode()
+ getCode()
} catch (e) {
// console.log("query claimable error", e);
}
@@ -183,8 +183,10 @@ const getCecData = async () => {
}, 2000);
};
+const timer = ref(null)
+const count = ref()
const getCode = () => {
- const TIME_COUNT = 3;
+ let TIME_COUNT = 3;
if (!timer.value) {
count.value = TIME_COUNT;
// this.show = false;
@@ -192,7 +194,7 @@ const getCode = () => {
if (count.value > 0 && count.value <= TIME_COUNT) {
count.value--;
} else {
- // getCecData()
+ getCecData()
TIME_COUNT = 3;
clearInterval(timer.value);
timer.value = null;