So I am using Wagmi
, which uses Ethers.js
under the hood. I have to approve the router address first in order to buy the other token.
It works when I use the exact or slightly greater amount than what I send thru UI textbox. But it fails if I modify (into MetaMask popup textbox) the value close to my max balance.
For example. I have above 9000 mockBUSD and wanted to approve 50 of them for the router. If I use the default (50) or 500 mockBUSD (in the MetaMask popup textbox) transaction goes without any issue, and in the next step I can buy another token that is paired with mockBUSD. But if I modify the value to 6000 in the MetaMask popup, the transaction fails.
Here is txn that succeed - https://testnet.bscscan.com/tx/0x39deda5d7f7f0a91ce0481169d379eb7ba50c2d2827252d90986a3a972d23c48 (approved 2000 mockBUSD)
Here is another that fails - https://testnet.bscscan.com/tx/0x3820c27ac48d0be7a23d6cf884cc24dfea261e1639abb29c3061961016d3c264 (approved 6000 mockBUSD)
And I tried several times, and the outcomes were similar. What could be the reason for this weird issue?