'Approve transaction with BUSD in dapp with ethers.js
I am creating daap able to mint smart contract with BUSD. However, transfer still fail. I figured out that my BNB allocation can not automatically pay thought BUSD. I need to BUSD allow to make transaction with my allocation. According to BUSD smart contract there is function provided for it -> function approve(address _spender, uint256 _value) public whenNotPaused returns (bool).
However I was not able to efficiently receive output from it. 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...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
