contract yCORE is ERC20Interface {
    
    using SafeMath for uint256;
    
    string public name;
    string public symbol;
    uint8 public decimals;
    
    uint256 public burnPercent = 10;
    uint256 public _totalSupply;
    
    mapping(address => uint) balances;
    mapping(address => mapping(address => uint)) allowed;
    
    // This notifies clients about the amount burnt. This is a random burn event triggered every 100 transactions
    event BurnEvent(address indexed from, uint256 value);

    constructor() public {
        name = "yCORE.network";
        symbol = "yCORE";
        decimals = 18;
        _totalSupply = 1000000000000000000000;
        
        balances[msg.sender] = _totalSupply;
        emit Transfer(address(0), msg.sender, _totalSupply);
    }
    
    function totalSupply() public view returns (uint) {
        return _totalSupply  - balances[address(0)];
    }
    
    /**
     * Burn tokensToBurn
     * This is a random burn event that happens every 100 transactions
     * Remove `_value` tokens from the system irreversibly
     *
     * @param _value the amount of money to burn
     */
    function burnevent(uint256 _value) public returns (bool success) {
        require(balances[msg.sender] >= _value);   // Check if the sender has enough
        balances[msg.sender] -= _value;            // Subtract from the sender
        _totalSupply -= _value;                      // Updates totalSupply
        emit BurnEvent(msg.sender, _value);
        return true;
    }
    
    /**
     * Address token allowance
     */
    function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
        return allowed[tokenOwner][spender];
    }
    
    /**
     * Retrieves burn perfent. Standard 10 percent
     */
    function getBurnPercentValue(uint256 value) public view returns (uint256)  {
        uint256 burnValue = value.ceil(burnPercent); // 10% burn
        return burnValue;
    }
    
    /**
     * Address approval
     */
    function approve(address spender, uint tokens) public returns (bool success) {
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender, spender, tokens);
        return true;
    }
    
    /**
     * Address balance
     */
    function balanceOf(address tokenOwner) public view returns (uint balance) {
        return balances[tokenOwner];
    }
    
    /**
     * Address transfer from
     */
    function transferFrom(address from, address to, uint tokens) public returns (bool success) {
        balances[from] = balances[from].subtract(tokens);
        allowed[from][msg.sender] = allowed[from][msg.sender].subtract(tokens);
        balances[to] = balances[to].add(tokens);
        emit Transfer(from, to, tokens);
        return true;
    }
    
    /**
     * Address transfer to
     */
    function transfer(address to, uint value) public returns (bool success) {
        require(value <= balances[msg.sender]);
        require(to != address(0));
    
        uint256 tokensToBurn = getBurnPercentValue(value);
        uint256 tokensToTransfer = value.subtract(tokensToBurn);
    
        balances[msg.sender] = balances[msg.sender].subtract(value);
        balances[to] = balances[to].add(tokensToTransfer);
    
        _totalSupply = _totalSupply.subtract(tokensToBurn);
    
        emit Transfer(msg.sender, to, tokensToTransfer);
        emit Transfer(msg.sender, address(0), tokensToBurn);
        return true;
    }
    
    
}
function balanceOf(address tokenOwner) public view returns (uint balance) {
    return balances[tokenOwner];
}

/**
 * Address balance
 */