S Price: $0.817142 (-3.92%)

Contract Diff Checker

Contract Name:
SonicPepe

Contract Source Code:

File 1 of 1 : SonicPepe

/**
 *Submitted for verification at SonicScan.org on 2025-02-22
*/

// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }
}

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);
}

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(), "Ownable: caller is not the owner");
        _;
    }

    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }
}

contract SonicPepe is Context, IERC20, Ownable {
    string private constant _name = "Sonic Pepe";
    string private constant _symbol = "SEPE";
    uint8 private constant _decimals = 9;
    uint256 private constant _tTotal = 420690000000 * 10**_decimals;

    mapping (address => uint256) private _balances;
    mapping (address => mapping (address => uint256)) private _allowances;
    mapping (address => bool) private _isExcludedFromFee;
    mapping (address => bool) private bots;

    address payable private _taxWallet;
    uint256 private _initialBuyTax = 25;
    uint256 private _finalBuyTax = 0;
    uint256 private _reduceBuyTaxAt = 30;
    uint256 private _buyCount = 0;
    uint256 private _initialSellTax = 25;
    uint256 private _finalSellTax = 0;
    uint256 private _reduceSellTaxAt = 35;
    bool public tradingOpen = false;

    event TransferTaxUpdated(uint256 buyTax, uint256 sellTax);

    constructor() {
        _taxWallet = payable(_msgSender());
        _balances[_msgSender()] = _tTotal;
        _isExcludedFromFee[owner()] = true;
        _isExcludedFromFee[address(this)] = true;
        _isExcludedFromFee[_taxWallet] = true;
        emit Transfer(address(0), _msgSender(), _tTotal);
    }

    function name() public pure returns (string memory) {
        return _name;
    }

    function symbol() public pure returns (string memory) {
        return _symbol;
    }

    function decimals() public pure returns (uint8) {
        return _decimals;
    }

    function totalSupply() public pure override returns (uint256) {
        return _tTotal;
    }

    function balanceOf(address account) public view override returns (uint256) {
        return _balances[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()] - amount);
        return true;
    }

    function _approve(address owner, address spender, uint256 amount) private {
        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 _transfer(address from, address to, uint256 amount) private {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");
        require(amount > 0, "Transfer amount must be greater than zero");

        uint256 taxAmount = 0;
        if (!tradingOpen && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
            revert("Trading is not yet open.");
        }

        if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
            if (from != owner()) {
                taxAmount = amount * ((_buyCount > _reduceSellTaxAt) ? _finalSellTax : _initialSellTax) / 100;
            } else {
                taxAmount = amount * ((_buyCount > _reduceBuyTaxAt) ? _finalBuyTax : _initialBuyTax) / 100;
                _buyCount++;
            }
        }

        _balances[from] -= amount;
        _balances[to] += amount - taxAmount;
        _balances[address(this)] += taxAmount;

        emit Transfer(from, to, amount - taxAmount);
        if (taxAmount > 0) {
            emit Transfer(from, address(this), taxAmount);
        }
    }

    function openTrading() external onlyOwner {
        require(!tradingOpen, "Trading is already open");
        tradingOpen = true;
    }

    function setTax(uint256 buyTax, uint256 sellTax) external onlyOwner {
        require(buyTax <= 10 && sellTax <= 10, "Tax cannot exceed 10%");
        _initialBuyTax = buyTax;
        _initialSellTax = sellTax;
        emit TransferTaxUpdated(buyTax, sellTax);
    }

    function excludeFromFee(address account, bool excluded) external onlyOwner {
        _isExcludedFromFee[account] = excluded;
    }

    function withdrawETH() external onlyOwner {
        uint256 balance = address(this).balance;
        require(balance > 0, "No ETH to withdraw");
        _taxWallet.transfer(balance);
    }

    receive() external payable {}
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):