contract VCBCrowdSaleNew is Crowdsale, Ownable {

    using SafeMath for uint256;

    uint  constant RATIO = 9000;
    uint constant SALELASTFOR = 31 days;
    address constant FUNDWALLET = 0x622969e0928fa6bEeda9f26F8a60D0b22Db7E6f1;
    address constant PRESALE = 0x638a3C7dF9D1B3A56E19B92bE07eCC84b6475BD6;
    address constant OLDCROWDSALE = 0x84098D815D54668BdA5FC9C0f0FC8783bA749947;

    mapping(address => uint16) sellList;

    event CrowdsaleFinalized();

    function VCBCrowdSaleNew(uint256 start) Crowdsale(start, start + SALELASTFOR, RATIO, FUNDWALLET) public {        
    }

    function createTokenContract() internal returns (MintableToken) {
        VCBCrowdSale oldsale = VCBCrowdSale(OLDCROWDSALE);
        weiRaised = oldsale.weiRaised();
        return oldsale.token();
    }

    //our crowdsale can stop at anytime, and then the totally crowsale contract is disappear
    function finalize(address _finaladdr) onlyOwner public {

        CrowdsaleFinalized();

        address finaladdr = PRESALE;
        if (_finaladdr != address(0)) {
            finaladdr = _finaladdr;
        }

        uint256 restbalance = token.balanceOf(this);
        token.transfer(finaladdr, restbalance);
        selfdestruct(finaladdr);
    }  

    // override token purchase to transfer token hold by contract 
    function buyTokens(address beneficiary) public payable {

        require(beneficiary != address(0));
        require(validPurchase());

        //get rate from sellList, and only this member can buy
        uint16 usedrate = sellList[beneficiary];
        require(usedrate > 0);

        uint256 weiAmount = msg.value;
        uint256 curbalance = token.balanceOf(this);

        // calculate token amount to be created
        uint256 tokens = weiAmount.mul(usedrate);

        require(curbalance >= tokens);

        // update state
        weiRaised = weiRaised.add(weiAmount);

        token.transfer(beneficiary, tokens);
        TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);

        forwardFunds();
    }

    function addPurchaser(address u) onlyOwner public {
        sellList[u] = uint16(rate);
    }

    function addSpecial(address u, uint16 ratio) onlyOwner public {
        require(ratio > uint16(rate));
        sellList[u] = ratio;
    }

    /**
    * @dev Gets the ratio of the specified address.
    * @param _owner The address to query the gift ratio of.
    * @return An uint16 representing the ratio obtained by the passed address.
    */
    function getRatioOf(address _owner) public view returns (uint16 ratio) {
        return sellList[_owner];
    } 

}
function getRatioOf(address _owner) public view returns (uint16 ratio) {
    return sellList[_owner];
} 

/**
 * @dev Gets the ratio of the specified address.
 * @param _owner The address to query the gift ratio of.
 * @return An uint16 representing the ratio obtained by the passed address.
 */