Contract Diff Checker

Contract Name:
SonicSanta

Contract Source Code:

File 1 of 1 : SonicSanta

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract SonicSanta {
    string public name = "Sonic Santa";
    string public symbol = "Ss";
    uint8 public decimals = 18;
    uint256 public totalSupply = 100_000_000 * 10 ** uint256(decimals);

    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    address public owner;
    uint256 public feePercent = 1; // 1% transaction fee
    bool public ownershipRenounced = false;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event OwnershipRenounced(address indexed previousOwner);

    constructor() {
        owner = msg.sender; // Assign the deployer as the owner
        balanceOf[owner] = totalSupply; // Mint all tokens to the deployer
        emit Transfer(address(0), owner, totalSupply); // Emit the mint event
    }

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the owner");
        _;
    }

    function transfer(address to, uint256 value) public returns (bool) {
        require(balanceOf[msg.sender] >= value, "Insufficient balance");

        uint256 fee = (value * feePercent) / 100; // Calculate 1% fee
        uint256 amountToTransfer = value - fee;

        balanceOf[msg.sender] -= value;
        balanceOf[to] += amountToTransfer;
        balanceOf[address(this)] += fee; // Send the fee to the contract address

        emit Transfer(msg.sender, to, amountToTransfer);
        emit Transfer(msg.sender, address(this), fee);
        return true;
    }

    function approve(address spender, uint256 value) public returns (bool) {
        allowance[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;
    }

    function transferFrom(address from, address to, uint256 value) public returns (bool) {
        require(balanceOf[from] >= value, "Insufficient balance");
        require(allowance[from][msg.sender] >= value, "Allowance exceeded");

        uint256 fee = (value * feePercent) / 100; // Calculate 1% fee
        uint256 amountToTransfer = value - fee;

        balanceOf[from] -= value;
        balanceOf[to] += amountToTransfer;
        balanceOf[address(this)] += fee; // Send the fee to the contract address
        allowance[from][msg.sender] -= value;

        emit Transfer(from, to, amountToTransfer);
        emit Transfer(from, address(this), fee);
        return true;
    }

    function renounceOwnership() public onlyOwner {
        emit OwnershipRenounced(owner);
        owner = address(0); // Ownership renounced
        ownershipRenounced = true;
    }

    function withdrawFees() public onlyOwner {
        require(!ownershipRenounced, "Ownership is renounced");
        uint256 contractBalance = balanceOf[address(this)];
        balanceOf[address(this)] = 0;
        balanceOf[msg.sender] += contractBalance;
        emit Transfer(address(this), msg.sender, contractBalance);
    }
}

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

Context size (optional):