-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Azavalla feature/inheritable contract #680
Azavalla feature/inheritable contract #680
Conversation
contracts/ownership/Heritable.sol
Outdated
uint public heartbeatTimeout; | ||
|
||
// Timestamp of the owner's death, as pronounced by the heir. | ||
uint public timeOfDeath; |
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.
what do you think about using uint256
explicitly?
require(newHeir != owner); | ||
heartbeat(); | ||
HeirChanged(owner, newHeir); | ||
heir = newHeir; |
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.
If we provide a setter, I would go with a private
visibility for the heir
and providing a getter as well. This will ensure that inheriting contracts can not modify the heir
in another way than the one proposed.
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.
we may want the same thing for heartbeatTimeout
and timeOfDeath
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.
Makes sense, but this is not something we're implementing in general in OZ. Eg. Ownable has:
address public owner
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.
Actually we are caring about this from now on
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.
Great. I won't be changing it in this PR tho.
I will create an issue instead and ping @azavalla
contracts/ownership/Heritable.sol
Outdated
} | ||
|
||
function setHeartbeatTimeout(uint newHeartbeatTimeout) internal onlyOwner { | ||
require(ownerLives()); |
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.
do we want a heartbeat to be greater than 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.
What do you mean? Do you mean that we should check for newHeartbeatTimeout > 0
?
If so, isn't that implied in the uint
type?
contract SimpleSavingsWallet is Heritable { | ||
|
||
event Sent(address payee, uint amount, uint balance); | ||
event Received(address payer, uint amount, uint balance); |
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.
2 things:
- addresses may be indexed?
- we should use
uint256
here too
LGTM |
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.
LGTM
…/inheritable-contract Azavalla feature/inheritable contract
Manual merge for PR #595
Applies styling to tests.