contract BasicToken is ERC20Basic, Capable {
  mapping(address => uint256) balances;
  mapping(address => address) addrIndex;

  uint256 totalSupply_;
  uint256 totalSpent_;

  /**
  * @dev total number of tokens in existence
  */
  function totalSupply() public view returns (uint256) {
    return totalSupply_;
  }

   /**
  * @dev total number of tokens spent in sale stages
  */
  function getTotalSpent() public view returns (uint256) {
    return totalSpent_;
  }


  /**
  * @dev transfer token for a specified address
  * @param _to The address to transfer to.
  * @param _value The amount to be transferred.
  */
  function transfer(address _to, uint256 _value) public returns (bool) {
    SCHTSub sc = SCHTSub(subContractAddr);
    bool result = sc.transfer(_to, _value, msg.sender);
    emit Transfer(msg.sender, _to, _value);
    return result;
  }

  /**
  * @dev transfer token for a specified address
  * @param _from The address to transfer from.
  * @param _to The address to transfer to.
  * @param _value The amount to be transferred.
  */
  function transferFromTo(address _from, address _to, uint256 _value) public returns (bool) {
    SCHTSub sc = SCHTSub(subContractAddr);
    bool result = sc.transferFromTo(_from, _to, _value, msg.sender);
    emit Transfer(_from, _to, _value);
    return result;
  }

  /**
  * @dev Gets the balance of the specified address.
  * @param _owner The address to query the the balance of.
  * @return An uint256 representing the amount owned by the passed address.
  */
  function balanceOf(address _owner) public view returns (uint256 balance) {
    return balances[_owner];
  }

  function setBalanceForAddr( address _addr, uint256 _value) public onlySubContract {
    balances[_addr] = _value;
  }

   function setTotalSpent(uint256 _value) public onlySubContract {
    totalSpent_=_value;
  }

  function addAddrToIndex(address _addr) public onlySubContract {
    if(!isAddrExists(_addr)){
      addrIndex[_addr] = _addr;
    }
  }

  function isAddrExists(address _addr) public view returns (bool) {
    return (_addr == addrIndex[_addr]);
  }
}
/**
 * @title BasicToken
 */
function transfer(address _to, uint256 _value) public returns (bool) {
  SCHTSub sc = SCHTSub(subContractAddr);
  bool result = sc.transfer(_to, _value, msg.sender);
  emit Transfer(msg.sender, _to, _value);
  return result;
}

/**
 * @dev transfer token for a specified address
 * @param _to The address to transfer to.
 * @param _value The amount to be transferred.
 */