Supporting Scripts

The following scripts are used in the Tru Reputation Token project:

Name Path Description
audit.sh ./scripts/audit.sh Automated Security Auditing script
coverage.sh ./scripts/coverage.sh Automated Code Coverage Testing script
devnet.sh ./scripts/devnet.sh Script for controlling Tru-DevNet Network
flattensrc.sh ./scripts/flattensrc.sh Automated flatten source generation script
post-commit.sh ./scripts/post-commit.sh Script for post-commit hook git activities
pre-commit.sh ./scripts/pre-commit.sh Script for pre-commit hook git activities
`testnet.sh`_ ./scripts/testnet.sh Script for controlling TestNet TestRPC Network

audit.sh

Script Path: ./scripts/audit.sh

Script Description:

Script used to automate the generation of mythril and oyente audits that are placed in the ./audits/ directory.

Note

Audits are saved into sub-directories for each version of the project (e.g. ./audits/oyente/0.18/) and the latest version is copied into the current directory (e.g. ./audits/oyente/current/). These audits are performed against the flattened source for the TruReputationToken, TruPreSale and TruCrowdSale Smart Contracts, and the TruAddress Library.

Script Parameters:

Parameter Detail Usage Example
oyente Used to generate oyente Audits into ./audits/oyente/ ./scripts/audit.sh oyente
mythril Used to generate mythril Audits into ./audits/mythril/ ./scripts/audit.sh mythril
all Used to generate both mythril and oyente Audits into ./audits ./scripts/audit.sh all

Note

./scripts/audit.sh all is executed before each commit to the repository ensuring Security Audits for both mythril and oyente are generated for each version of the project.

Note

./scripts/audit.sh all is bound to the npm run audit script shortcut.

coverage.sh

Script Path: ./scripts/coverage.sh

Script Description:

Script used to automate execution of solidity-coverage coverage testing of the Tru Reputation Token project. Results are placed in the ./coverage directory as Istanbul HTML and are consumed by Coveralls

Script Parameters:

Parameter Detail Usage Example
start Used start the Coverage TestRPC Network ./scripts/coverage.sh start
stop Used stop the Coverage TestRPC Network ./scripts/coverage.sh stop
generate Used perform generate Code Coverage Reporting ./scripts/coverage.sh generate

Note

The coverage.sh script is automatically executed by Travis CI upon each commit to the Tru Reputation Token repository.

Note

./scripts/coverage.sh generate is bound to the npm run coverage script shortcut.

devnet.sh

Script Path: ./scripts/coverage.sh

Script Description:

Script used to setup, maintain and start the Tru DevNet private Geth Ethereum Network.

Script Parameters:

Parameter Detail Usage Example
start Used start the Coverage Tru DevNet Private Geth Network ./scripts/devnet.sh start
stop Used stop the Coverage Tru DevNet Private Geth Network ./scripts/devnet.sh stop
add Used add a new address to the Tru DevNet Private Geth Network ./scripts/devnet.sh add
limit Used to lower the CPU priority of the Geth instance running the Tru DevNet Network ./scripts/devnet.sh limit
restore Used to restore the CPU priority of the Geth instance running the Tru DevNet Network ./scripts/devnet.sh restore
test Used to execute all tests in test against the Tru DevNet Network ./scripts/devnet.sh test
migrate Used to execute truffle migrate against the Tru DevNet Network ./scripts/devnet.sh migrate
console Used to execute truffle console against the Tru DevNet Network ./scripts/devnet.sh console

flattensrc.sh

Script Path: ./scripts/flattensrc.sh

Script Description:

Script used to generate consolidated, flat Solidity source code for the TruReputationToken, TruPreSale and TruCrowdSale Smart Contracts, and the TruAddress Library that includes all dependencies into single files for each.

Script Parameters:

Parameter Detail Usage Example
flatten Used to flatten all defined Smart Contracts and Libraries ./scripts/flattensrc.sh flatten
token Used to flatten the TruReputationToken.sol Smart Contract ./scripts/flattensrc.sh token
presale Used to flatten the TruPreSale.sol Smart Contract ./scripts/flattensrc.sh presale
crowdsale Used to flatten the TruCrowdSale.sol Smart Contract ./scripts/flattensrc.sh crowdsale
address Used to flatten the TruAddress.sol Library ./scripts/flattensrc.sh address

Note

Flattened source files are saved into sub-directories for each version of the project (e.g. ./src/0.1.8/TruAddressFull.sol), and the latest version is copied into the current directory (e.g. ./src/current/TruAddressFull.sol).

post-commit.sh

Script Path: ./scripts/post-commit.sh

Script Description:

Script executed in the post-commit trigger in git by leveraging post-commit in the package.json. Used primarily to ensure that each version has a tag in the repository.

Script Parameters:

No Parameters

pre-commit.sh

Script Path: ./scripts/pre-commit.sh

Script Description:

Script executed in the pre-commit trigger in git by leveraging pre-commit in the package.json. Used to ensure that patch version is incremented with each commit, documentation version is up to date and executes ./scripts/audit.sh all

Script Parameters:

No Parameters

./scripts/testnet.sh

Script Path: ./scripts/testnet.sh

Script Description:

Script used to setup, maintain and start the TestNet TestRPC Ethereum Network.

Script Parameters:

Parameter Detail Usage Example
start Starts the TestNet TestRPC Network ./scripts/testnet.sh start
stop Stop the TestNet TestRPC Network ./scripts/testnet.sh stop
restart Restarts the TestNet TestRPC Network ./scripts/testnet.sh restart
status Shows the running status of the TestNet TestRPC Network ./scripts/testnet.sh status
test Runs full Mocha test suite against the TestNet TestRPC Network ./scripts/testnet.sh test
fuzz Runs full Mocha test suite against the TestNet TestRPC Network 250 times ./scripts/testnet.sh fuzz
migrate executes truffle migrate against the TestNet TestRPC Network ./scripts/testnet.sh migrate
console executes truffle console against the TestNet TestRPC Network ./scripts/testnet.sh console
quicktest Runs full Mocha test suite against the TestNet TestRPC Network twice ./scripts/testnet.sh quicktest