tornado-nova/contracts/Mocks/WETH.sol

20 lines
544 B
Solidity
Raw Normal View History

2022-01-22 01:21:34 +01:00
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract WETH is ERC20 {
2022-01-22 01:23:33 +01:00
constructor(string memory name, string memory ticker) ERC20(name, ticker) {}
2022-01-22 01:21:34 +01:00
function deposit() external payable {
_mint(msg.sender, msg.value);
}
function withdraw(uint256 value) external {
2022-01-22 01:23:33 +01:00
_burn(msg.sender, value);
(bool success, ) = msg.sender.call{ value: value }("");
2022-01-22 01:21:34 +01:00
require(success, "WETH: ETH transfer failed");
}
}