I have a localhost Hardhat Network running but I need to convert Fake ETH on it into WETH. How can I do this?
1 Answer
I think the easiest way to do this is to create an ERC20 called WETH. Something like:
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract WETHToken is ERC20 {
constructor() ERC20("Wrapped ETHER", "WETH") {
_mint(<msg.sender or your address>, 9999 ether);
}
}
So when you npx hardhat node
, you'll have to deploy that contract.
-
I'm running off a fork of mainnet and need to use the actual WETH contract, so this wasn't an option for me.– erbCommented May 22 at 13:09