Contract Source Code:
File 1 of 1 : AquaPeanut
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract AquaPeanut {
string public name = "AquaPeanut";
string public symbol = "APNUT";
uint8 public decimals = 9;
uint256 public totalSupply = 100 * 10**9 * 10**9; // 100 billion tokens with 9 decimals
address public owner;
address public liquidityWallet;
uint256 public liquidityFee = 2; // Fee percentage for liquidity pool
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
mapping(address => bool) public isExcludedFromFee;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event FeeChanged(uint256 newFee);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
owner = msg.sender;
liquidityWallet = address(this);
balanceOf[owner] = totalSupply; // Mint all tokens to the owner's wallet
emit Transfer(address(0), owner, totalSupply); // Emit Transfer event for minting
}
modifier onlyOwner() {
require(msg.sender == owner, "Caller is not the owner");
_;
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function approve(address spender, uint256 amount) public returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
require(allowance[sender][msg.sender] >= amount, "Allowance exceeded");
allowance[sender][msg.sender] -= amount;
_transfer(sender, recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "Transfer from zero address");
require(recipient != address(0), "Transfer to zero address");
require(balanceOf[sender] >= amount, "Insufficient balance");
uint256 feeAmount = 0;
if (!isExcludedFromFee[sender]) {
feeAmount = (amount * liquidityFee) / 100;
balanceOf[liquidityWallet] += feeAmount; // Add fee to liquidity wallet
emit Transfer(sender, liquidityWallet, feeAmount);
}
uint256 transferAmount = amount - feeAmount;
balanceOf[sender] -= amount;
balanceOf[recipient] += transferAmount;
emit Transfer(sender, recipient, transferAmount);
}
function setLiquidityFee(uint256 newFee) external onlyOwner {
require(newFee <= 10, "Fee cannot exceed 10%");
liquidityFee = newFee;
emit FeeChanged(newFee);
}
function excludeFromFee(address account) external onlyOwner {
isExcludedFromFee[account] = true;
}
function includeInFee(address account) external onlyOwner {
isExcludedFromFee[account] = false;
}
function renounceOwnership() external onlyOwner {
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "New owner is the zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}