forked from filterswap/filterswap-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSieveToken.sol
More file actions
54 lines (43 loc) · 1.69 KB
/
Copy pathSieveToken.sol
File metadata and controls
54 lines (43 loc) · 1.69 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8;
contract SieveToken {
string public name = "Sieve Token";
string public symbol = "SIEVE";
uint public totalSupply = 1000000;
uint8 public decimals = 18;
address private owner;
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
constructor() {
owner = msg.sender;
totalSupply = totalSupply * (10 ** decimals);
balanceOf[owner] = totalSupply;
emit Transfer(address(0), owner, balanceOf[owner]);
}
function getOwner() external view returns (address) {
return owner;
}
function transfer(address _to, uint _value) external returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
function approve(address _spender, uint _value) external returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function transferFrom(address _from, address _to, uint _value) external returns (bool success) {
require(_value <= balanceOf[_from]);
require(_value <= allowance[_from][msg.sender]);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
allowance[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
}
}