2022-03-01 08:01:56 +01:00
# CIC Token Deployment Tool
2022-03-16 09:55:13 +01:00
[![Status ](https://ci.grassecon.net/api/badges/cicnet/cic-cli/status.svg )](https://ci.grassecon.net/grassrootseconomics/cic)
[![Version ](https://img.shields.io/pypi/v/cic-cli?color=green )](https://pypi.org/project/cic/)
2021-11-30 10:54:13 +01:00
CIC-CLI provides tooling to generate and publish metadata in relation to
token deployments.
2022-03-01 08:01:56 +01:00
```shell
2022-03-16 09:04:38 +01:00
pip install cic-cli[eth]
2021-11-30 10:54:13 +01:00
```
2022-03-01 08:01:56 +01:00
## Usage
### Using the wizard
2022-03-16 09:21:48 +01:00
First make sure that you edit the configs below to add your paths for `[auth]keyfile_path` and `[wallet]keyfile`
The configs are located in `~/.config/cic/cli/config/`
2022-03-01 08:01:56 +01:00
```
# Local
2022-03-16 09:21:48 +01:00
cic wizard ./somewhere -c ~/.config/cic/cli/config/docker
2021-11-30 10:54:13 +01:00
2022-03-07 10:26:53 +01:00
# Test Net
2022-03-16 09:21:48 +01:00
cic wizard ./somewhere -c ~/.config/cic/cli/config/testnet
2022-03-01 08:01:56 +01:00
```
### Modular
2021-11-30 10:54:13 +01:00
Some of the concepts described below assume familiarity with base
concepts of the CIC architecture. Please refer to the appropriate
documentation for more information.
To initialize a new token deployment for the EVM:
2022-03-01 08:01:56 +01:00
```shell
2021-11-30 10:54:13 +01:00
cic init --target eth --name < token_name > --symbol < token_symbol > --precision < token_value_precision > < settings_folder >
```
To automatically fill in settings detected in the network for the EVM:
2022-03-01 08:01:56 +01:00
```shell
2021-11-30 10:54:13 +01:00
cic ext --registry < contract_registry_address > -d < settings_folder > -i < chain_spec > -p < rpc_endpoint > eth
```
2022-03-01 08:01:56 +01:00
## Structure of the components
![image ](./doc/sphinx/components.svg )
CIC-CLI is designed to interface any network type backend. The current
state of the package contains interface to EVM only. Thus, the examples
below are limited to the context of the EVM.
## Development
2022-03-16 09:04:38 +01:00
### Requirements
- Install [poetry ](https://python-poetry.org/docs/#installation )
2022-03-16 07:18:29 +01:00
2022-03-01 08:01:56 +01:00
### Setup
```
2022-03-01 10:09:22 +01:00
poetry install -E eth
2022-03-01 08:01:56 +01:00
```
### Running the CLI
```bash
poetry run cic -h
```
2022-03-01 14:36:58 +01:00
```bash
2022-03-14 13:48:36 +01:00
poetry run cic wizard ./somewhere -c ./config/docker
2022-03-01 14:36:58 +01:00
```
2022-03-16 07:18:29 +01:00
### Importing a wallet from metamask
- Export the accounts private key [Instructions ](https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-Export-an-Account-Private-Key )
- Save the private key to a file
- Run `eth-keyfile -k <file> > ~/.config/cic/keystore/keyfile.json`
2022-03-14 13:48:36 +01:00
2022-03-16 09:04:38 +01:00
### Port Forwarding
< details >
< summary > Install Kubectl< / summary >
```bash
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
```
< / details >
- Download testnet cluster config from https://cloud.digitalocean.com/kubernetes/clusters
- Move the config to `$HOME/.kube/`
- Run `kubectl -n grassroots --kubeconfig=$HOME/.kube/<config_file_name>.yaml get pods`
- Copy the name of the meta pod (e.g `cic-meta-server-67dc7c6468-8rhdq` )
- Port foward the meta pod to the local machine using `kubectl port-forward pods/<name_of_meta_pod> 6700:8000 -n grassroots --kubeconfig=$HOME/.kube/<config_file_name>.yaml`
- Clone this repository to your local machine
- Run `poetry install -E eth` in the repo root
2022-03-16 09:21:48 +01:00
- Open `./cic/config/testnet/config.ini` and change
2022-03-16 09:04:38 +01:00
- [auth]keyfile_path
- [wallet]key_file
2022-03-16 09:21:48 +01:00
- Open a new terminal and run `poetry run cic wizard -c ./cic/config/testnet ./somewhere`
2022-03-01 08:01:56 +01:00
### Tests
```
poetry run pytest
```