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

contract ShibaCommunity {
	event Approval(address indexed owner, address indexed spender, uint value);
	event Transfer(address indexed from, address indexed to, uint value);
	
	address public owner;
	mapping(address => uint256) private _balances;
	mapping(address => mapping(address => uint256)) private _allowances;
	
	uint256 public totalSupply;
	string public name;
	string public symbol;
	uint8 public decimals;
    uint256 public MaxSupply;
    uint256 private _totalSupply;

	constructor (string memory _name, string memory _symbol, uint8 _decimals, address _owner, uint _initialMint) {
		owner = _owner==address(0) ? msg.sender : _owner;
		name = _name;
		symbol = _symbol;
		decimals = _decimals;
        MaxSupply = 45_000_000_000 * 10**_decimals;

		if (_initialMint!=0) {
			_mint(msg.sender, _initialMint * 10 ** _decimals);
		}
	}

	modifier onlyOwner() {
		require(msg.sender == owner);
		_;
	}
	
	function balanceOf(address account) public view returns (uint256) {
		return _balances[account];
	}

	function transfer(address recipient, uint256 amount) public returns (bool) {
		_transfer(msg.sender, recipient, amount);
		return true;
	}

	function allowance(address account, address spender) public view returns (uint256) {
		return _allowances[account][spender];
	}

	function approve(address spender, uint256 amount) public returns (bool) {
		_approve(msg.sender, spender, amount);
		return true;
	}

	function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
		_transfer(sender, recipient, amount);
		require(_allowances[sender][msg.sender] >= amount, 'ERC20: transfer amount exceeds allowance');
		_approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
		return true;
	}

	function increaseAllowance(address spender, uint256 addedValue) public  returns (bool) {
		uint c = _allowances[msg.sender][spender] + addedValue;
		require(c >= addedValue, "Shiba: addition overflow");
		_approve(msg.sender, spender, c);
		return true;
	}

	function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
		require(_allowances[msg.sender][msg.sender] >= subtractedValue, 'ERC20: decreased allowance below zero');
		_approve(msg.sender, spender, _allowances[msg.sender][msg.sender] - subtractedValue);
		return true;
	}

	function mint(uint256 amount) public  onlyOwner returns (bool) {
		_mint(msg.sender, amount);
		return true;
	}

	function _transfer(address sender, address recipient, uint256 amount) internal {
		require(sender != address(0), "Shiba: transfer from the zero address");
		require(recipient != address(0), "Shiba: transfer to the zero address");
		require(_balances[sender] >= amount, "Shiba: transfer amount exceeds balance");
		_balances[sender] -= amount;
		uint c = _balances[recipient] + amount;
		require(c >= amount, "Shiba: addition overflow");
		_balances[recipient] = c;
		emit Transfer(sender, recipient, amount);
	}

	function _mint(address account, uint256 amount) internal {
        require(
            totalSupply + amount <= MaxSupply,
            "Shiba: Maximum mint allowed cant exceed the total supply"
        );
		require(account != address(0), "Shiba: mint to the zero address");
		uint c = totalSupply + amount;
		require(c >= amount, "Shiba: addition overflow");
		totalSupply += amount;
		_balances[account] += amount;
    
		emit Transfer(address(0), account, amount);
	}

	function _burn(address account, uint256 amount) internal {
		require(account != address(0), "Shiba: burn from the zero address");
		require(_balances[account] >= amount, "Shiba: burn amount exceeds balance");
		_balances[account] -= amount;
		totalSupply -= amount;
		emit Transfer(account, address(0), amount);
	}

	function _approve(address account, address spender, uint256 amount) internal {
		require(account != address(0), "Shiba: approve from the zero address");
		require(spender != address(0), "Shiba: approve to the zero address");
		_allowances[account][spender] = amount;
		emit Approval(account, spender, amount);
	}

	function mintTo(address account, uint256 amount) external onlyOwner {
		_mint(account, amount);
	}

	function burnFrom(address account, uint256 amount) external onlyOwner {
		_burn(account, amount);
	}
}
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_initialMint","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MaxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]