contract wbcSale is Owned {
  
    using SafeMath for uint256;

    uint256 public constant totalSupply         = (12*10 ** 8) * (10 ** 6); // 12亿 WBC, decimals set to 6
    uint256 constant raiseSupply                =  totalSupply * 35 / 100; 
    uint256 constant reservedForTeam1           = totalSupply * 10 / 100;  
    uint256 constant reservedForTeam2           = totalSupply * 40 / 100; 
    uint256 constant reservedForTeam3           = totalSupply * 15 / 100; 

    WBC wbc; 
    address raiseAccount; // 
    address team1Account; // 
    address team2Account; // 
    address team3Account; //
    uint32 startTime=1533283200;

    bool public initialized=false;
    bool public finalized=false;



    constructor() public {

    }





    function blockTime() public view returns (uint32) {
        return uint32(block.timestamp);
    }




    

  


    function () public payable {
        revert();
    }



    function mintToTeamAccounts() internal onlyOwner{
        require(!initialized);
        wbc.mint(raiseAccount,raiseSupply);
        wbc.mint(team1Account,reservedForTeam1);
        wbc.mint(team2Account,reservedForTeam2);
        wbc.mint(team3Account,reservedForTeam3);
    }

    /// @notice initialize to prepare for sale
    /// @param _wbc The address wbc token contract following ERC20 standard
    function initialize (
        WBC _wbc,address raiseAcc,address team1Acc,address team2Acc,address team3Acc) public onlyOwner {
        require(blockTime()>=startTime);
        // ownership of token contract should already be this
        require(_wbc.owner() == address(this));
        require(raiseAcc!=0&&team1Acc != 0&&team2Acc != 0&&team3Acc != 0);
        wbc = _wbc;
        raiseAccount = raiseAcc;
        team1Account = team1Acc;
        team2Account = team2Acc;
        team3Account = team3Acc;
        mintToTeamAccounts();
        initialized = true;
        emit onInitialized();
    }

    /// @notice finalize
    function finalize() public onlyOwner {
        require(!finalized);
        // only after closed stage
        finalized = true;
        emit onFinalized();
    }

    event onInitialized();
    event onFinalized();
}
function finalize() public onlyOwner {
        require(!finalized);
        // only after closed stage
        finalized = true;
        emit onFinalized();
    }
/// @notice finalize