5 ms·
Seems fishy to me when he says "I just sent ETH to the contract to get WETH" because this is assuredly not how it works. You have to call the `deposit` functio
by norswap 5y ago
Seems fishy to me when he says "I just sent ETH to the contract to get WETH" because this is assuredly not how it works.
You have to call the `deposit` function of the smart contract (transfering ETH with it indeed).
And to withdraw your WETH as ETH, you call `withdraw`.
These calls can be made from here (power user interface! not recommended - use Uniswap instead): https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#writeContract https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead...
The source code of the contract is here: https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#code https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead...
- conroydave 5y agoare you sure the deposit function isnt automatically called?
- norswap 5y agoIt is, see the comment of vmception above.
- vmception 5y agoThank you! Finally a code discussion here instead of all this pearl clutching hysteria. So, this is all about the ‘payable’ method, which means it is triggered by the native asset of the virtual machine. If you look closely you’ll see there is a default anonymous function with ‘payable’ accessor method which calls the deposit() method
- norswap 5y agoOh duh! Thanks for pointing that out, I forgot about that, and I really should have known better!