Verified contractExactMIT
CallOfOil
Address0xa1b4bbf3df1c50166d8727bc23efd05eef141cc4
- Balance
0 ETH
- Transactions
3
- Compiler
solc 0.8.31
- Same code
Only this contract
Details
- Compiler
- solc 0.8.31+commit.fd3a2265
- Language
- solidity
- Optimization
- No
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 24,661,472
- Creation transaction
- 0x273eed8713…7b44a811f9
CallOfOil_ETH.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/**
* @title Call of Oil (COO) - ERC-20 Token with Blacklist
* @dev Simple ERC-20 implementation with owner-controlled blacklist
* Deploy via remix.ethereum.org
*/
contract CallOfOil {
// ─── Token Metadata ───────────────────────────────────────────────────────
string public name = "Call of Oil";
string public symbol = "COO";
uint8 public decimals = 18;
// ─── State Variables ──────────────────────────────────────────────────────
uint256 public totalSupply;
address public owner;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) public blacklisted;
// ─── Events ───────────────────────────────────────────────────────────────
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Blacklisted(address indexed account);
event Unblacklisted(address indexed account);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ─── Modifiers ────────────────────────────────────────────────────────────
modifier onlyOwner() {
require(msg.sender == owner, "CallOfOil: caller is not the owner");
_;
}
modifier notBlacklisted(address account) {
require(!blacklisted[account], "CallOfOil: account is blacklisted");
_;
}
// ─── Constructor ──────────────────────────────────────────────────────────
/**
* @param initialSupply Total supply (in whole tokens — decimals handled automatically)
* Example: pass 1000000 to mint 1,000,000 tokens
*/
constructor(uint256 initialSupply) {
owner = msg.sender;
uint256 amount = initialSupply * (10 ** decimals);
totalSupply = amount;
_balances[msg.sender] = amount;
emit Transfer(address(0), msg.sender, amount);
}
// ─── ERC-20 Core ──────────────────────────────────────────────────────────
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address to, uint256 amount)
public
notBlacklisted(msg.sender)
notBlacklisted(to)
returns (bool)
{
_transfer(msg.sender, to, amount);
return true;
}
function allowance(address tokenOwner, address spender) public view returns (uint256) {
return _allowances[tokenOwner][spender];
}
function approve(address spender, uint256 amount)
public
notBlacklisted(msg.sender)
notBlacklisted(spender)
returns (bool)
{
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transferFrom(address from, address to, uint256 amount)
public
notBlacklisted(from)
notBlacklisted(to)
notBlacklisted(msg.sender)
returns (bool)
{
uint256 currentAllowance = _allowances[from][msg.sender];
require(currentAllowance >= amount, "CallOfOil: insufficient allowance");
unchecked { _allowances[from][msg.sender] = currentAllowance - amount; }
_transfer(from, to, amount);
return true;
}
// ─── Internal Transfer ────────────────────────────────────────────────────
function _transfer(address from, address to, uint256 amount) internal {
require(from != address(0), "CallOfOil: transfer from zero address");
require(to != address(0), "CallOfOil: transfer to zero address");
require(_balances[from] >= amount, "CallOfOil: insufficient balance");
unchecked {
_balances[from] -= amount;
_balances[to] += amount;
}
emit Transfer(from, to, amount);
}
// ─── Blacklist Management (Owner Only) ────────────────────────────────────
/**
* @notice Add an address to the blacklist.
* Blacklisted addresses cannot send, receive, or approve tokens.
*/
function blacklist(address account) external onlyOwner {
require(account != address(0), "CallOfOil: cannot blacklist zero address");
require(account != owner, "CallOfOil: cannot blacklist owner");
require(!blacklisted[account], "CallOfOil: already blacklisted");
blacklisted[account] = true;
emit Blacklisted(account);
}
/**
* @notice Remove an address from the blacklist.
*/
function unblacklist(address account) external onlyOwner {
require(blacklisted[account], "CallOfOil: not blacklisted");
blacklisted[account] = false;
emit Unblacklisted(account);
}
/**
* @notice Check whether an address is blacklisted.
*/
function isBlacklisted(address account) external view returns (bool) {
return blacklisted[account];
}
// ─── Owner Utilities ──────────────────────────────────────────────────────
/**
* @notice Mint new tokens. Only callable by the owner.
*/
function mint(address to, uint256 amount) external onlyOwner notBlacklisted(to) {
require(to != address(0), "CallOfOil: mint to zero address");
totalSupply += amount;
_balances[to] += amount;
emit Transfer(address(0), to, amount);
}
/**
* @notice Burn tokens from your own balance.
*/
function burn(uint256 amount) external notBlacklisted(msg.sender) {
require(_balances[msg.sender] >= amount, "CallOfOil: insufficient balance");
unchecked { _balances[msg.sender] -= amount; }
totalSupply -= amount;
emit Transfer(msg.sender, address(0), amount);
}
/**
* @notice Transfer contract ownership to a new address.
*/
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "CallOfOil: zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": false
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.