Skip to content

Add OwnershipTransferred event to Ownable contract and its derivatives#424

Merged
frangio merged 4 commits into
OpenZeppelin:masterfrom
eugene-babichenko:transfer-ownership-event
Sep 7, 2017
Merged

Add OwnershipTransferred event to Ownable contract and its derivatives#424
frangio merged 4 commits into
OpenZeppelin:masterfrom
eugene-babichenko:transfer-ownership-event

Conversation

@eugene-babichenko

Copy link
Copy Markdown
Contributor

Me and my team consider this feature very useful at least for debugging purposes, but we also believe it will give more transparency for library users. OwnershipTransferred event is being fired each time an ownership transfer really takes place (i.e. in Ownable.transferOwnership, Claimable.claimOwnership and DelayedClaimable. Claimable.claimOwnership).

@frangio

frangio commented Sep 5, 2017

Copy link
Copy Markdown
Contributor

Great contribution @eugene-babichenko! Definitely agree on the transparency aspect.

I'm wondering if the event should also log the previous owner. Technically the information would be available in the previously emitted events, but I think it would be good if each event was self-contained.

@eugene-babichenko

Copy link
Copy Markdown
Contributor Author

@frangio added this field to the event, check it out, please.

function transferOwnership(address newOwner) onlyOwner {
require(newOwner != address(0));
owner = newOwner;
OwnershipTransferred(owner, newOwner);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is failing to log the previous owner because it's updated in the previous line. The event should be emitted first, and then the state variable updated.

@eugene-babichenko

Copy link
Copy Markdown
Contributor Author

Fixed that

@frangio

frangio commented Sep 7, 2017

Copy link
Copy Markdown
Contributor

Thanks!

@frangio frangio merged commit 84be318 into OpenZeppelin:master Sep 7, 2017
ProphetDaniel pushed a commit to classicdelta/Smart-Contracts that referenced this pull request Mar 9, 2018
…wnership-event

Add OwnershipTransferred event to Ownable contract and its derivatives
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants