| replace mint with weth-pegged deposit and withdraw 92dc0c7 julienbrg 10h ago | 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.30; |
| 3 | |
| 4 | import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; |
| 5 | |
| add natspec 3cc0f3b julienbrg 10h ago | 6 | /// @title MockWETH |
| replace mint with weth-pegged deposit and withdraw 92dc0c7 julienbrg 10h ago | 7 | /// @notice Minimal stand-in for WETH9: wraps ETH 1:1, same 18 decimals, same |
| 8 | /// `deposit`/`withdraw` entrypoints. Test-only. |
| 9 | contract MockWETH is ERC20 { |
| 10 | constructor() ERC20("Wrapped Ether", "WETH") {} |
| 11 | |
| add natspec 3cc0f3b julienbrg 10h ago | 12 | /// @notice Wrap any ETH sent with no calldata. |
| replace mint with weth-pegged deposit and withdraw 92dc0c7 julienbrg 10h ago | 13 | receive() external payable { |
| 14 | deposit(); |
| 15 | } |
| 16 | |
| add natspec 3cc0f3b julienbrg 10h ago | 17 | /// @notice Wrap the ETH sent with this call, minting the same amount of wETH. |
| replace mint with weth-pegged deposit and withdraw 92dc0c7 julienbrg 10h ago | 18 | function deposit() public payable { |
| 19 | _mint(msg.sender, msg.value); |
| 20 | } |
| 21 | |
| add natspec 3cc0f3b julienbrg 10h ago | 22 | /// @notice Burn `amount` wETH and send the caller the same amount of ETH. |
| 23 | /// @param amount The wETH to unwrap, in wei. |
| replace mint with weth-pegged deposit and withdraw 92dc0c7 julienbrg 10h ago | 24 | function withdraw(uint256 amount) external { |
| 25 | _burn(msg.sender, amount); |
| 26 | payable(msg.sender).transfer(amount); |
| 27 | } |
| 28 | } |