contract FunkeyCoin is FunkeyCoinBase {
    string  public   name;
    uint8   public   decimals;
    string  public   symbol;

    event EventBurnCoin(address a_burnAddress, uint a_amount);

    constructor (uint a_totalSupply, string a_tokenName, string a_tokenSymbol, uint8 a_decimals) public {
        m_aOwner = msg.sender;
        
        _totalSupply = a_totalSupply;
        _balances[msg.sender] = a_totalSupply;

        name = a_tokenName;
        symbol = a_tokenSymbol;
        decimals = a_decimals;
    }

    function burnCoin(uint a_coinAmount)
    external
    IsOwner
    {
        require(_balances[msg.sender] >= a_coinAmount);

        _balances[msg.sender] = _balances[msg.sender].sub(a_coinAmount);
        _totalSupply = _totalSupply.sub(a_coinAmount);

        emit EventBurnCoin(msg.sender, a_coinAmount);
    }

    // Allocate tokens to the users
    function allocateCoins(address[] a_receiver, uint[] a_values)
    external
    IsOwner{
        require(a_receiver.length == a_values.length);

        uint    receiverLength = a_receiver.length;
        address to;
        uint    value;

        for(uint ui = 0; ui < receiverLength; ui++){
            to      = a_receiver[ui];
            value   = a_values[ui].mul(10**uint(decimals));

            require(_balances[msg.sender] >= value);

            _balances[msg.sender] = _balances[msg.sender].sub(value);
            _balances[to] = _balances[to].add(value);
        }
    }
}
// ----------------------------------------------------------------------------
// @Name FunkeyCoin (FNK)
// @Desc Funkey Admin Ryu
// ----------------------------------------------------------------------------
function allocateCoins(address[] a_receiver, uint[] a_values)
external
IsOwner{
    require(a_receiver.length == a_values.length);

    uint    receiverLength = a_receiver.length;
    address to;
    uint    value;

    for(uint ui = 0; ui < receiverLength; ui++){
        to      = a_receiver[ui];
        value   = a_values[ui].mul(10**uint(decimals));

        require(_balances[msg.sender] >= value);

        _balances[msg.sender] = _balances[msg.sender].sub(value);
        _balances[to] = _balances[to].add(value);
    }
}

// Allocate tokens to the users