julien/lovepublic Fork 0
3cc0f3b8ce3eedfacdb7d55793fef3cdf53e13f7
Commits
Clone
git clone https://git.rickub.com/julien/love.git
git clone ssh://git@rickub.com/julien/love.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

MockWETH.sol · 28 lines · 911 BSolidity Blame HistoryRaw
replace mint with weth-pegged deposit and withdraw 92dc0c7 julienbrg 10h ago1// SPDX-License-Identifier: MIT
2pragma solidity ^0.8.30;
3
4import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5
add natspec 3cc0f3b julienbrg 10h ago6/// @title MockWETH
replace mint with weth-pegged deposit and withdraw 92dc0c7 julienbrg 10h ago7/// @notice Minimal stand-in for WETH9: wraps ETH 1:1, same 18 decimals, same
8/// `deposit`/`withdraw` entrypoints. Test-only.
9contract MockWETH is ERC20 {
10 constructor() ERC20("Wrapped Ether", "WETH") {}
11
add natspec 3cc0f3b julienbrg 10h ago12 /// @notice Wrap any ETH sent with no calldata.
replace mint with weth-pegged deposit and withdraw 92dc0c7 julienbrg 10h ago13 receive() external payable {
14 deposit();
15 }
16
add natspec 3cc0f3b julienbrg 10h ago17 /// @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 ago18 function deposit() public payable {
19 _mint(msg.sender, msg.value);
20 }
21
add natspec 3cc0f3b julienbrg 10h ago22 /// @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 ago24 function withdraw(uint256 amount) external {
25 _burn(msg.sender, amount);
26 payable(msg.sender).transfer(amount);
27 }
28}