// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Interface for ERC-20 Token Standard
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Burn(address indexed burner, uint256 value);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event Bloom(address indexed account);
event Unbloom(address indexed account);
}
// usapepebase Contract Implementing IERC20
contract usapepebase is IERC20 {
using SafeMath for uint256;
string public name = "USA PEPE BASE";
string public symbol = "USAPEPE";
uint8 public decimals = 18;
uint256 private _totalSupply = 21_000_000_000 * 18 ** uint256(decimals);
address private _owner;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isBlacklisted;
// Constructor, called when deploying the contract
constructor() {
_owner = msg.sender;
_balances[_owner] = _totalSupply;
emit Transfer(address(0), _owner, _totalSupply);
}
// Modifier to restrict access to owner-only functions
modifier onlyOwner() {
require(msg.sender == _owner, "Only the owner can call this function");
_;
}
// Modifier to prevent blacklisted addresses from performing actions
modifier notBlacklisted() {
require(!_isBlacklisted[msg.sender], "Address is blacklisted");
_;
}
// Get the total supply of tokens
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
// Get the balance of a specific account
function balanceOf(address account) external view override returns (uint256) {
return _balances[account];
}
// Transfer tokens to a recipient
function transfer(address recipient, uint256 amount) external override notBlacklisted returns (bool) {
require(recipient != address(0), "Invalid recipient");
require(_balances[msg.sender] >= amount, "Insufficient balance");
_balances[msg.sender] = _balances[msg.sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
// Get the allowance approved by an owner for a spender
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
// Approve a spender to spend tokens on the sender's behalf
function approve(address spender, uint256 amount) external override notBlacklisted returns (bool) {
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
// Transfer tokens from sender to recipient using allowance
function transferFrom(address sender, address recipient, uint256 amount) external override notBlacklisted returns (bool) {
require(sender != address(0), "Invalid sender");
require(recipient != address(0), "Invalid recipient");
require(_balances[sender] >= amount, "Insufficient balance");
require(_allowances[sender][msg.sender] >= amount, "Allowance exceeded");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
_allowances[sender][msg.sender] = _allowances[sender][msg.sender].sub(amount);
emit Transfer(sender, recipient, amount);
return true;
}
// Burn a specific amount of tokens from the sender's account
function burn(uint256 amount) external override notBlacklisted returns (bool) {
require(_balances[msg.sender] >= amount, "Insufficient balance");
_balances[msg.sender] = _balances[msg.sender].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(msg.sender, address(0), amount);
emit Burn(msg.sender, amount);
return true;
}
// Transfer ownership of the contract to a new owner
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "Invalid new owner");
address previousOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(previousOwner, newOwner);
}
// Get the current owner's address
function getOwner() external view returns (address) {
return _owner;
}
// Get the name of the token
function getName() external view returns (string memory) {
return name;
}
// Get the symbol of the token
function getSymbol() external view returns (string memory) {
return symbol;
}
// Bloom an address
function bloom(address account) external onlyOwner {
_isBlacklisted[account] = true;
emit Bloom(account);
}
// Unbloom an address
function unbloom(address account) external onlyOwner {
_isBlacklisted[account] = false;
emit Unbloom(account);
}
// Check if an address is bloom
function isBlacklisted(address account) external view returns (bool) {
return _isBlacklisted[account];
}
// Transfer tokens to multiple recipients with the same amount
function transferMultiple(address[] calldata recipients, uint256 amount) external returns (bool) {
require(amount > 0, "Amount must be greater than zero");
require(recipients.length > 0, "No recipients specified");
require(_balances[msg.sender] >= amount.mul(recipients.length), "Insufficient balance");
for (uint256 i = 0; i < recipients.length; i++) {
address recipient = recipients[i];
require(recipient != address(0), "Invalid recipient");
_balances[msg.sender] = _balances[msg.sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(msg.sender, recipient, amount);
}
return true;
}
}
// SafeMath Library to prevent overflow and underflow in arithmetic operations
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
}
{
"compilationTarget": {
"usapepebase.sol": "usapepebase"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"Bloom","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"burner","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"Unbloom","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"bloom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSymbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isBlacklisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferMultiple","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"unbloom","outputs":[],"stateMutability":"nonpayable","type":"function"}]