I'm testing a simple example of flash swap v3 on a mainnet fork using Ganache and Truffle.

All tests passed successfully except the "swap" function executed on the UniswapV3Pool.

Before reaching my callback's code, the swap function in the Pool performs a SafeTransfer to my contract's address. In my test, I'm using the Pool WETH/DAI, fee 3000.

I'm trying to ask 1000 DAI from the pool, so I'm passing value '0' for WETH (token0) and '1000000000000000000000' for DAI (token1).

My callback is not even called, since it fails when attempting to transfer DAIs to my contract and from Ganache logs I get this error:

  Transaction: 0x83c30d89004ea7f768f2207af91e47f376b693867e4ac9d83a001f35e6bcf851
  Gas usage: 89447
  Block number: 14540211
  Block time: Thu Apr 07 2022 20:08:55 GMT+0200 (Central European Summer Time)
  Runtime error: revert
  Revert reason: TF

I verified the correct address of my contract (recipient of the transfer).

I also tried to execute a SafeTransfer to the same contract creating a test contract and it works.

What could be the reason why UniswapV3Pool fails sending tokens to my contract?

I cannot find more info about it, so I hope you guys might give me a different point of view in finding a solution.

Thanks in advance!

  • if you console log all the values that you are sending and after validating that everything is intact, still get the revert message, try changing the pairs on fork chain, that might work and it does, you might as well try testing onchain, sometimes, fork chains behave wired.
    – Prosperity
    Commented Mar 11 at 11:39

2 Answers 2


I assume you used the Uniswap's documentation example on Implementing a FlashSwap found here.

You might have not approved sufficient amounts needed to perform the FlashLoan. If this is not the issue, you could post a call trace of your transaction to debug better.

PS: I am currently having some errors like yours when performing the same task and solving them (little) steps by step.


I think the issue is that the you dont have enough tokens to cover the fees. So, it reverts. The flashswap can only work when you have enough funds to cover fees.

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.