0

I noticed that swapping some tokens in Uniswap to exactly the same amount of ETH, at the same time, has much higher gas fees than other tokens. Why is this? Aren't the swap transactions identical for all tokens?

1
  • 3
    A swap involves invoking the token contracts. Each contract has its own implementation so token transfers might have different costs.
    – Ismael
    Jan 10, 2021 at 16:13

2 Answers 2

3

I noticed that swapping some tokens in Uniswap to exactly the same amount of ETH, at the same time, has much higher gas fees than other tokens. Why is this? Aren't the swap transactions identical for all tokens?

Some token transfer() function has more instructions (if clauses) than others.

Plus it also depends on if the Ethereum Virtual Machine storage can be freed after the transfer (balances goes to zero or from zero).

More information about the EVM storage and token transfers here.

2

They override the transfer function and do different logic on them.

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.