Commit 6f8e672f by Igor Sobolev Committed by Francisco Giordano

Gas optimizations in Ownable and Secondary contracts #1905 (#1910)

parent 52dc14c3
...@@ -19,8 +19,9 @@ contract Ownable is Context { ...@@ -19,8 +19,9 @@ contract Ownable is Context {
* @dev Initializes the contract setting the deployer as the initial owner. * @dev Initializes the contract setting the deployer as the initial owner.
*/ */
constructor () internal { constructor () internal {
_owner = _msgSender(); address msgSender = _msgSender();
emit OwnershipTransferred(address(0), _owner); _owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
} }
/** /**
......
...@@ -18,8 +18,9 @@ contract Secondary is Context { ...@@ -18,8 +18,9 @@ contract Secondary is Context {
* @dev Sets the primary account to the one that is creating the Secondary contract. * @dev Sets the primary account to the one that is creating the Secondary contract.
*/ */
constructor () internal { constructor () internal {
_primary = _msgSender(); address msgSender = _msgSender();
emit PrimaryTransferred(_primary); _primary = msgSender;
emit PrimaryTransferred(msgSender);
} }
/** /**
...@@ -44,6 +45,6 @@ contract Secondary is Context { ...@@ -44,6 +45,6 @@ contract Secondary is Context {
function transferPrimary(address recipient) public onlyPrimary { function transferPrimary(address recipient) public onlyPrimary {
require(recipient != address(0), "Secondary: new primary is the zero address"); require(recipient != address(0), "Secondary: new primary is the zero address");
_primary = recipient; _primary = recipient;
emit PrimaryTransferred(_primary); emit PrimaryTransferred(recipient);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment