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

Add CLI command to activate votes #1843

Merged
merged 9 commits into from
Nov 25, 2019
Merged

Add CLI command to activate votes #1843

merged 9 commits into from
Nov 25, 2019

Conversation

asaj
Copy link
Contributor

@asaj asaj commented Nov 23, 2019

Description

This PR adds a CLI command to activate any pending votes for an account, with the option to poll until the epoch is over and the votes can be activated.

Tested

Manually via against ganache.

Related issues

Backwards compatibility

Backwards compatible

@codecov
Copy link

codecov bot commented Nov 23, 2019

Codecov Report

❗ No coverage uploaded for pull request base (asaj/cli@473d8e5). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             asaj/cli   #1843   +/-   ##
==========================================
  Coverage            ?   74.2%           
==========================================
  Files               ?     278           
  Lines               ?    7653           
  Branches            ?     672           
==========================================
  Hits                ?    5679           
  Misses              ?    1857           
  Partials            ?     117
Flag Coverage Δ
#mobile 74.2% <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 473d8e5...174cb6b. Read the comment docs.

Copy link
Contributor

@nambrot nambrot left a comment

Choose a reason for hiding this comment

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

Just minor comments

}
}
const txos = await election.activate(account)
for (const txo of txos) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using concurrentMap here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per @mcortesi's recommendation, intentionally doing this serially.

const accounts = await this.kit.contracts.getAccounts()
const account = await accounts.voteSignerToAccount(res.flags.from)
const txos = await election.revoke(account, res.flags.for, new BigNumber(res.flags.value))
for (const txo of txos) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto concurrentMap

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per @mcortesi's recommendation, intentionally doing this serially.

packages/cli/src/utils/helpers.ts Show resolved Hide resolved
packages/contractkit/src/wrappers/Election.ts Show resolved Hide resolved
@asaj asaj added the automerge Have PR merge automatically when checks pass label Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Have PR merge automatically when checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants