Skip to content
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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Update voting example #596

wants to merge 6 commits into from

Conversation

jasonpaulos
Copy link
Member

No description provided.

Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking really promising!

examples/application/abi/poll/contract.json Outdated Show resolved Hide resolved
tests/unit/compile_test.py Outdated Show resolved Hide resolved
Comment on lines +32 to +33
@router.method(name="open")
def open_poll() -> Expr:
Copy link
Contributor

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 👍

jasonpaulos and others added 2 commits November 15, 2022 11:22
Co-authored-by: Zeph Grunschlag <tzaffi@users.noreply.github.com>

@router.method(no_op=CallConfig.CREATE)
def create(
options: abi.StaticArray[abi.String, Literal[3]], can_resubmit: abi.Bool
Copy link
Contributor

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())),
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants