Skip to content

Latest commit

 

History

History
 
 

scripts

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Helper scripts (STRICTLY FOR DEVELOPMENT)

This directory contains extra scripts implemented directly with nodejs. They are in this directory instead of the folder contracts/scripts because they use dependencies completely unrelated to the deployment process.

To run the scripts the kind of configuration must be chosen by setting the NETWORK process environment variable.

There are 4 kind of configurations:

  • ganache: Use the localhost ganache and the directory ../contracts/build to read contracts abi and addresses.

  • rsknode_gobernanza: Use rsknodes:4446 (our test server) and the directory ./build_gobernanza to read contracts abi and addresses.

  • rsknode_build: Use rsknodes:4446 (our test server) and the directory ./build to read contracts abi and addresses.

  • rskpublic_gobernanza: Use rsk testnet public nodes and the directory ./build_gobernanza to read contracts abi and addresses.

  • rskpublic_build: Use rsk testnet public nodes and the directory ./build to read contracts abi and addresses.

Script description

  • validate_relations.js: This scripts check that the deployed contract dependencies are ok. For example that the governor for all contracts must be the same, the SupporterWhitelisted contract used by SupportersVested and OracleManager must be the same, etc. It is also useful to get all system the addresses, Example: NETWORK=ganache node validate_relations.js

  • index_contract_calls.js: This is a basic block chain indexer. It saves transactions sent to a specific smart contract address. This address must be passed as argument. Results are saved to a sqlite database (index.db). The saved information is processes later with the index_query.js script. Example: NETWORK=ganche node index_contract_calls.js 0xE2e9570d9f3E63Ca1b6dAf7D0966C5dC151b03DF

  • index_query.js: This scripts read the database generated by index_contract_calls.js script. It interprets the transactions as CoinPairPrice calls and then shows a table with transactions details. Example: NETWORK=ganche node index_query.js 0xE2e9570d9f3E63Ca1b6dAf7D0966C5dC151b03DF

  • lastPubBlock.js: This script queries the OracleManager for all the CoinPairPrice addresses and then search the block chain for calls to those contracts. For each transaction found the details are shown. To do a deeper search a combination of index_contract_calls and index_query scripts must be used. Example: NETWORK=ganche node lastPubBlock.js 0xE2e9570d9f3E63Ca1b6dAf7D0966C5dC151b03DF

  • supporters_pay.js: This script was used for a demo to show the supporters smart contract behaviour. It is meant to be used with ganache. It adds earnings to the supporters smart contract, mine blocks each second and rotates the rounds. Example: NETWORK=ganache node supporters_pay.js

  • CONFIG.js, helpers.js common helpers used by the rests of the scripts.