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 totalSupply = initialSupply;
52 balanceOf[_initialOwner] = initialSupply;
53
54 emit Transfer(address(0), _initialOwner, initialSupply);
55 emit OwnershipTransferred(address(0), _initialOwner);
56 }
57
58 function transfer(address to, uint256 value)
59 external
60 whenNotPaused
61 notBlacklisted(msg.sender)
62 notBlacklisted(to)
63 returns (bool success)
64 {
65 require(to != address(0), "Cannot send to zero address");
66 require(balanceOf[msg.sender] >= value, "Insufficient balance");
67
68 balanceOf[msg.sender] -= value;
69 balanceOf[to] += value;
70
71 emit Transfer(msg.sender, to, value);
72 return true;
73 }
74
75 function transferFrom(
76 address from,
77 address to,
78 uint256 value
79 )
80 external
81 whenNotPaused
82 notBlacklisted(from)
83 notBlacklisted(to)
84 returns (bool success)
85 {
86 require(to != address(0), "Cannot send to zero address");
87 require(balanceOf[from] >= value, "Insufficient balance");
88 require(allowance[from][msg.sender] >= value, "Allowance exceeded");
89
90 allowance[from][msg.sender] -= value;
91 balanceOf[from] -= value;
92 balanceOf[to] += value;
93
94 emit Transfer(from, to, value);
95 return true;
96 }
97
98 function approve(address spender, uint256 value)
99 external
100 whenNotPaused
101 notBlacklisted(msg.sender)
102 returns (bool success)
103 {
104 require(spender != address(0), "Cannot approve zero address");
105
106 allowance[msg.sender][spender] = value;
107 emit Approval(msg.sender, spender, value);
108 return true;
109 }
110
111 function mint(address to, uint256 amount)
112 external
113 onlyOwner
114 whenNotPaused
115 notBlacklisted(to)
116 {
117 require(to != address(0), "Cannot mint to zero address");
118 require(amount > 0, "Amount must be greater than 0");
119
120 totalSupply += amount;
121 balanceOf[to] += amount;
122
123 emit Mint(to, amount);
124 emit Transfer(address(0), to, amount);
125 }
126
127 function burn(uint256 amount)
128 external
129 whenNotPaused
130 notBlacklisted(msg.sender)
131 {
132 require(amount > 0, "Amount must be greater than 0");
133 require(balanceOf[msg.sender] >= amount, "Insufficient balance");
134
135 balanceOf[msg.sender] -= amount;
136 totalSupply -= amount;
137
138 emit Burn(msg.sender, amount);
139 emit Transfer(msg.sender, address(0), amount);
140 }
141
142 function burnFrom(address from, uint256 amount)
143 external
144 whenNotPaused
145 notBlacklisted(from)
146 {
147 require(amount > 0, "Amount must be greater than 0");
148 require(balanceOf[from] >= amount, "Insufficient balance");
149 require(allowance[from][msg.sender] >= amount, "Allowance exceeded");
150
151 allowance[from][msg.sender] -= amount;
152 balanceOf[from] -= amount;
153 totalSupply -= amount;
154
155 emit Burn(from, amount);
156 emit Transfer(from, address(0), amount);
157 }
158
159 function pause() external onlyOwner {
160 require(!paused, "Already paused");
161 paused = true;
162 emit Pause(true);
163 }
164
165 function unpause() external onlyOwner {
166 require(paused, "Not paused");
167 paused = false;
168 emit Pause(false);
169 }
170
171 function setBlacklist(address account, bool status) external onlyOwner {
172 require(account != address(0), "Cannot blacklist zero address");
173 require(account != owner, "Cannot blacklist owner");
174
175 blacklist[account] = status;
176 emit BlacklistUpdate(account, status);
177 }
178
179 function transferOwnership(address newOwner) external onlyOwner {
180 require(newOwner != address(0), "New owner cannot be zero address");
181 require(newOwner != owner, "Already the owner");
182
183 address previousOwner = owner;
184 owner = newOwner;
185 emit OwnershipTransferred(previousOwner, newOwner);
186 }
187}
188Load 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
}
]
}
]