质押cec 转化、取消转化
This commit is contained in:
parent
4ae40fbd5f
commit
56b1fb19c3
@ -26,7 +26,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="left" @click="cecAmount">
|
||||
<span>MAX: {{ props.dialogText.amount }}</span>
|
||||
<span>MAX: {{ priceCalculated(props.dialogText.amount) }}</span>
|
||||
<p>{{ props.dialogText.typeName }}</p>
|
||||
</div>
|
||||
</li>
|
||||
@ -51,6 +51,7 @@
|
||||
|
||||
<script setup>
|
||||
import {ref} from "vue";
|
||||
import { priceCalculated } from "@/configs/priceCalculate"
|
||||
|
||||
const props = defineProps({
|
||||
cecDialogVisible: {
|
||||
@ -78,7 +79,7 @@ const eventBtn = () => {
|
||||
|
||||
const modelAmount = ref(0)
|
||||
const cecAmount = () => {
|
||||
modelAmount.value = parseInt(props.dialogText.amount)
|
||||
modelAmount.value = priceCalculated(props.dialogText.amount)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -42,16 +42,16 @@
|
||||
<div class="logo">
|
||||
<img src="@/assets/img/marketplace/CECIcon.png" alt="">
|
||||
</div>
|
||||
<div class="amount">{{ priceCalculated(stakingStore.cecInfoData.esCecConversion) }}</div>
|
||||
<div class="amount">{{ priceCalculated(stakingStore.cecInfoData.CecClaimable) }}</div>
|
||||
<div class="btns">
|
||||
<div class="btn">
|
||||
<span @click="conversionModal">Staking</span>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<span @click="cecDialogVisible = true">Disarm</span>
|
||||
<span @click="withdrawModal">Disarm</span>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<span class="no">Collection</span>
|
||||
<span class="no" @click="collectionModal">Collection</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ export const useStakingStore = defineStore('staking', () => {
|
||||
esCecConversion: BigInt('0'),
|
||||
esCecCollection: BigInt('0'),
|
||||
totalCollection: BigInt('0'),
|
||||
CecClaimable: BigInt("0"),
|
||||
})
|
||||
const bindPassportAddress = ref([])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user