质押cec 转化、取消转化
This commit is contained in:
parent
4ae40fbd5f
commit
56b1fb19c3
@ -26,7 +26,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="left" @click="cecAmount">
|
<div class="left" @click="cecAmount">
|
||||||
<span>MAX: {{ props.dialogText.amount }}</span>
|
<span>MAX: {{ priceCalculated(props.dialogText.amount) }}</span>
|
||||||
<p>{{ props.dialogText.typeName }}</p>
|
<p>{{ props.dialogText.typeName }}</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@ -51,6 +51,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
|
import { priceCalculated } from "@/configs/priceCalculate"
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
cecDialogVisible: {
|
cecDialogVisible: {
|
||||||
@ -78,7 +79,7 @@ const eventBtn = () => {
|
|||||||
|
|
||||||
const modelAmount = ref(0)
|
const modelAmount = ref(0)
|
||||||
const cecAmount = () => {
|
const cecAmount = () => {
|
||||||
modelAmount.value = parseInt(props.dialogText.amount)
|
modelAmount.value = priceCalculated(props.dialogText.amount)
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -42,16 +42,16 @@
|
|||||||
<div class="logo">
|
<div class="logo">
|
||||||
<img src="@/assets/img/marketplace/CECIcon.png" alt="">
|
<img src="@/assets/img/marketplace/CECIcon.png" alt="">
|
||||||
</div>
|
</div>
|
||||||
<div class="amount">{{ priceCalculated(stakingStore.cecInfoData.esCecConversion) }}</div>
|
<div class="amount">{{ priceCalculated(stakingStore.cecInfoData.CecClaimable) }}</div>
|
||||||
<div class="btns">
|
<div class="btns">
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<span @click="conversionModal">Staking</span>
|
<span @click="conversionModal">Staking</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<span @click="cecDialogVisible = true">Disarm</span>
|
<span @click="withdrawModal">Disarm</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<span class="no">Collection</span>
|
<span class="no" @click="collectionModal">Collection</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -99,13 +99,43 @@ const conversionModal = () => {
|
|||||||
typeName: "es CEC",
|
typeName: "es CEC",
|
||||||
conversion: "Reveres conversion esCEC",
|
conversion: "Reveres conversion esCEC",
|
||||||
conversionName: "CEC",
|
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'
|
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) => {
|
const eventBtnName = (val) => {
|
||||||
if(val.title == 'Reverse conversion esCEC') {
|
if(val.title == 'Reverse conversion esCEC') {
|
||||||
cecDeposit(val.amount)
|
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>
|
</script>
|
||||||
|
|
||||||
|
@ -140,6 +140,7 @@ const cecInfoData = ref({
|
|||||||
esCecConversion: BigInt("0"),
|
esCecConversion: BigInt("0"),
|
||||||
esCecCollection: BigInt("0"),
|
esCecCollection: BigInt("0"),
|
||||||
totalCollection: BigInt("0"),
|
totalCollection: BigInt("0"),
|
||||||
|
CecClaimable: BigInt("0"),
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,7 +186,7 @@ const getCecData = async () => {
|
|||||||
// 锁定的cec 等于 转换中的esCec数量
|
// 锁定的cec 等于 转换中的esCec数量
|
||||||
cecInfoData.value.CecDisarm = cecInfoData.value.esCecConversion;
|
cecInfoData.value.CecDisarm = cecInfoData.value.esCecConversion;
|
||||||
try {
|
try {
|
||||||
// cecInfoData.value.CecCollection = BigInt(await bc.vester.queryClaimable())
|
cecInfoData.value.CecClaimable = BigInt(await bc.vester.queryClaimable())
|
||||||
const stakeCecCollection = await bc.staking.queryClaimableByCEC();
|
const stakeCecCollection = await bc.staking.queryClaimableByCEC();
|
||||||
const stakeEsCecCollection = await bc.staking.queryClaimableByEsCEC();
|
const stakeEsCecCollection = await bc.staking.queryClaimableByEsCEC();
|
||||||
cecInfoData.value.CecCollection = BigInt(await bc.staking.queryClaimableByCEC());
|
cecInfoData.value.CecCollection = BigInt(await bc.staking.queryClaimableByCEC());
|
||||||
|
@ -197,7 +197,7 @@ const cecStakingText = () => {
|
|||||||
title: "Stake CEC",
|
title: "Stake CEC",
|
||||||
typeLabel: "Stake",
|
typeLabel: "Stake",
|
||||||
typeName: "CEC",
|
typeName: "CEC",
|
||||||
amount: priceCalculated(stakingStore.cecInfoData.cecBalance)
|
amount: stakingStore.cecInfoData.cecBalance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ const closeCecStakedText = () => {
|
|||||||
title: "Unstake CEC",
|
title: "Unstake CEC",
|
||||||
typeLabel: "Unstake",
|
typeLabel: "Unstake",
|
||||||
typeName: "CEC",
|
typeName: "CEC",
|
||||||
amount: priceCalculated(stakingStore.cecInfoData.CecStaked)
|
amount: stakingStore.cecInfoData.CecStaked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ const getCecCollectionText = () => {
|
|||||||
title: "Income CEC",
|
title: "Income CEC",
|
||||||
typeLabel: "Income",
|
typeLabel: "Income",
|
||||||
typeName: "CEC",
|
typeName: "CEC",
|
||||||
amount: priceCalculated(stakingStore.cecInfoData.CecCollection)
|
amount: stakingStore.cecInfoData.CecCollection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cec end
|
// cec end
|
||||||
@ -229,7 +229,7 @@ const esCecStakingText = () => {
|
|||||||
title: "Stake esCEC",
|
title: "Stake esCEC",
|
||||||
typeLabel: "Stake",
|
typeLabel: "Stake",
|
||||||
typeName: "esCEC",
|
typeName: "esCEC",
|
||||||
amount: priceCalculated(stakingStore.cecInfoData.esCecBalance)
|
amount: stakingStore.cecInfoData.esCecBalance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ const closeEsCecStakedText = () => {
|
|||||||
title: "Unstake esCEC",
|
title: "Unstake esCEC",
|
||||||
typeLabel: "Unstake",
|
typeLabel: "Unstake",
|
||||||
typeName: "esCEC",
|
typeName: "esCEC",
|
||||||
amount: priceCalculated(stakingStore.cecInfoData.esCecStaked)
|
amount: stakingStore.cecInfoData.esCecStaked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ const getEsCecCollectionText = () => {
|
|||||||
title: "Income esCEC",
|
title: "Income esCEC",
|
||||||
typeLabel: "Income",
|
typeLabel: "Income",
|
||||||
typeName: "esCEC",
|
typeName: "esCEC",
|
||||||
amount: priceCalculated(stakingStore.cecInfoData.esCecCollection)
|
amount: stakingStore.cecInfoData.esCecCollection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ export const useStakingStore = defineStore('staking', () => {
|
|||||||
esCecConversion: BigInt('0'),
|
esCecConversion: BigInt('0'),
|
||||||
esCecCollection: BigInt('0'),
|
esCecCollection: BigInt('0'),
|
||||||
totalCollection: BigInt('0'),
|
totalCollection: BigInt('0'),
|
||||||
|
CecClaimable: BigInt("0"),
|
||||||
})
|
})
|
||||||
const bindPassportAddress = ref([])
|
const bindPassportAddress = ref([])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user