From 56b1fb19c35440e1a01f391af5eee2bfa55a6c26 Mon Sep 17 00:00:00 2001
From: yuyongdong
Date: Thu, 12 Sep 2024 14:37:57 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B4=A8=E6=8A=BCcec=20=E8=BD=AC=E5=8C=96?=
=?UTF-8?q?=E3=80=81=E5=8F=96=E6=B6=88=E8=BD=AC=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/staking/cecDialog.vue | 5 ++-
src/components/staking/conversion.vue | 59 +++++++++++++++++++++++++--
src/components/staking/header.vue | 3 +-
src/components/staking/index.vue | 12 +++---
src/store/staking.js | 1 +
5 files changed, 68 insertions(+), 12 deletions(-)
diff --git a/src/components/staking/cecDialog.vue b/src/components/staking/cecDialog.vue
index 750f3bd..fd94385 100644
--- a/src/components/staking/cecDialog.vue
+++ b/src/components/staking/cecDialog.vue
@@ -26,7 +26,7 @@
-
MAX: {{ props.dialogText.amount }}
+
MAX: {{ priceCalculated(props.dialogText.amount) }}
{{ props.dialogText.typeName }}
@@ -51,6 +51,7 @@
diff --git a/src/components/staking/conversion.vue b/src/components/staking/conversion.vue
index b1bdde1..541cbc7 100644
--- a/src/components/staking/conversion.vue
+++ b/src/components/staking/conversion.vue
@@ -42,16 +42,16 @@
- {{ priceCalculated(stakingStore.cecInfoData.esCecConversion) }}
+ {{ priceCalculated(stakingStore.cecInfoData.CecClaimable) }}
Staking
- Disarm
+ Disarm
- Collection
+ Collection
@@ -99,13 +99,43 @@ const conversionModal = () => {
typeName: "es CEC",
conversion: "Reveres conversion esCEC",
conversionName: "CEC",
+ amount: stakingStore.cecInfoData.CecClaimable
+ }
+}
+
+const withdrawModal = () => {
+ cecDialogVisible.value = true
+ dialogUnstakeText.value = {
+ title: "Transformation esCEC",
+ typeLabel: "Transformation esCEC",
+ tips: "Conversion ESCEC require locking down a certain amount of CEC",
+ typeName: "es CEC",
+ conversion: "Reveres conversion esCEC",
+ conversionName: "CEC",
amount: '100'
}
}
+const collectionModal = () => {
+ cecDialogVisible.value = true
+ dialogUnstakeText.value = {
+ title: "Claim esCEC",
+ typeLabel: "Transformation esCEC",
+ tips: "Conversion ESCEC require locking down a certain amount of CEC",
+ typeName: "es CEC",
+ conversion: "Reveres conversion esCEC",
+ conversionName: "CEC",
+ amount: stakingStore.cecInfoData.CecClaimable
+ }
+}
+
const eventBtnName = (val) => {
if(val.title == 'Reverse conversion esCEC') {
cecDeposit(val.amount)
+ } else if(val.title == 'Transformation esCEC') {
+ cecWithdraw(val.amount)
+ } else if(val.title == 'Claim esCEC') {
+ claimCec()
}
}
@@ -122,6 +152,29 @@ const cecDeposit = async (_amount) => {
}
}
+// 取消转化
+const cecWithdraw = async (_amount) => {
+ let amount = BigInt(1 * 1e18)
+ console.log(amount)
+ // return
+ try {
+ let res = await bc.vester.withdraw()
+ console.log(res)
+ } catch (e) {
+ console.log(e)
+ }
+}
+
+// 领取
+const claimCec = async () => {
+ try {
+ let res = await bc.vester.claim()
+ console.log(res)
+ } catch (e) {
+ console.log(e)
+ }
+}
+
diff --git a/src/components/staking/header.vue b/src/components/staking/header.vue
index 9a72ee4..d78b19b 100644
--- a/src/components/staking/header.vue
+++ b/src/components/staking/header.vue
@@ -140,6 +140,7 @@ const cecInfoData = ref({
esCecConversion: BigInt("0"),
esCecCollection: BigInt("0"),
totalCollection: BigInt("0"),
+ CecClaimable: BigInt("0"),
});
/**
@@ -185,7 +186,7 @@ const getCecData = async () => {
// 锁定的cec 等于 转换中的esCec数量
cecInfoData.value.CecDisarm = cecInfoData.value.esCecConversion;
try {
- // cecInfoData.value.CecCollection = BigInt(await bc.vester.queryClaimable())
+ cecInfoData.value.CecClaimable = BigInt(await bc.vester.queryClaimable())
const stakeCecCollection = await bc.staking.queryClaimableByCEC();
const stakeEsCecCollection = await bc.staking.queryClaimableByEsCEC();
cecInfoData.value.CecCollection = BigInt(await bc.staking.queryClaimableByCEC());
diff --git a/src/components/staking/index.vue b/src/components/staking/index.vue
index cfed695..a076da1 100644
--- a/src/components/staking/index.vue
+++ b/src/components/staking/index.vue
@@ -197,7 +197,7 @@ const cecStakingText = () => {
title: "Stake CEC",
typeLabel: "Stake",
typeName: "CEC",
- amount: priceCalculated(stakingStore.cecInfoData.cecBalance)
+ amount: stakingStore.cecInfoData.cecBalance
}
}
@@ -207,7 +207,7 @@ const closeCecStakedText = () => {
title: "Unstake CEC",
typeLabel: "Unstake",
typeName: "CEC",
- amount: priceCalculated(stakingStore.cecInfoData.CecStaked)
+ amount: stakingStore.cecInfoData.CecStaked
}
}
@@ -217,7 +217,7 @@ const getCecCollectionText = () => {
title: "Income CEC",
typeLabel: "Income",
typeName: "CEC",
- amount: priceCalculated(stakingStore.cecInfoData.CecCollection)
+ amount: stakingStore.cecInfoData.CecCollection
}
}
// cec end
@@ -229,7 +229,7 @@ const esCecStakingText = () => {
title: "Stake esCEC",
typeLabel: "Stake",
typeName: "esCEC",
- amount: priceCalculated(stakingStore.cecInfoData.esCecBalance)
+ amount: stakingStore.cecInfoData.esCecBalance
}
}
@@ -239,7 +239,7 @@ const closeEsCecStakedText = () => {
title: "Unstake esCEC",
typeLabel: "Unstake",
typeName: "esCEC",
- amount: priceCalculated(stakingStore.cecInfoData.esCecStaked)
+ amount: stakingStore.cecInfoData.esCecStaked
}
}
@@ -249,7 +249,7 @@ const getEsCecCollectionText = () => {
title: "Income esCEC",
typeLabel: "Income",
typeName: "esCEC",
- amount: priceCalculated(stakingStore.cecInfoData.esCecCollection)
+ amount: stakingStore.cecInfoData.esCecCollection
}
}
diff --git a/src/store/staking.js b/src/store/staking.js
index 7a2001b..a00d538 100644
--- a/src/store/staking.js
+++ b/src/store/staking.js
@@ -14,6 +14,7 @@ export const useStakingStore = defineStore('staking', () => {
esCecConversion: BigInt('0'),
esCecCollection: BigInt('0'),
totalCollection: BigInt('0'),
+ CecClaimable: BigInt("0"),
})
const bindPassportAddress = ref([])