Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
Using swapExactTokensForTokens we get TRANSFER_FROM_FAILED error

We are trying to "swapExactTokensforTokens" for swapping any token, and it runs well, but we get this error at the blockchain:

TRANSFER_FROM_FAILED

https://polygonscan.com/tx/0xf584e421990628131b92b22b2aad270e91752287817eeb518a4d9bdb4b37d086

When we use "swapETHForExactTokens" it makes the trade, but can only use MATIC/ETH/BNB as token1, and we want to trade any tokens. Do you know how to solve this?

CODE: (we are not approving contracts in code before, but we are approving them at polygonscan).

const tx = await router.swapExactTokensForTokens(
        amountIn,
        amountOutMin,
        [tokenIn, tokenOut],
        data.recipient,
        Date.now() + 1000 * 60 * 5, //5 minutes
        {
          'gasLimit': data.gasLimit,
          'gasPrice': data.gasPrice
      });

Thanks!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!