[英]Approve transaction with BUSD in dapp with ethers.js
I am creating daap able to mint smart contract with BUSD.我正在创建能够与 BUSD 建立智能合约的 daap。 However, transfer still fail.
但是,传输仍然失败。 I figured out that my BNB allocation can not automatically pay thought BUSD.
我发现我的 BNB 分配不能自动支付思想 BUSD。 I need to BUSD allow to make transaction with my allocation.
我需要 BUSD 允许使用我的分配进行交易。 According to BUSD smart contract there is function provided for it -> function approve(address _spender, uint256 _value) public whenNotPaused returns (bool).
根据 BUSD 智能合约,提供了 function -> function approve(address _spender, uint256 _value) public whenNotPaused returns (bool)。
However I was not able to efficiently receive output from it.但是我无法从中有效地接收到 output。 I have tried to connect to transfer and receive data but without success.
我尝试连接以传输和接收数据但没有成功。
async approveBUSD(wallet, address, price) {
let contract = new ethers.Contract(this.busd, busdAbi, this.provider);
this.busdContract.on('Transfer',(from,to, value,event)=>{
console.log({
from: from,
to:to ,
value:value.toNumber(),
data: event
});
});
}
Any suggestion?有什么建议吗? Thanks...
谢谢...
busdContract.approve(contractAddress, amount)
.then((txHash) => {
alert(txHash);
localStorage.setItem("txHash", txHash);
resolve(true);
})
.catch((error) => {
alert(error);
resolve(false);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.