0

I'm trying to understand why these methods that contain the ETH are needed in some smart contracts like uniswap and pancakeswap, I check the code but it's not clear and I even call some of these methods and seem to achieve the same results (passing the corresponding arguments to each one)

When do you need to use each one?

1 Answer 1

1

On ethereum, you use ETH for paying for gas. The ETH asset is not an ERC20 token, which I believe is requirement to be able to use it in the smart contracts that uniswap and pancakeswap use. For this reason, wrapped ETH is used (WETH). When you want to buy or sell tokens to or from your native non-ERC20 ETH, you use these functions to convert to or from ETH.

Example: Swapping USDC>ETH is done through USDC>WETH>ETH. WETH is unwrapped into normal in the final step ETH. End result is you get ETH in your wallet instead of WETH.

1

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.