• Mizokon [none/use name]
    ·
    edit-2
    3 years ago

    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. I think a big part of the confusion is in the fact that the deposit function is called automatically when you send ETH, and withdraw isn't.

    :jesse-wtf: I have used crypto for buying stuff in the past but what the fuck is this :wtf-am-i-reading:

    • UlyssesT
      ·
      edit-2
      1 month ago

      deleted by creator

    • frick [they/them]
      ·
      3 years ago

      this actually points to a horrifying oversight in the smart contract design. For some context a smart contract is a program that runs on a blockchain. It has its own account that nobody can access depending on how it's been programmed. By default there is a function that gets called when someone sends cryptocurrency to the smart contract, and apparently in this case it will return an equivalent amount of "WETH" for the amount of "ETH" transferred. But the inverse isn't true. To get your "ETH" back you have to call a specific function called "withdraw".

      ERC-20 Tokens are smart contracts that just keep a record of accounts that knows who has what balance. It's not a "real" token in the same sense of Ethereum or Bitcoin. When you transfer an ERC-20 token you have to tell the smart contract you are transferring X amount to Y address and it records that transaction and your balances are subesequently updated.

      So what is apparently happening here is people are transferring WETH to the address of the smart contract and the smart contract treats that as a normal transaction between third parties. There is no special logic. The smart contract has no way of actually transferring that money back to people. The only way it can transfer you WETH tokens is by sending it ETH. The only way it can transfer you ETH tokens is by calling "withdraw". Transferring means that money is on its books under its own account permanently.

      • Mizokon [none/use name]
        ·
        3 years ago

        Wow, regular crypto's "If you send money to wrong address you won't get it back" sounds normal compared to that

      • Woly [any]
        ·
        edit-2
        3 years ago

        So where did the half a million worth of Ethereum actually end up, and why were they transferring it there in the first place?

        Is it just sitting in this smart account, unaccessible until the end of time? Or did it end up in another person's wallet?

        • frick [they/them]
          ·
          3 years ago

          I think they expected it to work like when they transferred the ethereum there. And the half a million worth of ETH is now in the smart contract's account as a positive balance forever.

          If I'm reading the comments right the way it works is you transfer your eth to the smart contract and it puts the equivalent amount of wETH in your account on its books. So say I transfer 10 ETH to it, it says "ok now frick owns 10 WETH". Now I can transfer that to other people or whatever and every time there's a transaction it gets recorded by the smart contract.

          So now I want to trade in my WETH for ETH because I want to exchange it for Real Money Baybee. Naturally I just transfer my WETH to the smart contract and get the ETH back because that's how it worked the first time around right? Wrong. I transfer my WETH to the smart contract and the smart contract goes "Oh cool now WETH Smart Contract owns 10 WETH and frick owns 0".

    • dualmindblade [he/him]
      ·
      3 years ago

      Generally you interact with a smart contract by "calling methods", just like a normal API in any computer system. This one has a feature where you can get what you want (the contract will report you have a certain # of wETH) just by transferring ETH to it. It's much more efficient this way because transferring the native ETH token is the cheapest type of transaction, it's like a couple of bucks right now vs 50 or more. But a smart contract is just code, it can only take actions that were built in before hand. In this case, apparently, there's no method to call that would transfer erc-20 tokens back to address they came from, actually that would be possible and as far as I understand wouldn't result in extra gas costs for other transactions, although it would be more expensive to deploy, anyway probably a good idea overall but as they say hindsight is erc-20.

      This system is not user friendly and mistakes cannot be undone, even the creator of smart contracts still does things like quadruple checking all the stuff in his transactions and doing performing actions with tiny amounts of tokens before the full amount (costing double tx fees) even when he's 99.99% sure they're fine. This is pretty much necessary, no way around it for a maximally decentralized computer system, you have to agree to the rules before hand and stick to them 100%. You can make the rules more forgiving to mistakes but you have to anticipate these mistakes before you deploy your code.

    • NuraShiny [any]
      ·
      3 years ago

      This is tech bros who think they are hot shit coding anything.

    • Omega_Haxors [they/them]
      ·
      3 years ago

      Politics aside (because my curiosity is overtaking my contempt for users of crypto) what the hell can you even buy with the stuff?