-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add OwnershipTransferred event to Ownable contract and its derivatives #424
Add OwnershipTransferred event to Ownable contract and its derivatives #424
Conversation
… instance actually changed
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. |
@frangio added this field to the event, check it out, please. |
contracts/ownership/Ownable.sol
Outdated
@@ -35,6 +38,7 @@ contract Ownable { | |||
function transferOwnership(address newOwner) onlyOwner { | |||
require(newOwner != address(0)); | |||
owner = newOwner; | |||
OwnershipTransferred(owner, newOwner); |
There was a problem hiding this comment.
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.
Fixed that |
Thanks! |
…wnership-event Add OwnershipTransferred event to Ownable contract and its derivatives
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. inOwnable.transferOwnership
,Claimable.claimOwnership
andDelayedClaimable. Claimable.claimOwnership
).