contract WanToken is StandardToken {
    using SafeMath for uint;

    /// Constant token specific fields
    string public constant name = "WanCoin";
    string public constant symbol = "WAN";
    uint public constant decimals = 18;

    /// Wanchain total tokens supply
    uint public constant MAX_TOTAL_TOKEN_AMOUNT = 210000000 ether;

    /// Fields that are only changed in constructor
    /// Wanchain contribution contract
    address public minter; 
    /// ICO start time
    uint public startTime;
    /// ICO end time
    uint public endTime;

    /// Fields that can be changed by functions
    mapping (address => uint) public lockedBalances;
    /*
     * MODIFIERS
     */

    modifier onlyMinter {
        assert(msg.sender == minter);
        _;
    }

    modifier isLaterThan (uint x){
        assert(now > x);
        _;
    }

    modifier maxWanTokenAmountNotReached (uint amount){
        assert(totalSupply.add(amount) <= MAX_TOTAL_TOKEN_AMOUNT);
        _;
    }

    /**
     * CONSTRUCTOR 
     * 
     * @dev Initialize the Wanchain Token
     * @param _minter The Wanchain Contribution Contract     
     * @param _startTime ICO start time
     * @param _endTime ICO End Time
     */
    function WanToken(address _minter, uint _startTime, uint _endTime){
        minter = _minter;
        startTime = _startTime;
        endTime = _endTime;
    }

    /**
     * EXTERNAL FUNCTION 
     * 
     * @dev Contribution contract instance mint token
     * @param receipent The destination account owned mint tokens    
     * @param amount The amount of mint token
     * be sent to this address.
     */    
    function mintToken(address receipent, uint amount)
        external
        onlyMinter
        maxWanTokenAmountNotReached(amount)
        returns (bool)
    {
        require(now <= endTime);
        lockedBalances[receipent] = lockedBalances[receipent].add(amount);
        totalSupply = totalSupply.add(amount);
        return true;
    }

    /*
     * PUBLIC FUNCTIONS
     */

    /// @dev Locking period has passed - Locked tokens have turned into tradeable
    ///      All tokens owned by receipent will be tradeable
    function claimTokens(address receipent)
        public
        onlyMinter
    {
        balances[receipent] = balances[receipent].add(lockedBalances[receipent]);
        lockedBalances[receipent] = 0;
    }

    /*
     * CONSTANT METHODS
     */
    function lockedBalanceOf(address _owner) constant returns (uint balance) {
        return lockedBalances[_owner];
    }
}
/// @title Wanchain Token Contract
/// For more information about this token sale, please visit https://wanchain.org
/// @author Cathy - <cathy@wanchain.org>
function mintToken(address receipent, uint amount)
    external
    onlyMinter
    maxWanTokenAmountNotReached(amount)
    returns (bool)
{
    require(now <= endTime);
    lockedBalances[receipent] = lockedBalances[receipent].add(amount);
    totalSupply = totalSupply.add(amount);
    return true;
}

/**
 * EXTERNAL FUNCTION 
 * 
 * @dev Contribution contract instance mint token
 * @param receipent The destination account owned mint tokens    
 * @param amount The amount of mint token
 * be sent to this address.
 */