Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to override owner #3

Merged
merged 3 commits into from
Aug 29, 2018
Merged

Add ability to override owner #3

merged 3 commits into from
Aug 29, 2018

Conversation

hiddentao
Copy link
Collaborator

Needed for our incoming Deployer contract

Needed for our incoming Deployer contract
@makoto
Copy link
Collaborator

makoto commented Aug 27, 2018

Please add a test

@hiddentao
Copy link
Collaborator Author

@makoto I've added tests

@@ -39,7 +39,7 @@ module.exports = function(deployer) {
deployer
.then(() => {
console.log([name, deposit,limitOfParticipants, coolingPeriod, encryption].join(','));
return deployer.deploy(Conference, name, deposit,limitOfParticipants, coolingPeriod, encryption);
return deployer.deploy(Conference, name, deposit,limitOfParticipants, coolingPeriod, encryption, owner);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably no need to pass owner here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or pass 0x to use the default value (= msg.sender). By doing so we can get rid of owner variable altogether as we are also getting rid of ENS contracts from migration

) public {
if (_owner != address(0)) {
owner = _owner;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think of getting rid of https://github.com/noblocknoparty/blockparty-contracts/blob/1a6f355b5134fc9133a447a0010e09753aca2b20/contracts/zeppelin/ownership/Ownable.sol#L21

and specify owner here explicitly like this.

        if (_owner != address(0)) {
            owner = _owner;
        }else{
            owner = msg.sender;
        }

If inheritance works like Ownable#constructor => Party#constructor then we are setting value to owner twice (and I am guessing this is how owner is falling back to msg.owner if 0 address is passed ). Doing this way, we only set it once and may potentially save gas cost as well as we don't have to worry about how inheritance order works.

@hiddentao
Copy link
Collaborator Author

@makoto Made fixes.

Copy link
Collaborator

@makoto makoto left a comment

Choose a reason for hiding this comment

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

The gas cost increase looks temporary so good to go

@hiddentao hiddentao merged commit d0ad667 into master Aug 29, 2018
@hiddentao hiddentao deleted the hiddentao-patch-1 branch August 29, 2018 19:38
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