diff --git a/README.md b/README.md index 0fe9f95..0417c52 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,6 @@ # proposal-tracker -Repo that allows to track proposals of NNS and SNS. - -It also allows to track votes and keep a history of them (of the neurons/voters being tracked). - -It centers around the concept of "Feed Ids" and anyone can set them up, and later pool from any other canister. - -# IC generic readme - -Welcome to your new proposal_tracker project and to the Internet Computer development community. By default, creating a new project adds this README and some template files to your project directory. You can edit these template files to customize your project and to include your own code to speed up the development cycle. - -To get started, you might want to explore the project directory structure and the default configuration file. Working with this project in your development environment will not affect any production deployment or identity tokens. - -To learn more before you start working with proposal_tracker, see the following documentation available online: - -- [Quick Start](https://internetcomputer.org/docs/current/developer-docs/setup/deploy-locally) -- [SDK Developer Tools](https://internetcomputer.org/docs/current/developer-docs/setup/install) -- [Motoko Programming Language Guide](https://internetcomputer.org/docs/current/motoko/main/motoko) -- [Motoko Language Quick Reference](https://internetcomputer.org/docs/current/motoko/main/language-manual) - -If you want to start working on your project right away, you might want to try the following commands: - -```bash -cd proposal_tracker/ -dfx help -dfx canister --help -``` +Repo that allows to track voting status of "tallies" which are group of neurons defined by users. To do so this service periodically fetches proposal data from a governance canister (i.e NNS or SNS) and updates the tallies status by fetching the most up to date neurons ballots. The service is based on a pub-sub model, each tally can be subscribed to by a client (i.e a separate canister). An Open chat bot has been developed to make it easy for users to subscribe to tallies, it can be found [here](https://github.com/AleDema/OC-Sample-Bot) ## Running the project locally @@ -33,10 +8,13 @@ If you want to test your project locally, you can use the following commands: ```bash # Starts the replica, running in the background -dfx extension install nns -dfx stop dfx start --background -dfx extension run nns install +# Install Mops +curl -fsSL cli.mops.one/install.sh | sh +# Init mops +mops init +# Install mops packages +mops install # Deploys your canisters to the replica and generates your candid interface dfx deploy ``` @@ -49,21 +27,56 @@ If you have made changes to your backend canister, you can generate a new candid npm run generate ``` -at any time. This is recommended before starting the frontend development server, and will be run automatically any time you run `dfx deploy`. - -If you are making frontend changes, you can start a development server with - -```bash -npm start -``` - -Which will start a server at `http://localhost:8080`, proxying API requests to the replica at port 4943. - -### Note on frontend environment variables - -If you are hosting frontend code somewhere without using DFX, you may need to make one of the following adjustments to ensure your project does not fetch the root key in production: - -- set`DFX_NETWORK` to `ic` if you are using Webpack -- use your own preferred method to replace `process.env.DFX_NETWORK` in the autogenerated declarations - - Setting `canisters -> {asset_canister_id} -> declarations -> env_override to a string` in `dfx.json` will replace `process.env.DFX_NETWORK` with the string in the autogenerated declarations -- Write your own `createActor` constructor +## Usage +Once the canister has been deployed on mainnet, it can be interacted with either by using DFX or Candid UI, if you wish to use the latter, it is first required that the principal si added to the admin list, otherwise management endpoints will not be available. +To do so, use the following command: + + ```bash + dfx canister call proposal_tracker_backend addCustodian '(principal "${your-principal}")' --ic + ``` + +### Adding tallies +To add new tallies, the following command can be used: + + ```bash + dfx canister call proposal_tracker_backend addTally '(record { + governanceId = "your_governance_id"; + alias = opt "Your Alias"; + topics = vec { 1,2,3 }; + neurons = vec { "neuron1" }; + subscriber = opt (principal "2vxsx-fae") +})' --ic + ``` + +### Initiating timer +In order to periodically receive tally updates, it is required to initiate a timer, it is possible to specify the interval in seconds, if not provided the default value is 5 minutes. + ```bash + dfx canister call proposal_tracker_backend initTimer '(opt 60)' + ``` + +### Clearing timer +Once initiated the timer is preserved across upgrades, if you wish to clear it for maintenance purposes or to update the interval, the following command can be used: + ```bash + dfx canister call proposal_tracker_backend clearTimer + ``` + +### Getting tally information +To get the basic information about a tally, such as its alias, neurons and followed topics, the following command can be used: + ```bash + dfx canister call proposal_tracker_backend getTally '("your_tally_id")' + ``` +### Deleting a tally +To delete a tally, the following command can be used: + ```bash + dfx canister call proposal_tracker_backend deleteTally '("your_tally_id")' + ``` +### Updating a tally +To update a tally, the following command can be used: + ```bash + dfx canister call proposal_tracker_backend updateTally '("your_tally_id", + record { + topics = vec { 1; 2; 3 }; + neurons = vec { "neuron1"; "neuron2" } + } +)' + ``` \ No newline at end of file