0

Let's suppose here are 2 EOA(A and B) and 1 contract. A has no token, B has 10token(erc20).

  1. A approve B to spend 10token(do not consider gas)
  2. B execute 2 functions in turn following via contract in single TX
    • transfer 10token to A
    • transferfrom A to B 10token

Is this logic possible? If not, how can I make it? The point is step2 should be made in single TX.

  • 1
    No, this isn't possible directly from an externally owned account. Either the token contract would have to support such an operation or a second smart contract would have to be used as an intermediary to run both functions as part of the same transaction. – user19510 May 22 at 2:33
  • The contract above is not token contract but a smart contract as an intermediary – yseek May 22 at 2:38
  • It might help if you explained what you're actually trying to do. The steps you listed don't make a lot of sense, as the net result would be to leave all the tokens where they started. – user19510 May 22 at 2:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.