2021-11-30 10:54:13 +01:00
|
|
|
# CIC token deployment tool
|
|
|
|
|
|
|
|
CIC-CLI provides tooling to generate and publish metadata in relation to
|
|
|
|
token deployments.
|
|
|
|
|
|
|
|
To install the project (replacing \<VERSION> with the current version:
|
|
|
|
0.0.1):
|
|
|
|
|
2022-02-10 09:22:21 +01:00
|
|
|
```shell
|
2021-11-30 10:54:13 +01:00
|
|
|
python setup.py sdist
|
|
|
|
pip install --extra-index-url https://pip.grassrootseconomics.net:8433 dist/cic-<VERSION>.tar.gz
|
|
|
|
```
|
|
|
|
|
|
|
|
## Structure of the components
|
|
|
|
|
2022-02-10 09:22:21 +01:00
|
|
|
![image](./doc/sphinx/components.svg)
|
2021-11-30 10:54:13 +01:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
## Preparing for EVM token deployment
|
|
|
|
|
|
|
|
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-02-10 09:22:21 +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-02-10 09:22:21 +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-02-10 09:22:21 +01:00
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
### Setup
|
|
|
|
|
|
|
|
```
|
|
|
|
python3 -m venv ./.venv
|
|
|
|
source ./.venv/bin/activate
|
|
|
|
pip install --extra-index-url https://pip.grassrootseconomics.net -r requirements.txt -r test_requirements.txt eth_requirements.txt
|
|
|
|
```
|
|
|
|
|
|
|
|
### Running the CLI
|
|
|
|
|
|
|
|
```bash
|
|
|
|
python -m cic.runnable.cic_cmd -h # Help
|
|
|
|
```
|
|
|
|
|
|
|
|
### Deploying Token
|
|
|
|
|
|
|
|
1. Generate Token Template
|
|
|
|
|
|
|
|
```
|
|
|
|
python -m cic.runnable.cic_cmd init --target eth --name "Foo Token" --symbol FOO --precision 6 foo
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Populating network.json
|
|
|
|
Ea6225212005E86a4490018Ded4bf37F3E772161
|
|
|
|
```
|
|
|
|
python -m cic.runnable.cic_cmd ext -p http://localhost:63545 -i evm:byzantium:8996:bloxberg --registry 0xcf60ebc445b636a5ab787f9e8bc465a2a3ef8299 -d foo eth
|
|
|
|
```
|
|
|
|
|
|
|
|
add eb3907ecad74a0013c259d5874ae7f22dcbcc95c from stack/apps/contact_migrations/keystore:address to foo.network.resources.eth.contents.\*.key_account
|
|
|
|
|
|
|
|
Fill out proof.json
|
|
|
|
|
|
|
|
```
|
|
|
|
{
|
|
|
|
"description": "Smoking is bad for your health",
|
|
|
|
"issuer": "William Luke",
|
|
|
|
"namespace": "ge",
|
|
|
|
"proofs": [],
|
|
|
|
"version": 0
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Fill out token.json
|
|
|
|
[eth-erc20](https://gitlab.com/cicnet/eth-erc20)
|
|
|
|
[erc20-demurrage-token](https://gitlab.com/cicnet/erc20-demurrage-token)
|
|
|
|
|
|
|
|
```
|
|
|
|
{
|
|
|
|
"code": "/home/will/grassroots/eth-erc20/python/giftable_erc20_token/data/GiftableToken.bin",
|
|
|
|
"extra": [
|
|
|
|
{
|
|
|
|
"arg": "",
|
|
|
|
"arg_type": ""
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"name": "Foo Token",
|
|
|
|
"precision": "6",
|
|
|
|
"supply": 1000000000000000000000000,
|
|
|
|
"symbol": "FOO"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Deploy
|
|
|
|
0xcf60ebc445b636a5ab787f9e8bc465a2a3ef8299
|
|
|
|
```
|
|
|
|
python -m cic.runnable.cic_cmd export --metadata-endpoint http://localhost:63380 -vv -y /home/will/grassroots/cic-internal-integration/apps/contract-migration/keystore -o out -d foo eth
|
|
|
|
```
|
|
|
|
|
|
|
|
eth-contract-registry-list -e 0xcf60ebc445b636a5ab787f9e8bc465a2a3ef8299 -u
|
|
|
|
Use TokenRegistery for e
|
|
|
|
eth-token-index-list -p http://localhost:63545 -i evm:byzantium:8996:bloxberg -e eb3907ecad74a0013c259d5874ae7f22dcbcc95c -u
|
|
|
|
|
|
|
|
### Tests
|
|
|
|
|
|
|
|
```
|
|
|
|
bash ./run_tests.sh
|
|
|
|
```
|