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

Doc changes to address frequently asked questions #2209

Merged
merged 13 commits into from
Dec 12, 2019
Merged
8 changes: 6 additions & 2 deletions packages/cli/src/commands/election/activate.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { sleep } from '@celo/utils/lib/async'
import { flags } from '@oclif/command'
import { cli } from 'cli-ux'
import { BaseCommand } from '../../base'
import { newCheckBuilder } from '../../utils/checks'
import { displaySendTx } from '../../utils/cli'
import { Flags } from '../../utils/command'

export default class ElectionVote extends BaseCommand {
static description = 'Activate pending votes in validator elections to begin earning rewards'
static description =
'Activate pending votes in validator elections to begin earning rewards. To earn rewards as a voter, it is required to activate your pending votes at some point after the end of the epoch in which they were made.'

static flags = {
...BaseCommand.flags,
from: Flags.address({ required: true, description: "Voter's address" }),
wait: flags.boolean({ description: 'Wait until all pending votes become activatable' }),
wait: flags.boolean({ description: 'Wait until all pending votes can be activated' }),
}

static examples = [
Expand All @@ -33,9 +35,11 @@ export default class ElectionVote extends BaseCommand {
if (hasPendingVotes) {
if (res.flags.wait) {
// Spin until pending votes become activatable.
cli.action.start(`Waiting until pending votes can be activated`)
while (!(await election.hasActivatablePendingVotes(account))) {
await sleep(1000)
}
cli.action.stop()
}
const txos = await election.activate(account)
for (const txo of txos) {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/utils/checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ class CheckBuilder {

isNotAccount = (address: Address) =>
this.addCheck(
`${address} is not an Account`,
`${address} is not a registered Account`,
this.withAccounts((accs) => negate(accs.isAccount(address)))
)

isSignerOrAccount = () =>
this.addCheck(
`${this.signer!} is Signer or Account`,
`${this.signer!} is Signer or registered Account`,
this.withAccounts(async (accs) => {
const res = (await accs.isAccount(this.signer!)) || (await accs.isSigner(this.signer!))
return res
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- [Celo Protocol](celo-codebase/protocol/README.md)
- [Consensus](celo-codebase/protocol/consensus/README.md)
- [Validator Set Differences](celo-codebase/protocol/consensus/validator-set-differences.md)
- [Locating Validators](celo-codebase/protocol/consensus/locating-validators.md)
- [Locating Nodes](celo-codebase/protocol/consensus/locating-nodes.md)
- [Ultralight Sync](celo-codebase/protocol/consensus/ultralight-sync.md)
- [Proof of Stake](celo-codebase/protocol/proof-of-stake/README.md)
- [Validator Groups](celo-codebase/protocol/proof-of-stake/validator-groups.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Most of Celo's Proof of Stake mechanism is implemented as smart contracts, and a

- [`Validators.sol`](https://github.com/celo-org/celo-monorepo/blob/master/packages/protocol/contracts/governance/Validators.sol) handles registration, deregistration, staking, key management and epoch rewards for validators and validator groups, as well as routines to manage the members of groups.

- [`Elections.sol`](https://github.com/celo-org/celo-monorepo/blob/master/packages/protocol/contracts/governance/Elections.sol) manages Locked Gold voting and epoch rewards and runs Validator Elections.
- [`Election.sol`](https://github.com/celo-org/celo-monorepo/blob/master/packages/protocol/contracts/governance/Election.sol) manages Locked Gold voting and epoch rewards and runs Validator Elections.

In Celo blockchain:

Expand Down
4 changes: 2 additions & 2 deletions packages/docs/command-line-interface/election.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ description: Participate in and view the state of Validator Elections

### Activate

Activate pending votes in validator elections to begin earning rewards
Activate pending votes in validator elections to begin earning rewards. To earn rewards as a voter, it is required to activate your pending votes at some point after the end of the epoch in which they were made.

```
USAGE
$ celocli election:activate

OPTIONS
--from=0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d (required) Voter's address
--wait Wait until all pending votes become activatable
--wait Wait until all pending votes can be activated

EXAMPLES
activate --from 0x4443d0349e8b3075cba511a0a87796597602a0f1
Expand Down
Loading