-
Notifications
You must be signed in to change notification settings - Fork 373
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
feat: add p/demo/ownable #1314
feat: add p/demo/ownable #1314
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1314 +/- ##
==========================================
+ Coverage 47.87% 47.91% +0.04%
==========================================
Files 372 372
Lines 63019 63019
==========================================
+ Hits 30168 30196 +28
+ Misses 30384 30362 -22
+ Partials 2467 2461 -6 ☔ View full report in Codecov by Sentry. |
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 👍
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.
Looks mostly good for me, just a small nit about Getters and Setters conventions in Go.
The only thing that bothers me is that the Ownable logic is not thread-safe (you can have race conditions modifying the owner variable, causing problems), maybe is not a problem on Gno.
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.
Left some minor suggestions. Rest LGTM 💯
## Description This PR adds the `Pausable` package to p/demo, allowing realms to have pausability. It relies on the already existing `Ownable` package for access control, #1314. Inspired by OpenZeppelin's [Pausable](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.3/contracts/security/Pausable.sol). <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details> --------- Co-authored-by: Morgan Bazalgette <[email protected]>
## Description This PR adds the `Pausable` package to p/demo, allowing realms to have pausability. It relies on the already existing `Ownable` package for access control, gnolang#1314. Inspired by OpenZeppelin's [Pausable](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.3/contracts/security/Pausable.sol). <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details> --------- Co-authored-by: Morgan Bazalgette <[email protected]>
Description
This PR adds the
Ownable
package to p/demo, allowing users to have simple ownership control in realms, at top-level, as well as per-object ownership through Golang's embedding & anonymous embedding features.Inspired by OpenZeppelin's Ownable, with minor modifications.
Ignore commits before Oct 25th, they were added by mistake.
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description