diff --git a/core/scripts/cli/README.md b/core/scripts/cli/README.md deleted file mode 100644 index fa5cc3f372..0000000000 --- a/core/scripts/cli/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Connecting your Ethereum Account -You have several methods for using the CLI tool with your Ethereum accounts -- Developers on localhost: If you are using [Ganache](https://github.com/trufflesuite/ganache) then pass in `--network test` to use the first account object that provided to you by Ganache. Note that you will have to deploy the contracts to your local network via `truffle migrate --reset network`. -- Private keys or Mnemonics of Hot Wallets containing UMA tokens: `--network _privatekey` or `--network _mnemonic_` will use the default account connected to the relevant environment variable: `PRIVATE_KEY` or `MNEMONIC` -- 2-Key Contract: If you are voting via a proxy contract, which we recommend 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, then set your environment variable `TWO_KEY_ADDRESS` to the Ethereum address of your deployed 2-Key contract. For this to work correctly, the `PRIVATE_KEY` or `MNEMONIC` must be associated with the "voter" role of the 2-Key contract. - -# Still needs to be tested: -- Metamask: starting the cli with `--network metamask` will correctly read your current Metamask account, but signing transactions does not work properly as the CLI tool appears to be unaware of when transactions are sent successfully by metakas \ No newline at end of file diff --git a/documentation/explainers/keys-and-networks.md b/documentation/explainers/keys_and_networks.md similarity index 100% rename from documentation/explainers/keys-and-networks.md rename to documentation/explainers/keys_and_networks.md diff --git a/documentation/explainers/price-feed-configuration.md b/documentation/explainers/price_feed_configuration.md similarity index 100% rename from documentation/explainers/price-feed-configuration.md rename to documentation/explainers/price_feed_configuration.md diff --git a/documentation/explainers/tokenized-derivative.md b/documentation/explainers/tokenized_derivative.md similarity index 100% rename from documentation/explainers/tokenized-derivative.md rename to documentation/explainers/tokenized_derivative.md diff --git a/documentation/tutorials/creating-tokens-locally.md b/documentation/tutorials/creating_tokens_locally.md similarity index 91% rename from documentation/tutorials/creating-tokens-locally.md rename to documentation/tutorials/creating_tokens_locally.md index 33552a272c..32442ee995 100644 --- a/documentation/tutorials/creating-tokens-locally.md +++ b/documentation/tutorials/creating_tokens_locally.md @@ -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. @@ -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. diff --git a/documentation/tutorials/customizing-tokens-via-cli.md b/documentation/tutorials/customizing_tokens_via_cli.md similarity index 99% rename from documentation/tutorials/customizing-tokens-via-cli.md rename to documentation/tutorials/customizing_tokens_via_cli.md index 1d369b48a8..0b3abf672e 100644 --- a/documentation/tutorials/customizing-tokens-via-cli.md +++ b/documentation/tutorials/customizing_tokens_via_cli.md @@ -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. diff --git a/documentation/tutorials/deploy-your-own-price-feed.md b/documentation/tutorials/deploy_your_own_price_feed.md similarity index 97% rename from documentation/tutorials/deploy-your-own-price-feed.md rename to documentation/tutorials/deploy_your_own_price_feed.md index f3e8549cd9..77c0f5a18e 100644 --- a/documentation/tutorials/deploy-your-own-price-feed.md +++ b/documentation/tutorials/deploy_your_own_price_feed.md @@ -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 @@ -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. diff --git a/documentation/tutorials/running-the-avs.md b/documentation/tutorials/running_the_avs.md similarity index 100% rename from documentation/tutorials/running-the-avs.md rename to documentation/tutorials/running_the_avs.md diff --git a/documentation/tutorials/using_the_voting_cli.md b/documentation/tutorials/using_the_voting_cli.md new file mode 100644 index 0000000000..e75dcc9803 --- /dev/null +++ b/documentation/tutorials/using_the_voting_cli.md @@ -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 +``` + +# 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). \ No newline at end of file