[SOLVED] WETH Deposit Function on a Forked Mainnet?


This Content is from Stack Overflow. Question asked by Dee239

I would like to use the “deposit” function for WETH using ethers js to convert ETH to WETH. I have something like this…

const weth_abi = [abi here]
const weth_address = ‘address_here’

const weth_contract = new web3.eth.Contract(JSON.parse(weth_abi), weth_address)

const transaction = await weth_contract.deposit(‘0xF8d81717b5cA83Dbcfc6666Cd579bb4253eFca5f’, { value: ethers.utils.parseEther(“1”) })

Could someone please help me with this? I am getting an error “unexpected parameters, expected 0 but got 1”.


I got it to work, I didn’t have the forked node running. Thank you for your help!

This Question was asked in StackOverflow by Dee239 and Answered by Dee239 It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?