0

I'm attempting to wrap ETH on Goerli into WETH by calling deposit function using ethers. Even though several TX already have been confirmed and successfully mined, nothing will appear on my WETH balance at goerli.etherscan.io in the dropdown Token Holdings. There's not even WETH there at all, whereas there're other tokens

  async function myWrap(prKey) {
    let wallet = new ethers.Wallet(prKey, provider);
    const contract = new ethers.Contract(WETH_CONTRACT_ADDRESS, WETH_ABI, wallet);
    const txSigner = contract.connect(wallet);

    const balance = await provider.getBalance(wallet.address);
    const gasPrice = await provider.getGasPrice();
    const balanceMinusGas = balance.sub(gasPrice.mul(ETH_GAS_LIMIT));

    let tx = txSigner.deposit({value: amountToSend});
    return tx;
  }

What's the matter?

Moreover, at https://goerli.etherscan.io/address/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 my TX-s are present.

1 Answer 1

1

The address you're using for WETH (0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) is the address on Ethereum mainnet. Notice on the goerli etherscan page for that address, there's no contract tab. That's because this isn't a smart contract, just a regular address. Attempting to deposit ETH to that address on Goerli will just transfer your Goerlie ETH to that wallet

The correct contract to use for WETH on Goerli is https://goerli.etherscan.io/token/0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6

2
  • How have you found out that 0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6 is the correct one on Goerli?
    – Camila326
    May 14 at 23:59
  • even with this address, no WETH will be transfered to my address. As if a step was missing in my code. What could it be?
    – Camila326
    May 15 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.