浏览代码

Merge pull request #424 from eugene-babichenko/transfer-ownership-event

Add OwnershipTransferred event to Ownable contract and its derivatives
Francisco Giordano 8 年之前
父节点
当前提交
84be318ca9
共有 3 个文件被更改,包括 6 次插入0 次删除
  1. 1 0
      contracts/ownership/Claimable.sol
  2. 1 0
      contracts/ownership/DelayedClaimable.sol
  3. 4 0
      contracts/ownership/Ownable.sol

+ 1 - 0
contracts/ownership/Claimable.sol

@@ -32,6 +32,7 @@ contract Claimable is Ownable {
    * @dev Allows the pendingOwner address to finalize the transfer.
    */
   function claimOwnership() onlyPendingOwner {
+    OwnershipTransferred(owner, pendingOwner);
     owner = pendingOwner;
     pendingOwner = 0x0;
   }

+ 1 - 0
contracts/ownership/DelayedClaimable.sol

@@ -33,6 +33,7 @@ contract DelayedClaimable is Claimable {
    */
   function claimOwnership() onlyPendingOwner {
     require((block.number <= end) && (block.number >= start));
+    OwnershipTransferred(owner, pendingOwner);
     owner = pendingOwner;
     pendingOwner = 0x0;
     end = 0;

+ 4 - 0
contracts/ownership/Ownable.sol

@@ -10,6 +10,9 @@ contract Ownable {
   address public owner;
 
 
+  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
+
+
   /**
    * @dev The Ownable constructor sets the original `owner` of the contract to the sender
    * account.
@@ -34,6 +37,7 @@ contract Ownable {
    */
   function transferOwnership(address newOwner) onlyOwner {
     require(newOwner != address(0));      
+    OwnershipTransferred(owner, newOwner);
     owner = newOwner;
   }