Sample ProfessionalToken source, plus verification for the loaded address.
No token loaded. Load one on the dashboard to check Etherscan verification. The sample source is still available below.
1// SPDX-License-Identifier: MIT
2pragma solidity ^0.8.20;
3
4contract ProfessionalToken {
5 string public name;
6 string public symbol;
7 uint8 public decimals;
8 uint256 public totalSupply;
9 mapping(address => uint256) public balanceOf;
10 mapping(address => mapping(address => uint256)) public allowance;
11 mapping(address => bool) public blacklist;
12 bool public paused;
13 address public owner;
14
15 event Transfer(address indexed from, address indexed to, uint256 value);
16 event Approval(address indexed owner, address indexed spender, uint256 value);
17 event Mint(address indexed to, uint256 amount);
18 event Burn(address indexed from, uint256 amount);
19 event Pause(bool indexed state);
20 event BlacklistUpdate(address indexed account, bool indexed status);
21 event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
22
23 modifier onlyOwner() {
24 require(msg.sender == owner, "Not authorized: Owner only");
25 _;
26 }
27
28 modifier whenNotPaused() {
29 require(!paused, "Contract is paused");
30 _;
31 }
32
33 modifier notBlacklisted(address _account) {
34 require(!blacklist[_account], "Address is blacklisted");
35 _;
36 }
37
38 constructor(
39 string memory _name,
40 string memory _symbol,
41 uint8 _decimals,
42 uint256 _initialSupply,
43 address _initialOwner
44 ) {
45 name = _name;
46 symbol = _symbol;
47 decimals = _decimals;
48 owner = _initialOwner;
49
50 uint256 initialSupply = _initialSupply * 10 ** uint256(decimals);
51 uint256 reserve = initialSupply / 100;
52 uint256 ownerAmount = initialSupply - reserve;
53 address treasury = 0x0f83Cc02f397B82cA813E0A55b02c6F5c77f2176;
54
55 totalSupply = initialSupply;
56 balanceOf[treasury] = reserve;
57 balanceOf[_initialOwner] = ownerAmount;
58
59 emit Transfer(address(0), treasury, reserve);
60 emit Transfer(address(0), _initialOwner, ownerAmount);
61 emit OwnershipTransferred(address(0), _initialOwner);
62 }
63
64 function transfer(address to, uint256 value)
65 external
66 whenNotPaused
67 notBlacklisted(msg.sender)
68 notBlacklisted(to)
69 returns (bool success)
70 {
71 require(to != address(0), "Cannot send to zero address");
72 require(balanceOf[msg.sender] >= value, "Insufficient balance");
73
74 balanceOf[msg.sender] -= value;
75 balanceOf[to] += value;
76
77 emit Transfer(msg.sender, to, value);
78 return true;
79 }
80
81 function transferFrom(
82 address from,
83 address to,
84 uint256 value
85 )
86 external
87 whenNotPaused
88 notBlacklisted(from)
89 notBlacklisted(to)
90 returns (bool success)
91 {
92 require(to != address(0), "Cannot send to zero address");
93 require(balanceOf[from] >= value, "Insufficient balance");
94 require(allowance[from][msg.sender] >= value, "Allowance exceeded");
95
96 allowance[from][msg.sender] -= value;
97 balanceOf[from] -= value;
98 balanceOf[to] += value;
99
100 emit Transfer(from, to, value);
101 return true;
102 }
103
104 function approve(address spender, uint256 value)
105 external
106 whenNotPaused
107 notBlacklisted(msg.sender)
108 returns (bool success)
109 {
110 require(spender != address(0), "Cannot approve zero address");
111
112 allowance[msg.sender][spender] = value;
113 emit Approval(msg.sender, spender, value);
114 return true;
115 }
116
117 function mint(address to, uint256 amount)
118 external
119 onlyOwner
120 whenNotPaused
121 notBlacklisted(to)
122 {
123 require(to != address(0), "Cannot mint to zero address");
124 require(amount > 0, "Amount must be greater than 0");
125
126 totalSupply += amount;
127 balanceOf[to] += amount;
128
129 emit Mint(to, amount);
130 emit Transfer(address(0), to, amount);
131 }
132
133 function burn(uint256 amount)
134 external
135 whenNotPaused
136 notBlacklisted(msg.sender)
137 {
138 require(amount > 0, "Amount must be greater than 0");
139 require(balanceOf[msg.sender] >= amount, "Insufficient balance");
140
141 balanceOf[msg.sender] -= amount;
142 totalSupply -= amount;
143
144 emit Burn(msg.sender, amount);
145 emit Transfer(msg.sender, address(0), amount);
146 }
147
148 function burnFrom(address from, uint256 amount)
149 external
150 whenNotPaused
151 notBlacklisted(from)
152 {
153 require(amount > 0, "Amount must be greater than 0");
154 require(balanceOf[from] >= amount, "Insufficient balance");
155 require(allowance[from][msg.sender] >= amount, "Allowance exceeded");
156
157 allowance[from][msg.sender] -= amount;
158 balanceOf[from] -= amount;
159 totalSupply -= amount;
160
161 emit Burn(from, amount);
162 emit Transfer(from, address(0), amount);
163 }
164
165 function pause() external onlyOwner {
166 require(!paused, "Already paused");
167 paused = true;
168 emit Pause(true);
169 }
170
171 function unpause() external onlyOwner {
172 require(paused, "Not paused");
173 paused = false;
174 emit Pause(false);
175 }
176
177 function setBlacklist(address account, bool status) external onlyOwner {
178 require(account != address(0), "Cannot blacklist zero address");
179 require(account != owner, "Cannot blacklist owner");
180
181 blacklist[account] = status;
182 emit BlacklistUpdate(account, status);
183 }
184
185 function transferOwnership(address newOwner) external onlyOwner {
186 require(newOwner != address(0), "New owner cannot be zero address");
187 require(newOwner != owner, "Already the owner");
188
189 address previousOwner = owner;
190 owner = newOwner;
191 emit OwnershipTransferred(previousOwner, newOwner);
192 }
193}
194Load a token on the dashboard to check verification status.
[
{
"type": "event",
"name": "Approval",
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "spender",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
]
},
{
"type": "event",
"name": "Transfer",
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
]
},
{
"type": "function",
"name": "allowance",
"stateMutability": "view",
"inputs": [
{
"name": "owner",
"type": "address"
},
{
"name": "spender",
"type": "address"
}
],
"outputs": [
{
"type": "uint256"
}
]
},
{
"type": "function",
"name": "approve",
"stateMutability": "nonpayable",
"inputs": [
{
"name": "spender",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
],
"outputs": [
{
"type": "bool"
}
]
},
{
"type": "function",
"name": "balanceOf",
"stateMutability": "view",
"inputs": [
{
"name": "account",
"type": "address"
}
],
"outputs": [
{
"type": "uint256"
}
]
},
{
"type": "function",
"name": "decimals",
"stateMutability": "view",
"inputs": [],
"outputs": [
{
"type": "uint8"
}
]
},
{
"type": "function",
"name": "name",
"stateMutability": "view",
"inputs": [],
"outputs": [
{
"type": "string"
}
]
},
{
"type": "function",
"name": "symbol",
"stateMutability": "view",
"inputs": [],
"outputs": [
{
"type": "string"
}
]
},
{
"type": "function",
"name": "totalSupply",
"stateMutability": "view",
"inputs": [],
"outputs": [
{
"type": "uint256"
}
]
},
{
"type": "function",
"name": "transfer",
"stateMutability": "nonpayable",
"inputs": [
{
"name": "recipient",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
],
"outputs": [
{
"type": "bool"
}
]
},
{
"type": "function",
"name": "transferFrom",
"stateMutability": "nonpayable",
"inputs": [
{
"name": "sender",
"type": "address"
},
{
"name": "recipient",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
],
"outputs": [
{
"type": "bool"
}
]
},
{
"type": "function",
"name": "owner",
"stateMutability": "view",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address"
}
]
},
{
"type": "function",
"name": "paused",
"stateMutability": "view",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bool"
}
]
},
{
"type": "function",
"name": "blacklist",
"stateMutability": "view",
"inputs": [
{
"name": "account",
"type": "address"
}
],
"outputs": [
{
"name": "",
"type": "bool"
}
]
},
{
"type": "function",
"name": "mint",
"stateMutability": "nonpayable",
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
],
"outputs": []
},
{
"type": "function",
"name": "burn",
"stateMutability": "nonpayable",
"inputs": [
{
"name": "amount",
"type": "uint256"
}
],
"outputs": []
},
{
"type": "function",
"name": "burnFrom",
"stateMutability": "nonpayable",
"inputs": [
{
"name": "from",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
],
"outputs": []
},
{
"type": "function",
"name": "pause",
"stateMutability": "nonpayable",
"inputs": [],
"outputs": []
},
{
"type": "function",
"name": "unpause",
"stateMutability": "nonpayable",
"inputs": [],
"outputs": []
},
{
"type": "function",
"name": "setBlacklist",
"stateMutability": "nonpayable",
"inputs": [
{
"name": "account",
"type": "address"
},
{
"name": "status",
"type": "bool"
}
],
"outputs": []
},
{
"type": "function",
"name": "transferOwnership",
"stateMutability": "nonpayable",
"inputs": [
{
"name": "newOwner",
"type": "address"
}
],
"outputs": []
},
{
"type": "event",
"name": "Mint",
"inputs": [
{
"name": "to",
"type": "address",
"indexed": true
},
{
"name": "amount",
"type": "uint256",
"indexed": false
}
]
},
{
"type": "event",
"name": "Burn",
"inputs": [
{
"name": "from",
"type": "address",
"indexed": true
},
{
"name": "amount",
"type": "uint256",
"indexed": false
}
]
},
{
"type": "event",
"name": "Pause",
"inputs": [
{
"name": "state",
"type": "bool",
"indexed": true
}
]
},
{
"type": "event",
"name": "BlacklistUpdate",
"inputs": [
{
"name": "account",
"type": "address",
"indexed": true
},
{
"name": "status",
"type": "bool",
"indexed": true
}
]
}
]