0

what function in a smart contract is responsible for this?

In the documentation of Uniswap I've found only one reference to what I might be looking -- https://docs.uniswap.org/contracts/universal-router/technical-reference#wrap_eth

However, how to used and implement this in ethers or web3.js?

1 Answer 1

1

Here's the deposit method:

https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#writeContract#F5

After calling deposit method, the caller will received WETH equal to the ETH amount paid to the contract.

As usual, double-check and triple-check the contract is actually authentic.

How to interact with contract in ethers.js or web3.js should already be covered in their documentation.

4
  • After calling deposit method, the caller will received WETH equal to the ETH amount paid to the contract. --> where have you gotten this information from? Where is it written?
    – Camila326
    Commented May 12, 2023 at 20:59
  • You can go to info.uniswap.org and check on ETH token, which is actually WETH. In that page, there is a link to etherscan.io. The token was not created by Ethereum Foundation so there's no documentation on their site, so it is like de-facto standard that people use the specified contract as WETH.
    – tia
    Commented May 13, 2023 at 11:57
  • Alright. But why does it not work on Goerli? Although it exists there
    – Camila326
    Commented May 14, 2023 at 21:32
  • There is a WETH contract on Goerli at a different address (I just googled it). Noted that on Testnet you might use whichever equivalent WETH contract you want for testing, as long as it works the same as the WETH contract on mainnet.
    – tia
    Commented May 15, 2023 at 7:15

Your Answer

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

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