0

I want to swap bep20 tokens like BUSD - BNB and BNB - BUSD, i already approved tokens for the swapping but while i try to swap BNB - BUSD it's throw error like

BEP20: transfer amount exceeds allowance

i m using 0x api for the swap tokens . any one can help me for this issue ?

3
  • Can you share more details? Oct 20, 2021 at 14:56
  • now my code is worked but mejor issue is, transaction pushed to binance chain but when i open transaction hash , the transaction was failed and transaction fee deducted from my address
    – Dharmesh
    Oct 22, 2021 at 12:44
  • you forgot to say that it's your own token most likely. and it hasn't allowance management Dec 4, 2021 at 16:41

1 Answer 1

0

Did you use your contract that you code to swap? If right and if you used the function transferFrom of IERC20 to do that, you should try use the function "transfer" instead of transferFrom. Because you want get token from contract to wallet, you must use function transfer of IERC20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.