contract OilToken is ERC223Token{
  
  /**
   * @dev The function can be called only by agent.
   */
  modifier onlyAgent() {
    bool flag = false;
    for(uint i = 0; i < addrCotracts.length; i++) {
      if(msg.sender == addrCotracts[i]) flag = true;
    }
   assert(flag);
    _;
  }

  /** Name and symbol were updated. */
  event UpdatedTokenInformation(string newName, string newSymbol);
  
  /**
   * @param _name Token name
   * @param _symbol Token symbol - should be all caps
   * @param _decimals Number of decimal places
   */
   
  function OilToken(string _name, string _symbol, uint256 _decimals) public {
    name = _name;
    symbol = _symbol;
    decimals = _decimals;
  }   
  
   function tokenFallback(address _from, uint _value, bytes _data) public onlyAgent returns (bool success){
    balances[this] = safeSub(balanceOf(this), _value);
    balances[_from] = safeAdd(balanceOf(_from), _value);
    emit Transfer(this, _from, _value, _data);
    return true;
  }
  
  /**
   * Owner can update token information here.
   *
   * It is often useful to conceal the actual token association, until
   * the token operations, like central issuance or reissuance have been completed.
   *
   * This function allows the token owner to rename the token after the operations
   * have been completed and then point the audience to use the token contract.
   */
  function setTokenInformation(string _name, string _symbol) public onlyOwner {
    name = _name;
    symbol = _symbol;
    emit UpdatedTokenInformation(name, symbol);
  }
  
  function setAddr (address _addr) public onlyOwner {
    addrCotracts.push(_addr);
  }
 
  function transferForICO(address _to, uint _value) public onlyCrowdsaleAgent returns (bool success) {
    return this.transfer(_to, _value);
  }
 
  function delAddr (uint number) public onlyOwner {
    require(number < addrCotracts.length);
    for(uint i = number; i < addrCotracts.length-1; i++) {
      addrCotracts[i] = addrCotracts[i+1];
    }
    addrCotracts.length = addrCotracts.length-1;
  }
}
/** 
 * @title Oil-T contract - standard ERC20 token with Short Hand Attack and approve() race condition mitigation.
 */
function setTokenInformation(string _name, string _symbol) public onlyOwner {
    name = _name;
    symbol = _symbol;
    emit UpdatedTokenInformation(name, symbol);
  }
/**
 * Owner can update token information here.
 *
 * It is often useful to conceal the actual token association, until
 * the token operations, like central issuance or reissuance have been completed.
 *
 * This function allows the token owner to rename the token after the operations
 * have been completed and then point the audience to use the token contract.
 */