contract Ownable {
  address public owner;  
  
  mapping (address => bool) public finances;
  
  event addFinanceEvent(address indexed newFinance, bool success);
  event delFinanceEvent(address indexed newFinance, bool success);
  
   /**
   * @dev 构造函数将合同的原始所有者设置为发送方
   */
  constructor() public payable {
    owner = msg.sender;
    finances[msg.sender] = true;
  }
  
  /**
   * @dev 如果被除所有者之外的任何帐户调用，则抛出。
   */
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }
      
    modifier onlyFinance() {
        require(finances[msg.sender] == true);
        _;
    }
  
    /**
    * @dev 允许当前所有者将合同的控制权转移给新所有者。
    * @param newOwner 将所有权转移到的地址.
    */
    function transferOwnership(address newOwner) onlyOwner public {
        require(newOwner != address(0));
        owner = newOwner;
    }
  
  
    function addFinance(address newFinance) onlyOwner public returns (bool success){
        require(newFinance != address(0));
        require(finances[newFinance] != true);
        
        finances[newFinance] = true;
        
        bool isSuccess = finances[newFinance];
        emit addFinanceEvent(newFinance, isSuccess);
        return isSuccess;
    }
    
    function delFinance(address finance) onlyOwner public returns (bool success){
        require(finance != address(0));
        require(finances[finance] == true);
        
        delete finances[finance];
        emit delFinanceEvent(finance, finances[finance]);
        return true;
    }
}
function transferOwnership(address newOwner) onlyOwner public {
    require(newOwner != address(0));
    owner = newOwner;
}

/**
 * @dev 允许当前所有者将合同的控制权转移给新所有者。
 * @param newOwner 将所有权转移到的地址.
 */