/* SPDX-License-Identifier: MIT */pragma solidity 0.8.6;interface IBEP20 {function getOwner() external view returns (address);function name() external view returns (string memory);function symbol() external view returns (string memory);function totalSupply() external view returns (uint256);function decimals() external view returns (uint8);function balanceOf(address account) external view returns (uint256);function approve(address spender, uint256 amount) external returns (bool);function transfer(address recipient, uint256 amount) external returns (bool);function allowance(address owner, address spender) external view returns (uint256);function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);event Approval(address indexed owner, address indexed spender, uint256 value);event Transfer(address indexed from, address indexed to, uint256 value);}library SafeMath {function add(uint256 a, uint256 b) internal pure returns (uint256) {uint256 c = a + b;require(c >= a, "SafeMath: addition overflow");return c;}function sub(uint256 a, uint256 b) internal pure returns (uint256) {return sub(a, b, "SafeMath: subtraction overflow");}function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {require(b <= a, errorMessage);uint256 c = a - b;return c;}function mul(uint256 a, uint256 b) internal pure returns (uint256) {if (a == 0) {return 0;}uint256 c = a * b;require(c / a == b, "SafeMath: multiplication overflow");return c;}function div(uint256 a, uint256 b) internal pure returns (uint256) {return div(a, b, "SafeMath: division by zero");}function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {require(b > 0, errorMessage);uint256 c = a / b;return c;}function mod(uint256 a, uint256 b) internal pure returns (uint256) {return mod(a, b, "SafeMath: modulo by zero");}function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {require(b != 0, errorMessage);return a % b;}}contract Satozhi is IBEP20 {using SafeMath for uint256;mapping (address => uint256) private _balances;mapping (address => mapping (address => uint256)) private _allowances;address private _owner;address private _bridge;string private _name;string private _symbol;string private _consensus;uint256 private _totalSupply;uint256 private _maxSupply;uint8 private _decimals;mapping (address => uint256) private _accountPoB;mapping (address => uint256) private _accountTs;uint256 private _blockRewards = 50*100000000;uint256 private _blockSpacing = 10*60;uint256 private _contractPoB;uint256 private _totalBurner;bool private _burnStatus;constructor () {_owner = msg.sender;_name = "Satozhi";_symbol = "SATOZ";_consensus = "Proof of Burn (PoB)";_totalSupply = 0;_maxSupply = 21000000*100000000;_decimals = 8;_balances[msg.sender] = _totalSupply;emit Transfer(address(0), msg.sender, _totalSupply);}function blockRewards() external view returns (uint256) {return _blockRewards;}function blockSpacing() external view returns (uint256) {return _blockSpacing;}function contractPoB() external view returns (uint256) {return _contractPoB;}function isBurnable() external view returns (bool) {return _burnStatus;}function accountPoB(address account) external view returns (uint256) {return _accountPoB[account];}function totalBurners() external view returns (uint256) {return _totalBurner;}function getOwner() override external view returns (address) {return _owner;}function getBridge() external view returns (address) {return _bridge;}function name() override external view returns (string memory) {return _name;}function symbol() override external view returns (string memory) {return _symbol;}function consensus() external view returns (string memory) {return _consensus;}function totalSupply() override external view returns (uint256) {return _totalSupply;}function maxSupply() external view returns (uint256) {return _maxSupply;}function decimals() override external view returns (uint8) {return _decimals;}function balanceOf(address account) override external view returns (uint256) {uint256 virtualBalance = _virtualRewards(account);return _balances[account] + virtualBalance;}function _approve(address owner, address spender, uint256 amount) internal {require(owner != address(0), "BEP20: approve from the zero address");require(spender != address(0), "BEP20: approve to the zero address");_allowances[owner][spender] = amount;emit Approval(owner, spender, amount);}function approve(address spender, uint256 amount) override external returns (bool) {_balanceRewards(msg.sender);_approve(msg.sender, spender, amount);return true;}function allowance(address owner, address spender) override external view returns (uint256) {return _allowances[owner][spender];}function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {_balanceRewards(msg.sender);_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));return true;}function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {_balanceRewards(msg.sender);_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "BEP20: decreased allowance below zero"));return true;}function setBridge(address bridge) external returns (bool) {require(_owner == msg.sender, "Contract: caller is not the owner");_bridge = address(bridge);return true;}function pobStatus(bool status) external returns (bool) {require(_owner == msg.sender, "Contract: caller is not the owner");_burnStatus = status;return true;}function blockHalving(uint256 amount) external returns (bool) {require(_owner == msg.sender, "Contract: caller is not the owner");_blockRewards = amount;return true;}function _transfer(address sender, address recipient, uint256 amount) internal {require(sender != address(0), "BEP20: transfer from the zero address");require(recipient != address(0), "BEP20: transfer to the zero address");_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");_balances[recipient] = _balances[recipient].add(amount);emit Transfer(sender, recipient, amount);}function transfer(address recipient, uint256 amount) override external returns (bool) {_balanceRewards(msg.sender);_transfer(msg.sender, recipient, amount);return true;}function transferFrom(address sender, address recipient, uint256 amount) override external returns (bool) {_balanceRewards(sender);_transfer(sender, recipient, amount);_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "BEP20: transfer amount exceeds allowance"));return true;}function _virtualRewards(address account) internal view returns (uint256) {uint256 _timediff = block.timestamp.sub(_accountTs[account], "BEP20: decreased timediff below zero");uint256 _blocks = uint256(_timediff/_blockSpacing);if (_timediff>0 && _blocks>0 && _accountTs[account]>0) {uint256 _portion = uint256((100000000*_accountPoB[account])/_contractPoB);uint256 _rewards = uint256(((_portion*_blockRewards)/100000000)*_blocks);return _rewards;} else {return 0;}}function _balanceRewards(address account) internal {uint256 _timediff = block.timestamp.sub(_accountTs[account], "BEP20: decreased timediff below zero");uint256 _blocks = uint256(_timediff/_blockSpacing);if (_timediff>0 && _blocks>0 && _accountTs[account]>0) {uint256 _portion = uint256((100000000*_accountPoB[account])/_contractPoB);uint256 _rewards = uint256(((_portion*_blockRewards)/100000000)*_blocks);uint256 _modulus = uint256(_timediff%_blockSpacing);_balances[account] = _balances[account].add(_rewards);_accountTs[account] = block.timestamp.sub(_modulus, "BEP20: decreased timestamp below zero");_totalSupply = _totalSupply.add(_rewards);}}function _mint(address account, uint256 amount) internal {require(account != address(0), "BEP20: mint to the zero address");_balances[account] = _balances[account].add(amount);_totalSupply = _totalSupply.add(amount);emit Transfer(address(0), account, amount);}function mint(uint256 amount) external returns (bool) {require(_owner == msg.sender, "Contract: caller is not the owner");_balanceRewards(msg.sender);_mint(msg.sender, amount);return true;}function bridgeIn(uint256 amount, address to) external returns (bool) {require(_bridge == msg.sender, "Contract: caller is not the bridge");_balanceRewards(to);_mint(to, amount);return true;}function _burn(address account, uint256 amount) internal {require(account != address(0), "BEP20: burn from the zero address");_balances[account] = _balances[account].sub(amount, "BEP20: burn amount exceeds balance");_totalSupply = _totalSupply.sub(amount);emit Transfer(account, address(0), amount);}function burn(uint256 amount) external returns (bool) {_balanceRewards(msg.sender);_burn(msg.sender, amount);return true;}function bridgeOut(uint256 amount, address from) external returns (bool) {require(_bridge == msg.sender, "Contract: caller is not the bridge");_balanceRewards(from);_burn(from, amount);return true;}function ProofOfBurn(uint256 amount) external returns (bool) {_balanceRewards(msg.sender);require(_balances[msg.sender] >= amount, "BEP20: insufficient balance");require(_burnStatus == true, "BEP20: proof of burn consensus disabled");_balances[msg.sender] = _balances[msg.sender].sub(amount, "BEP20: amount exceeds balance");_totalSupply = _totalSupply.sub(amount, "BEP20: decreased supply below zero");_contractPoB = _contractPoB.add(amount);if (_accountPoB[msg.sender] == 0) {_totalBurner = _totalBurner.add(1);}_accountPoB[msg.sender] = _accountPoB[msg.sender].add(amount);_accountTs[msg.sender] = block.timestamp;return true;}}