-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
💥 Refactor TimelockController
Using Stateful Modules
#202
💥 Refactor TimelockController
Using Stateful Modules
#202
Conversation
uses modules from vyper 0.4.0 this is kind of a demonstration of the new feature rename some interface files to `*.vyi`. (i was not thorough, i just did enough to get TimelockController.vy to compile)
TimelockController
Using Stateful Modules
That's so cool! I thought we wanted to get rid of |
src/governance/TimelockController.vy
Outdated
# Set the optional admin. | ||
if (admin_ != empty(address)): | ||
self._grant_role(DEFAULT_ADMIN_ROLE, admin_) | ||
acl.__init__() |
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.
As a note for later: since I currently allocate ADDITIONAL_ROLE_1
and ADDITIONAL_ROLE_2
at construction-time (see here), this will also allocate these additional roles if called acl.__init__
. We should refactor AccessControl
by only allocating DEFAULT_ADMIN_ROLE
and let the user set up further roles.
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 for this line:
if (admin_ != empty(address)):
self._grant_role(DEFAULT_ADMIN_ROLE, admin_)
We could use
if (admin_ != empty(address)):
acl._grant_role(DEFAULT_ADMIN_ROLE, admin_)
# the following Twitter thread: | ||
# https://twitter.com/pcaversaccio/status/1626514029094047747. | ||
enum OperationState: | ||
flag OperationState: |
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.
why do you delete my comment here lol? flags
still behave like the description ;)
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 assumed it wasn't needed anymore since the naming is no longer a point of confusion -- i can add it back though
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
For testing purposes, this PR now runs against Vyper's 2024-02-13T09:14:49.446621Z ERROR cheatcodes: non-empty stderr input=["vyper", "src/governance/TimelockController.vy"] stderr="vyper.exceptions.InitializerException: module `src/auth/AccessControl.vy` is used but never initialized!\n\n (hint: add `initializes: acl` to the top level of your main contract)\n\n contract \"src/governance/TimelockController.vy:54\", line 54:0 \n 53\n ---> 54 uses: acl\n --------^\n 55\n\n" |
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Closing in favour of #207. |
uses modules from vyper 0.4.0
this is kind of a demonstration of the new feature
rename some interface files to
*.vyi
. (i was not thorough, i just didenough to get TimelockController.vy to compile)
🐶 Cute Animal Picture