contract Dainet is BaseToken {

    string public name;
    uint8 public decimals;
    string public symbol;
    string public version = '1.5';
    uint256 public unitsPerEth;
    uint256 public maxDainSell;
    uint256 public totalEthPos;
    uint256 public minimalEthPos;
    uint256 public minEthAmount;

    constructor() public {
        name = "Dainet";
        symbol = "DAIN";
        decimals = 18;   

        totalSupply = withDecimals(1300000000, decimals); 

        maxDainSell = withDecimals(845000000, decimals); 
        unitsPerEth = 2000;
        minEthAmount = withDecimals(5, (18-2)); 

        balances[msg.sender] = totalSupply;
        emit Transfer(address(0), msg.sender, totalSupply);
    }

    function() public payable{
        uint256 amount = mul(msg.value, unitsPerEth);
        require(balances[owner] >= amount);
        require(balances[owner] >= maxDainSell);
        require(msg.value >= minEthAmount);

        balances[owner] = sub(balances[owner], amount);
        maxDainSell = sub(maxDainSell, amount);
        balances[msg.sender] = add(balances[msg.sender], amount);
        emit Transfer(owner, msg.sender, amount);
        totalEthPos = add(totalEthPos, msg.value);

        owner.transfer(msg.value);
    }

    function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender, spender, tokens);
        ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
        return true;
    }

    function changeUnitsPerEth(uint256 newValue) public onlyOwner {
        unitsPerEth = newValue;
    }

    // ------------------------------------------------------------------------
    // Owner can transfer out any accidentally sent ERC20 tokens
    // ------------------------------------------------------------------------
    function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
        return ERC20Interface(tokenAddress).transfer(owner, tokens);
    }
}
/**
 * @title Dainet
 * @dev Dainet Token Smart Contract
 */
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
    return ERC20Interface(tokenAddress).transfer(owner, tokens);
}

// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------