-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweth.sol
More file actions
35 lines (24 loc) · 840 Bytes
/
weth.sol
File metadata and controls
35 lines (24 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//SPDX-license-Identifier: MIT
pragma solidity 0.8.21;
contract WETH {
string public name = "Wrapped Ether";
string public symbol = "WETH";
uint public decimals =18:
event LogDeposit(address _src, address uint _amount);
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
construtor() {}
function deposit() public payable {
balanceOf[msg.sender] +=msg.value;
emit LogDeposit(msg.sender, msg.value);
}
function withdraw(uint _amount) public {
require(balanceOf[msg.sender] =< _amount,"not enough");
balanceOf[msg.sender] -= _amount;
payable(msg.sender).transfer(_amount);
emit LogWithdraw(msg.sender, _amount);
}
function totalySuppy() public view returns(uint) {
return address(this).balance;
}
}