-
Notifications
You must be signed in to change notification settings - Fork 0
/
tokenHard.sol
40 lines (30 loc) · 953 Bytes
/
tokenHard.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
34
35
36
37
38
39
40
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract tokenHard{
address private creator;
constructor(){
creator = msg.sender;
}
modifier onlyOwner(){
require(msg.sender == creator , "only owner can be able to mint");
_;
}
string public tokenName = "Nothing";
string public symbol = "NOT";
uint public supply = 0;
mapping(address => uint) public holders;
function getBalance(address toCheck) public view returns(uint){
return holders[toCheck];
}
function mint() public onlyOwner{
holders[creator] += 1;
supply += 1;
}
function transfer(address to, uint amount) public returns(bool){
require(holders[msg.sender]-amount>0, "Insufficient Balance");
require(to != address(0),"can't transfer to zero address");
holders[msg.sender] -= amount;
holders[to] += amount;
return true;
}
}