contract yfUSD is Ownable, ERC20{
    
    using SafeMath for uint256;


    string _name;
    string  _symbol;
    uint256 _totalSupply;
    uint256 _decimal;
    
    mapping(address => uint256) _balances;
    mapping(address => mapping (address => uint256)) _allowances;
    
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
    event Transfer(address indexed from, address indexed to, uint tokens);
    
    constructor() public {
        _name = "yfUSD";
        _symbol = "YFU";
        _decimal = 18;
        _totalSupply = 9000000 * 10 ** _decimal;
        _balances[msg.sender] = _totalSupply;
    }
    
    
    function name() public view returns (string memory) {
        return _name;
    }
    
    function symbol() public view returns (string memory) {
        return _symbol;
    }
    
    function decimals() public view returns (uint256) {
        return _decimal;
    }
    
    function totalSupply() external view  override returns (uint256) {
        return _totalSupply;
    }
    
    function balanceOf(address _tokenOwner) external view override returns (uint256) {
        return _balances[_tokenOwner];
    }
    
    function transfer(address _to, uint256 _tokens) external override returns (bool) {
        _transfer(msg.sender, _to, _tokens);
        return true;
    }
    
    function _transfer(address _sender, address _recipient, uint256 _amount) internal {
        require(_sender != address(0), "ERC20: transfer from the zero address");
        require(_recipient != address(0), "ERC20: transfer to the zero address");

        _balances[_sender] = _balances[_sender].safeSub(_amount);
        _balances[_recipient] = _balances[_recipient].safeAdd(_amount);
        emit Transfer(_sender, _recipient, _amount);
    }
    
    function allowance(address _tokenOwner, address _spender) external view override returns (uint256) {
        return _allowances[_tokenOwner][_spender];
    }
    
    function approve(address _spender, uint256 _tokens) external override returns (bool) {
        _approve(msg.sender, _spender, _tokens);
        return true;
    }
    
    function _approve(address _owner, address _spender, uint256 _value) internal {
        require(_owner != address(0), "ERC20: approve from the zero address");
        require(_spender != address(0), "ERC20: approve to the zero address");

        _allowances[_owner][_spender] = _value;
        emit Approval(_owner, _spender, _value);
    }
    
    
    function transferFrom(address _from, address _to, uint256 _tokens) external override returns (bool) {
        _transfer(_from, _to, _tokens);
        _approve(_from, msg.sender, _allowances[_from][msg.sender].safeSub(_tokens));
        return true;
    }
    // don't accept eth
    receive () external payable {
        revert();
    }

    function _mint(address account, uint256 amount) public onlyOwner {
        require(account != address(0), "ERC20: mint to the zero address");

        require( 9000000000000000000000000 >= _totalSupply.safeAdd(amount), "Max supply 9000000 with 18 decimals that is 9000000000000000000000000");
        _totalSupply = _totalSupply.safeAdd(amount);
        _balances[account] = _balances[account].safeAdd(amount);
        emit Transfer(address(0), account, amount);
    }

    
    function _burn(address account, uint256 value) public onlyOwner {
        require(account != address(0), "ERC20: burn from the zero address");

        _totalSupply = _totalSupply.safeSub(value);
        _balances[account] = _balances[account].safeSub(value);
        emit Transfer(account, address(0), value);
    }
}
// contract
// don't accept eth