contract JOBTokenSelfDrop is Owned, SafeMath{

    address tokenContractAddress;
    address ethContributionAddress;
    uint iPricePerToken;
    
    // Set Token Contract Address
    function setContractAddress(address tokenAddress) public onlyOwner
    {
        tokenContractAddress = tokenAddress;
    }
    
    // Get Token Contract Address
    function getContractAddress() public view returns (address tokenAddress)
    {
        return tokenContractAddress;
    }
    
    // Set Ethereum Address To Receive SelfDrop Fund
    function setethContributionAddress(address accountAddress) public onlyOwner
    {
        ethContributionAddress = accountAddress;
    }
    
    // Get Ethereum Address Used To Receive SelfDrop Fund
    function getethContributionAddress() public view returns (address accountAddress)
    {
        return ethContributionAddress;
    }
    
    // Set Token Price in Wei(ETH Unit)
    function setPricePerToken(uint Price) public onlyOwner
    {
        iPricePerToken = Price;
    }
    
    // Get Token Price in Wei(ETH Unit)
    function getPricePerToken() public view returns (uint Price)
    {
        return iPricePerToken;
    }
    
    // Withdraw Tokens from SelfDrop Contract
    function withdrawTokens(uint tokens) public onlyOwner returns (bool success) {
        return ERC20Interface(tokenContractAddress).transfer(msg.sender, tokens);
    }
    
    // CallBack/Fallback Function To Receive Ethereum And Send Tokens
    function () public payable
    {
        if (msg.value > 0) 
        {
            uint tokenCount;
            
            tokenCount = safeDiv(msg.value,iPricePerToken);
            
            if (msg.value <= 1 ether)
            {
                tokenCount = tokenCount + 0;
            }
            else if(msg.value <= 2 ether)
            {
                tokenCount = tokenCount + safeDiv(tokenCount,10);
            }
            else if(msg.value <= 5 ether)
            {
                tokenCount = tokenCount + safeDiv(tokenCount,20);
            }
            else if(msg.value <= 10 ether)
            {
                tokenCount = tokenCount + safeDiv(tokenCount,30);
            }
            else if(msg.value <= 50 ether)
            {
                tokenCount = tokenCount + safeDiv(tokenCount,40);
            }
            else
            {
                tokenCount = tokenCount + safeDiv(tokenCount,50);
            }
            
            // Transfer Tokens To Sender Address
            ERC20Interface(tokenContractAddress).transfer(msg.sender, tokenCount);
            
            // Transfer ETH To Contribution Address
            ethContributionAddress.transfer(msg.value);
        }
        
    }

}
// Defined JOBTokenSelfDrop Contract
function getContractAddress() public view returns (address tokenAddress)
{
    return tokenContractAddress;
}

// Get Token Contract Address