质押cec
This commit is contained in:
parent
b71fe9c21e
commit
da3f90c391
@ -1,52 +1 @@
|
||||
[
|
||||
"constructor(string,string)",
|
||||
"event Approval(address indexed,address indexed,uint256)",
|
||||
"event Claim(address,uint256)",
|
||||
"event Transfer(address indexed,address indexed,uint256)",
|
||||
"function BASIS_POINTS_DIVISOR() view returns (uint256)",
|
||||
"function PRECISION() view returns (uint256)",
|
||||
"function allowance(address,address) view returns (uint256)",
|
||||
"function approve(address,uint256) returns (bool)",
|
||||
"function averageStakedAmounts(address) view returns (uint256)",
|
||||
"function balanceOf(address) view returns (uint256)",
|
||||
"function balances(address) view returns (uint256)",
|
||||
"function claim(address) returns (uint256)",
|
||||
"function claimForAccount(address,address) returns (uint256)",
|
||||
"function claimable(address) view returns (uint256)",
|
||||
"function claimableReward(address) view returns (uint256)",
|
||||
"function cumulativeRewardPerToken() view returns (uint256)",
|
||||
"function cumulativeRewards(address) view returns (uint256)",
|
||||
"function decimals() view returns (uint8)",
|
||||
"function depositBalances(address,address) view returns (uint256)",
|
||||
"function distributor() view returns (address)",
|
||||
"function gov() view returns (address)",
|
||||
"function inPrivateClaimingMode() view returns (bool)",
|
||||
"function inPrivateStakingMode() view returns (bool)",
|
||||
"function inPrivateTransferMode() view returns (bool)",
|
||||
"function initialize(address[],address)",
|
||||
"function isDepositToken(address) view returns (bool)",
|
||||
"function isHandler(address) view returns (bool)",
|
||||
"function isInitialized() view returns (bool)",
|
||||
"function name() view returns (string)",
|
||||
"function previousCumulatedRewardPerToken(address) view returns (uint256)",
|
||||
"function rewardToken() view returns (address)",
|
||||
"function setDepositToken(address,bool)",
|
||||
"function setGov(address)",
|
||||
"function setHandler(address,bool)",
|
||||
"function setInPrivateClaimingMode(bool)",
|
||||
"function setInPrivateStakingMode(bool)",
|
||||
"function setInPrivateTransferMode(bool)",
|
||||
"function stake(address,uint256)",
|
||||
"function stakeForAccount(address,address,address,uint256)",
|
||||
"function stakedAmounts(address) view returns (uint256)",
|
||||
"function symbol() view returns (string)",
|
||||
"function tokensPerInterval() view returns (uint256)",
|
||||
"function totalDepositSupply(address) view returns (uint256)",
|
||||
"function totalSupply() view returns (uint256)",
|
||||
"function transfer(address,uint256) returns (bool)",
|
||||
"function transferFrom(address,address,uint256) returns (bool)",
|
||||
"function unstake(address,uint256)",
|
||||
"function unstakeForAccount(address,address,uint256,address)",
|
||||
"function updateRewards()",
|
||||
"function withdrawToken(address,address,uint256)"
|
||||
]
|
||||
["constructor(string,string)","event Approval(address indexed,address indexed,uint256)","event Claim(address,uint256)","event Transfer(address indexed,address indexed,uint256)","function BASIS_POINTS_DIVISOR() view returns (uint256)","function PRECISION() view returns (uint256)","function allowance(address,address) view returns (uint256)","function approve(address,uint256) returns (bool)","function averageStakedAmounts(address) view returns (uint256)","function balanceOf(address) view returns (uint256)","function balances(address) view returns (uint256)","function claim(address) returns (uint256)","function claimForAccount(address,address) returns (uint256)","function claimable(address) view returns (uint256)","function claimableReward(address) view returns (uint256)","function cumulativeRewardPerToken() view returns (uint256)","function cumulativeRewards(address) view returns (uint256)","function decimals() view returns (uint8)","function depositBalances(address,address) view returns (uint256)","function distributor() view returns (address)","function gov() view returns (address)","function inPrivateClaimingMode() view returns (bool)","function inPrivateStakingMode() view returns (bool)","function inPrivateTransferMode() view returns (bool)","function initialize(address[],address)","function isDepositToken(address) view returns (bool)","function isHandler(address) view returns (bool)","function isInitialized() view returns (bool)","function name() view returns (string)","function previousCumulatedRewardPerToken(address) view returns (uint256)","function rewardToken() view returns (address)","function setDepositToken(address,bool)","function setGov(address)","function setHandler(address,bool)","function setInPrivateClaimingMode(bool)","function setInPrivateStakingMode(bool)","function setInPrivateTransferMode(bool)","function stake(address,uint256)","function stakeForAccount(address,address,address,uint256)","function stakedAmounts(address) view returns (uint256)","function symbol() view returns (string)","function tokensPerInterval() view returns (uint256)","function totalDepositSupply(address) view returns (uint256)","function totalSupply() view returns (uint256)","function transfer(address,uint256) returns (bool)","function transferFrom(address,address,uint256) returns (bool)","function unstake(address,uint256)","function unstakeForAccount(address,address,uint256,address)","function updateRewards()","function withdrawToken(address,address,uint256)"]
|
@ -259,7 +259,7 @@ const getEsCecCollectionText = () => {
|
||||
|
||||
// cec质押
|
||||
const cecStaked = async (_amount) => {
|
||||
const amount = BigInt(100 * 1e18)
|
||||
const amount = BigInt(_amount * 1e18)
|
||||
console.log(amount)
|
||||
// return
|
||||
loadingDialogVisible.value = true
|
||||
@ -289,20 +289,28 @@ const cecStaked = async (_amount) => {
|
||||
}
|
||||
|
||||
// 取消质押
|
||||
const closeStaked = async (type, amount) => {
|
||||
const closeStaked = async (type, _amount) => {
|
||||
let amount = BigInt(_amount * 1e18)
|
||||
loadingDialogVisible.value = true
|
||||
if(type == 'Unstake CEC') {
|
||||
try {
|
||||
let res = await bc.staking.unstakeCec(amount)
|
||||
console.log(res)
|
||||
loadingDialogVisible.value = false
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
loadingDialogVisible.value = false
|
||||
}
|
||||
} else if(type == 'esCec') {
|
||||
let res = await bc.staking.unstakeCec(amount)
|
||||
console.log(res)
|
||||
loadingDialogVisible.value = false
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
loadingDialogVisible.value = false
|
||||
}
|
||||
} else if(type == 'Unstake esCEC') {
|
||||
console.log(type)
|
||||
// TODO:
|
||||
try {
|
||||
let res = await bc.staking.unstakeEsCec(amount)
|
||||
console.log(res)
|
||||
loadingDialogVisible.value = false
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
loadingDialogVisible.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,8 +341,11 @@ const getCecCollection = async (type) => {
|
||||
}
|
||||
|
||||
// esCec 质押
|
||||
const esCecStaked = async () => {
|
||||
const amount = stakingStore.cecInfoData.esCecBalance
|
||||
const esCecStaked = async (_amount) => {
|
||||
// console.log(_amount)
|
||||
// return
|
||||
const amount = BigInt(_amount * 1e18)
|
||||
console.log(amount)
|
||||
loadingDialogVisible.value = true
|
||||
try{
|
||||
// let allow = await bc.erc20.allowance(STAKING_ADDRESSES[chainId].esCec, STAKING_ADDRESSES[chainId].stakedEsCecTracker)
|
||||
|
@ -52,7 +52,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref, toRaw, onMounted } from "vue";
|
||||
import Header from "@/components/staking/header.vue";
|
||||
import Staking from "@/components/staking/index.vue";
|
||||
import Conversion from "@/components/staking/conversion.vue";
|
||||
@ -80,9 +80,8 @@ const getLinkWallet = async () => {
|
||||
location.reload()
|
||||
};
|
||||
|
||||
const logOut = async () => {
|
||||
stakingStore.cecInfoData = {
|
||||
cecBalance: BigInt('0'),
|
||||
const cecInfoData = ref({
|
||||
cecBalance: BigInt('0'),
|
||||
CecStaked: BigInt('0'),
|
||||
CecDisarm: BigInt('0'),
|
||||
CecCollection: BigInt('0'),
|
||||
@ -91,7 +90,9 @@ const logOut = async () => {
|
||||
esCecConversion: BigInt('0'),
|
||||
esCecCollection: BigInt('0'),
|
||||
totalCollection: BigInt('0'),
|
||||
}
|
||||
})
|
||||
const logOut = async () => {
|
||||
stakingStore.cecInfoData = {}
|
||||
await new BlockChain().logout()
|
||||
location.reload()
|
||||
};
|
||||
@ -113,7 +114,10 @@ const toTwitter = () => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getNetId()
|
||||
console.log(toRaw(stakingStore.cecInfoData))
|
||||
if(localWalletStore.address) {
|
||||
getNetId()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user