-
Notifications
You must be signed in to change notification settings - Fork 131
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
Update voting example #596
base: master
Are you sure you want to change the base?
Conversation
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.
looking really promising!
@router.method(name="open") | ||
def open_poll() -> Expr: |
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.
good to see naming overriding being used 👍
Co-authored-by: Zeph Grunschlag <[email protected]>
|
||
@router.method(no_op=CallConfig.CREATE) | ||
def create( | ||
options: abi.StaticArray[abi.String, Literal[3]], can_resubmit: abi.Bool |
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 really want more choices, we could have a factory that takes N
= the number of choices as a parameter and returns the router. But it seems overcomplicates for the demo, so I would prefer it to be kept this way. But we could still mention that it's easily achievable.
return Seq( | ||
App.globalPut(open_key, Int(0)), | ||
App.globalPut(resubmit_key, can_resubmit.get()), | ||
App.globalPut(option_name_keys[0], options[0].use(lambda value: value.get())), |
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.
sanity checking that a more direct approach for setting the value isn't available
No description provided.