staking 授权
This commit is contained in:
parent
c976b7b5ce
commit
d000729ada
@ -35,11 +35,11 @@ export class ERC20 {
|
||||
return contract.allowance(owner, spender);
|
||||
}
|
||||
|
||||
async approve(tokenAddress, amount) {
|
||||
async approve(address, tokenAddress, amount) {
|
||||
const provider = this.bc.eoaProvider;
|
||||
this.bc.checkAndChangeChain(chainId, provider);
|
||||
const contract = new Contract(tokenAddress, erc20Abi, provider.getSigner());
|
||||
const tx = await contract.approve(amount);
|
||||
const tx = await contract.approve(address, amount);
|
||||
await tx.wait();
|
||||
return tx;
|
||||
}
|
||||
|
@ -138,8 +138,10 @@
|
||||
<script setup>
|
||||
import {ref} from "vue";
|
||||
import stakingDialog from "./cecDialog.vue"
|
||||
import { STAKING_ADDRESSES } from "@/configs/configchain"
|
||||
import { BlockChain } from "@/components/chain/BlockChain"
|
||||
const bc = new BlockChain();
|
||||
const chainId = parseInt(import.meta.env.VUE_APP_STAKING_CHAIN);
|
||||
const cecDialogVisible = ref(false)
|
||||
const handleClose = () => {
|
||||
cecDialogVisible.value = false
|
||||
@ -155,8 +157,13 @@ const dialogUnstakeText = ref({
|
||||
})
|
||||
|
||||
const unCecStaked = async () => {
|
||||
console.log((1*1e18).toString())
|
||||
let res = await bc.staking.stakeCec((1*1e18).toString())
|
||||
console.log(STAKING_ADDRESSES[chainId].stakedCecTracker,(1*1e18).toString())
|
||||
// try{
|
||||
let res = await bc.erc20.approve(STAKING_ADDRESSES[chainId].stakedCecTracker,(1*1e18).toString())
|
||||
// } catch (e) {
|
||||
// console.log(e)
|
||||
// }
|
||||
// let res = await bc.staking.stakeCec((1*1e18).toString())
|
||||
console.log(res)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user