Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions core/scripts/cli/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All of our tutorials require that you complete the steps in [Prerequisites](./pr
## Deploy smart contracts to Ganache

First, we'll start a blockchain locally using Ganache and deploy the UMA smart contracts to it. The underlying products
we can track are configured via a json file `identifiers.json`. More details on this can be found [here](../explainers/price-feed-configuration.md).
we can track are configured via a json file `identifiers.json`. More details on this can be found [here](../explainers/price_feed_configuration.md).

Run all commands in this section from the `core/` directory.

Expand Down Expand Up @@ -55,4 +55,4 @@ Run all commands in this section from the `sponsor-dapp-v2/` directory.
We now have a synthetic token tracking the BTC/USD price.

To see our token valuation change as the BTC price changes, we can either push more prices using
`ManualPublishPriceFeed.js`, as above, or see the price-feed-configuration.md doc to set up a real price feed.
`ManualPublishPriceFeed.js`, as above, or see the [doc](../explainers/price_feed_configuration.md) to set up a real price feed.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ in ETH, and depend upon the price of BTC/USD.
## Prerequisites

All of our tutorials require that you complete the steps in [Prerequisites](./prerequisites.md). If you are new to the UMA
system, start with [Creating tokens locally](./creating-tokens-locally.md) to get a gentle introduction.
system, start with [Creating tokens locally](./creating_tokens_locally.md) to get a gentle introduction.

Make sure you have testnet ETH or are running locally. All commands should be run from the `core` directory.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ necessary if the identifier (or underlying asset) you want to track isn't suppor
identifiers, see [identifiers.json](https://github.com/UMAprotocol/protocol/blob/master/core/config/identifiers.json).

If you'd like more information on what an identifier is and how to configure a price feed, please see
[our explainer](../explainers/price-feed-configuration.md).
[our explainer](../explainers/price_feed_configuration.md).

## Prerequisites

Expand Down Expand Up @@ -121,4 +121,4 @@ is greater than the previous timestamp you provided, but not in the future.
To deploy a Tokenized Derivative that uses your price feed, you'll want to change the `priceFeedAddress` parameter to
your price feed address from above and the `product` parameter to `Custom Index (1)` (converted to `bytes32`). The
specific instructions for how to deploy a custom TokenizedDerivative are in
[this tutorial](./customizing-tokens-via-cli.md) - you'll just need to remember these two parameters.
[this tutorial](./customizing_tokens_via_cli.md) - you'll just need to remember these two parameters.
87 changes: 87 additions & 0 deletions documentation/tutorials/using_the_voting_cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Voting Command Line Interface (CLI)

We provide a user-friendly command line interface for voting on price requests and retrieving rewards.

# Installation

We will walk you through setting up the CLI by first cloning the repo and then symlink-ing the CLI command to your global directory.

We assume that you have followed the [Prerequisites](./prerequisites.md) (cloned the monorepo and installed dependencies for the root directory via `npm install`) and are in the root directory (i.e. `protocol`).

1. Symlink the CLI to your global directory. This will allow you to run the voting CLI by simply typing: `uma ...`. The specific command that is run is listed in the `bin` property of the root `package.json`. A simple alternative to this step is to run `npm install -g ./` which installs the UMA monorepo to your global directory and implicitly symlinks the `uma` command globally.

```sh
npm link
```
OR
```sh
npm install -g ./
```

2. Start the voting CLI by passing in the provider

```sh
uma --network <provider>
```

# Providers

We strongly recommend using a non-Metamask provider and prefer the "NETWORK_privatekey" option. For more on the specific issues that using a Metamask provider opens, see [Known Bugs](#known-bugs). Storing a private key in an environment variable is a safe compromise between convenience and security provided your local machine is not compromised. To set an environment variable, run:
```sh
export ENV_VARIABLE_NAME="VALUE"
```
To unset an environment variable, run:
```sh
unset ENV_VARIABLE_NAME
```
And to print out your environment variables, run:
```sh
printenv
```

Here are the various providers you can use:

- Connect to your local development network with the first test account as your default account. This would be useful for developers using [Ganache](https://github.com/trufflesuite/ganache). Note that you will first have to deploy the contracts to your local network via `truffle migrate --reset network`:

```sh
uma --network test
```

- Connect to mainnet with the private key stored in the environment variable `PRIVATE_KEY`:

```sh
uma --network mainnet_privatekey
```

- Connect to testnet with the mnemonic stored in the environment variable `MNEMONIC`. This will use the first account tied to the mnemonic as the signer account:

```sh
uma --network kovan_mnemonic
```

- Connect to mainnet and vote with your two key contract, address stored in the environment variable `TWO_KEY_ADDRESS`, and the private key of the voter account stored in `PRIVATE_KEY`. We recommend this method as the most secure way to store ownership to your voting tokens in cold storage while conveniently being able to vote with the tokens via a hot wallet:

```sh
uma --network mainnet_privatekey
```

- Connect with your Metamask provider:

```sh
uma --network metamask
```

# Features

After starting the CLI tool, a menu will appear. There will always be options "help" (to print out a list of commands) and "exit/back" (quit the tool or go back to the previous menu).

## Modules

Selecting these lead to further menus with relevant actions:
- *Wallet*: View token balances for default account, from which you can vote
- *Vote*: Commit and reveal votes, retrieve rewards, and view results of previous votes.
- *Admin*: Vote on system administrator proposals

# Known Bugs:

- Metamask: retrieving rewards and viewing past vote results does not work well with the Metamask provider, specifically because it does not do a great job of reading past event logs. To read more technical details about the issue, go [here](https://github.com/UMAprotocol/protocol/issues/901).