Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
6f8e672f
Commit
6f8e672f
authored
Sep 10, 2019
by
Igor Sobolev
Committed by
Francisco Giordano
Sep 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gas optimizations in Ownable and Secondary contracts #1905 (#1910)
parent
52dc14c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
Ownable.sol
contracts/ownership/Ownable.sol
+3
-2
Secondary.sol
contracts/ownership/Secondary.sol
+4
-3
No files found.
contracts/ownership/Ownable.sol
View file @
6f8e672f
...
@@ -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);
}
}
/**
/**
...
...
contracts/ownership/Secondary.sol
View file @
6f8e672f
...
@@ -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
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment