contract InvestyContract is Ownable {
    using SafeMath for uint;

    InvestyToken public token = new InvestyToken();

    uint importIndex = 1; // the 0th address is a zero, iterating is started from 1

    /**
     * constructor
     */
    function InvestyContract() public{
    }
    
    /*
     * @dev Function to import balances from presale contract.
     * @parm number of balances to import
     * @return true
     */ 
    function importBalances(uint n, address presaleContractAddress) public onlyOwner returns (bool) {
       require(n > 0);

       InvestyPresale presaleContract = InvestyPresale(presaleContractAddress);
       InvestyToken presaleToken = presaleContract.token();

       while (n > 0) {
            address recipient = presaleContract.investors(importIndex);

            uint recipientTokens = presaleToken.balanceOf(recipient);
            token.mint(recipient, recipientTokens);
            
            n = n.sub(1);
            importIndex = importIndex.add(1);
       }
        
       return true;
    }

    /**
     * @dev Ownership of the PAY token contract is transfered to this owner.
     */
    function transferToken() public onlyOwner {
        token.transferOwnership(owner);
    }
}
/**
 * @title InvestyContract
 * @dev The main PAY token sale contract
 */
function InvestyContract() public{
}

/**
 * constructor
 */