// SPDX-License-Identifier: MIT pragma solidity 0.8.22; contract Token { mapping(address => uint) private _balances; mapping(address => mapping(address => uint)) private _allowance; uint private _totalSupply = 75000000 * 10 ** 18; string public name = "Suleymani"; string public symbol = "SLMN"; uint public decimals = 18; uint256 public num; event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); event BalanceChanged(address indexed owner, uint previousBalance, uint newBalance); constructor() { _balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply); } function balanceOf(address owner) public view returns (uint) { require(owner != address(0), "Invalid address"); return _balances[owner]; } function transfer(address to, uint value) public returns (bool) { require(to != address(0), "Invalid address"); require(_balances[msg.sender] >= value, 'Balance too low'); _balances[msg.sender] -= value; _balances[to] += value; emit Transfer(msg.sender, to, value); emit BalanceChanged(msg.sender, _balances[msg.sender] + value, _balances[msg.sender]); return true; } function transferFrom(address from, address to, uint value) public returns (bool) { require(from != address(0) && to != address(0), "Invalid address"); require(_balances[from] >= value, 'Balance too low'); require(_allowance[from][msg.sender] >= value, 'Allowance too low'); _balances[from] -= value; _balances[to] += value; _allowance[from][msg.sender] -= value; emit Transfer(from, to, value); emit BalanceChanged(from, _balances[from] + value, _balances[from]); emit BalanceChanged(to, _balances[to] - value, _balances[to]); return true; } function approve(address spender, uint value) public returns (bool) { _allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } function allowance(address owner, address spender) public view returns (uint) { return _allowance[owner][spender]; } function set(uint256 _n) public { num = _n; } }
0.4.18