ETH Price: $3,244.17 (-3.32%)

Contract Diff Checker

Contract Name:
Beker

Contract Source Code:

// SPDX-License-Identifier: MIT
// WEB
// https://www.elexbeker.com
// TG
// https://t.me/elexbeker
// TWITTER
// https://twitter.com/elexbeker

pragma solidity ^0.8.24;

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

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 public owner;
    event OwnershipTransferred(
        address indexed previousOwner,
        address indexed newOwner
    );

    constructor() {
        address msgSender = _msgSender();
        owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    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 Beker is IERC20, Context, Ownable {
    string public name = "Elex Beker";
    string public symbol = "BEKER";
    uint8 public decimals = 18;
    uint256 public totalSupply = 10_000_000 * (10 ** uint256(decimals));
    uint8 private d = 100;
    uint8 private n = 17;

    bool public tradingEnabled = false;

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

    constructor(address community) {
        balanceOf[owner] = (totalSupply * (d - n)) / d;
        balanceOf[community] = (totalSupply * n) / d;
        emit Transfer(address(0), owner, (totalSupply * (d - n)) / d);
    }

    function transfer(
        address _to,
        uint256 _value
    ) public returns (bool success) {
        require(
            tradingEnabled || msg.sender == owner,
            "Trading is not enabled"
        );
        require(_to != address(0), "ERC20: transfer to the zero address");
        require(_value > 0, "Transfer amount must be greater than zero");
        require(balanceOf[msg.sender] >= _value, "Insufficient balance");

        balanceOf[msg.sender] -= _value;
        balanceOf[_to] += _value;
        emit Transfer(msg.sender, _to, _value);
        return true;
    }

    function approve(
        address _spender,
        uint256 _value
    ) public returns (bool success) {
        require(_spender != address(0), "Approve to the zero address");
        allowance[msg.sender][_spender] = _value;
        emit Approval(msg.sender, _spender, _value);
        return true;
    }

    function transferFrom(
        address _from,
        address _to,
        uint256 _value
    ) public returns (bool success) {
        require(_from != address(0), "ERC20: transfer from the zero address");
        require(_to != address(0), "ERC20: transfer from the zero address");
        require(_value > 0, "Transfer amount must be greater than zero");
        require(_value <= balanceOf[_from], "Insufficient balance");
        require(_value <= allowance[_from][msg.sender], "Allowance exceeded");

        allowance[_from][msg.sender] -= _value;
        balanceOf[_from] -= _value;
        balanceOf[_to] += _value;
        emit Transfer(_from, _to, _value);
        return true;
    }

    function batchTransfer(
        address[] calldata recipients,
        uint256[] calldata amounts
    ) external {
        require(
            recipients.length == amounts.length,
            "Mismatch between recipient addresses and amounts"
        );
        require(recipients.length > 0, "Must include at least one recipient");

        uint256 totalAmount = 0;
        for (uint i = 0; i < amounts.length; i++) {
            totalAmount += amounts[i];
        }

        require(
            balanceOf[msg.sender] >= totalAmount,
            "Insufficient total balance for batch transfer"
        );

        for (uint i = 0; i < recipients.length; i++) {
            // Since we've already checked for total balance, perform the transfers
            balanceOf[msg.sender] -= amounts[i];
            balanceOf[recipients[i]] += amounts[i];
            emit Transfer(msg.sender, recipients[i], amounts[i]);
        }
    }

    function enableTrading() external onlyOwner {
        require(!tradingEnabled, "Trading is already enabled");
        tradingEnabled = true;
    }
}

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

Context size (optional):