2023-05-15

Wrapping ETH into WETH via ethers -- WETH coins on my balance won't appear

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. No is there 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: balanceMinusGas});
    return tx;
  }

What's the matter?

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

update1

Additionally, I then have tried to call

let amount = ethers.utils.parseEther(<sum of all previous ETH-s transfers>);
contract.transfer(wallet.address, amount);

yet, to no avail



No comments:

Post a Comment