-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Improve encapsulation on lifecycle, ownership and payments #1269
Improve encapsulation on lifecycle, ownership and payments #1269
Conversation
bcc442e
to
fe431bf
Compare
Rebased on |
contracts/ownership/Ownable.sol
Outdated
/** | ||
* @return the address of the owner. | ||
*/ | ||
function getOwner() public view returns(address) { |
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.
I'm not fond of starting this convention of getters prefixed with get
. I feel like it goes against the rest of the ecosystem.
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 what we discussed about having verbs on function names. I won't like it, but I can remove the get
s and try to convince the ecosystem to use them before 3.0.
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.
Yes, I'd prefer to remove the get
.
contracts/payment/RefundEscrow.sol
Outdated
* @return the current state of the escrow. | ||
*/ | ||
function getState() public view returns(State) { | ||
return state_; |
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.
any idea how to test this?
When I do something like:
(await this.escrow.getState()).should.be.equal(1);
I get:
AssertionError: expected { Object (s, e, ...) } to equal 1
I might be doing something dumb here.
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.
I think the error just means that they're not the same thing. Try using should.be.bignumber.equal
to get a nicer error message.
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.
that helped, thanks!
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.
Thanks @ElOpio! π
contracts/ownership/Claimable.sol
Outdated
} | ||
|
||
/** | ||
* @dev Allows the pendingOwner address to finalize the transfer. | ||
*/ | ||
function claimOwnership() public onlyPendingOwner { | ||
emit OwnershipTransferred(owner, pendingOwner); | ||
owner = pendingOwner; | ||
pendingOwner = address(0); |
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 line should stay because it's not part of _transferOwnership
. But we've removed Claimable
in #1274.
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.
Ah, #1274 is not merged yet.
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.
indeed, and no test failed π
Should not be merged until previous comment is fixed or #1274 is merged.
@ElOpio Can you fix the merge conflicts please? |
contracts/ownership/Claimable.sol
Outdated
@@ -40,5 +40,6 @@ contract Claimable is Ownable { | |||
*/ | |||
function claimOwnership() public onlyPendingOwner { | |||
_transferOwnership(pendingOwner_); | |||
pendingOwner = address(0); |
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.
Missing underscore suffix! π£
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.
goddammit! I should have breakfast first :D
@frangio resolved |
There's something weird with the coverage report. The lines it report uncovered have specific tests added on this PR, and that lead to full coverage on previous commits. Maybe, I broke something on one merge, or maybe it's coveralls being nuts. |
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.
I'm not sure why coverage decreased either. It could be related to only testing those functions with actual members of the mapping... But this shouldn't be a problem. Let's merge anyway. Thanks!
This is part of #1174
Requires #1254.
npm run lint:all:fix
).