调整cec stake流程
This commit is contained in:
parent
d2443a055a
commit
e7e838253e
@ -30,7 +30,9 @@ export class ERC20 {
|
|||||||
return contract.balanceOf(address);
|
return contract.balanceOf(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
async allowance(provider, tokenAddress, owner, spender) {
|
async allowance(tokenAddress, spender) {
|
||||||
|
const provider = this.bc.eoaProvider;
|
||||||
|
const owner = provider.getSigner().getAddress();
|
||||||
const contract = new Contract(tokenAddress, erc20Abi, provider.getSigner());
|
const contract = new Contract(tokenAddress, erc20Abi, provider.getSigner());
|
||||||
return contract.allowance(owner, spender);
|
return contract.allowance(owner, spender);
|
||||||
}
|
}
|
||||||
|
@ -176,6 +176,7 @@ const getCecData = async () => {
|
|||||||
// esCecConversion: 0,
|
// esCecConversion: 0,
|
||||||
// esCecCollection: 0,
|
// esCecCollection: 0,
|
||||||
let address = localWalletStore.address
|
let address = localWalletStore.address
|
||||||
|
if (!address) return
|
||||||
let timer = setInterval( async () => {
|
let timer = setInterval( async () => {
|
||||||
cecInfoData.value.cecBalance = parseInt(await bc.erc20.balanceOf(address)).toString()
|
cecInfoData.value.cecBalance = parseInt(await bc.erc20.balanceOf(address)).toString()
|
||||||
cecInfoData.value.esCecBalance = parseInt(await bc.erc20.esCecBalanceOf(address)).toString()
|
cecInfoData.value.esCecBalance = parseInt(await bc.erc20.esCecBalanceOf(address)).toString()
|
||||||
|
@ -162,14 +162,22 @@ const dialogUnstakeText = ref({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const unCecStaked = async () => {
|
const unCecStaked = async () => {
|
||||||
console.log(localWalletStore.address, STAKING_ADDRESSES[chainId].stakedCecTracker,(1*1e18).toString())
|
const amount = BigInt(1 * 1e18)
|
||||||
// try{
|
console.log(localWalletStore.address, STAKING_ADDRESSES[chainId].cec, (1*1e18).toString())
|
||||||
// let res = await bc.erc20.approve(localWalletStore.address, STAKING_ADDRESSES[chainId].stakedCecTracker,(1*1e18).toString())
|
try{
|
||||||
// } catch (e) {
|
let allow = await bc.erc20.allowance(STAKING_ADDRESSES[chainId].cec, STAKING_ADDRESSES[chainId].stakedCecTracker)
|
||||||
// console.log(e)
|
allow = BigInt(allow)
|
||||||
// }
|
if (allow < amount) {
|
||||||
let res = await bc.staking.stakeCec((1*1e18).toString())
|
console.log('not enough allowance')
|
||||||
console.log(res)
|
let res = await bc.erc20.approve(STAKING_ADDRESSES[chainId].stakedCecTracker, STAKING_ADDRESSES[chainId].cec, amount)
|
||||||
|
await res.wait()
|
||||||
|
}
|
||||||
|
let res2 = await bc.staking.stakeCec(amount)
|
||||||
|
console.log(res2)
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -108,12 +108,12 @@ export const STAKING_ADDRESSES = {
|
|||||||
cec: '0xfa1223747bae6d519580c53Cbb9C11a45b13c6b7',
|
cec: '0xfa1223747bae6d519580c53Cbb9C11a45b13c6b7',
|
||||||
esCec: '0x1FbA3F84e62163069050f1156b73C008722136A3',
|
esCec: '0x1FbA3F84e62163069050f1156b73C008722136A3',
|
||||||
vester: '0x41a7f94f0B3b615F84c7084F45556FEf1bd18A18',
|
vester: '0x41a7f94f0B3b615F84c7084F45556FEf1bd18A18',
|
||||||
stakedCecRouter: '0xE9AFdA5939023a7B4104931030a32CFAC99f4af8',
|
stakedCecRouter: '0x576c3D53c6d4A19471E216c06945d41EC39f6014',
|
||||||
stakedCecTracker: '0x18B41FbA9E096bc3E0A1F6aa92617B819Df6A602',
|
stakedCecTracker: '0x7554e677fF63212264db26dc743c67C277f219d2',
|
||||||
stakedCecDistributor: '0xA4f4452b4B91C27B84275ebcfBCca1c277FFA15b',
|
stakedCecDistributor: '0x53153a177F4483b53b3f732Ff63eeB48c6FE89E5',
|
||||||
stakedEsCecRouter: '0x2B656F1c485913577461e06bbf5adC999BC7743B',
|
stakedEsCecRouter: '0x19934736a578527cF725a33201445166Cbb62e52',
|
||||||
stakedEsCecTracker: '0x9679DE719eCe856Fe40E1f68C5ed48b344181035',
|
stakedEsCecTracker: '0x30cd668d0f280C404aD504bFf5d7a3Bf535f2A92',
|
||||||
stakedEsCecDistributor: '0x11440cE5a7d6a1e6fa1e9fd790EBa93476F0DeA0',
|
stakedEsCecDistributor: '0x6Ee091c2c242470f4f6D3d55604e1a66c6FF4ff5',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user