Comment

Comment by ssiddharth

In case you’re wondering what happened, from the thread:

He sent ETH to the WETH contract, received WETH as expected.

Then he wanted to do the reverse and sent WETH, but will not receive anything, because you're supposed to swap your WETH to ETH in exchanges like Uniswap, or call the "withdraw" function in the contract.

For contracts that want to only work with ERC-20 tokens, you use WETH, which comes from a contract that takes 1 eth and gives you 1 WETH.

A known problem with ERC-20 tokens is that transferring them to a contract that isn't made to access them is equivalent to burning them. You should almost never transfer ERC-20 to a smart contract. You instead use approve to give the smart contract permission to withdraw, then call the function you want to receive and tell it to make the withdraw (the contract will internally call transferFrom).

parent ssiddharth 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton