-
Notifications
You must be signed in to change notification settings - Fork 0
/
DefToken.sol
33 lines (26 loc) · 910 Bytes
/
DefToken.sol
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
pragma solidity ^0.8.0;
contract DeflationaryToken {
address owner;
mapping (address => uint256) public balanceOf;
uint256 public totalSupply;
event Transfer(address indexed from, address indexed to, uint256 value);
constructor() public {
owner = msg.sender;
balanceOf[owner] = 1000000;
totalSupply = 1000000;
}
function transfer(address to, uint256 value) public {
require(balanceOf[msg.sender] >= value);
require(value > 0);
balanceOf[msg.sender] -= value;
balanceOf[to] += value;
emit Transfer(msg.sender, to, value);
}
function burn(uint256 value) public {
require(balanceOf[msg.sender] >= value);
require(value > 0);
balanceOf[msg.sender] -= value;
totalSupply -= value;
emit Transfer(msg.sender, address(0), value);
}
}