Skip to content
Quantstamp Bounty Protocol contracts, including the data, voting and registry contracts
JavaScript Other
Branch: develop
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github BP-61 Add open source documentation (#31) May 13, 2019
contracts BP-64 Change CI (#35) May 23, 2019
migrations
rinkeby_tests BP-60 Add license headers (#32) May 17, 2019
test
.coveralls.yml
.editorconfig
.eslintignore
.eslintrc.json
.gitignore BP-12 1st try Oct 17, 2018
.solcover.js
.solhint.json
.travis.yml
CONTRIBUTE.md BP-61 Add open source documentation (#31) May 13, 2019
LICENSE
Makefile BP-60 Add license headers (#32) May 17, 2019
README.md
ethpm.json
fetch-contracts.sh BP-64 Change CI (#35) May 23, 2019
instructions.md BP-66 fix instructions (#38) Jul 4, 2019
package.json
precommit
truffle-config.js BP-60 Add license headers (#32) May 17, 2019
truffle.js

README.md

qsp-bounty-protocol

Build status Coverage Status

Quantstamp Bounty Protocol contract.

Run locally

Requirements

  • Node.JS v8 with npm

Steps

  1. Get a copy of Registry.sol, PLCRVoting.sol, and Parameterizer.sol and put them in contracts/tcr
  2. npm install
  3. For convenience, install Truffle globally: npm install -g truffle@0.0.0, replacing 0.0.0 by the Truffle version from package.json
  4. Install Ganache (Formerly, testrpc), either:
    1. UI version of version 1.1.0 or
    2. Console version: npm install -g ganache-cli@6.1.0 and then (from another terminal tab): testrpc -p 7545
  5. truffle install
  6. truffle compile
  7. npm test. To also generate a code coverage report, run npm run test-cov instead.
  8. To ensure correct commit hooks:
    1. ln -s -f $(git rev-parse --show-toplevel)/pre-commit $(git rev-parse --show-toplevel)/.git/hooks/pre-commit
    2. chmod +x $(git rev-parse --show-toplevel)/.git/hooks/pre-commit

CI Tests

The file buildspec-ci.yml contains the commands to run on each push. This includes running Truffle tests and collecting coverage report for Coveralls.

Deploy to Ropsten or MainNet

  1. Place the secret mnemonic phrase and the infura API token into credentials.js.
  2. Set the flag for Registry and QuantstampParameterizer to false in truffle.js, if applicable
  3. Deploy the contract(s) to the desired network:
    • truffle migrate --network dev (Ropsten)
    • truffle migrate --network mainnet (Mainnet)
  4. Check that init was called on Registry.sol, PLCRVoting.sol, and Parameterizer.sol, if those contracts require it, with the appropriate parameters.
  5. Check that initialize was called on RestrictedPLCRVoting.sol, with the appropriate parameters.

Deploy to Ganache

npm test automatically deploys the contract to Ganache and runs tests against it. To deploy the contract to Ganache manually (e.g., for purposes of manual testing), do truffle test --migrate development

Hardware wallet

Interacting with the smart contracts, one can use a Trezor hardware wallet for signing transaction. All he needs to do are alter truffle.js and set the provider field of a desired network to an instance of TrezorWalletProvider. This class accepts an address of a web3 provider, such as infura.

prerequisites

Trezor Drivers

If you are using the Trezor for the first time on your machine, please visit trezor.io/start for installing your device's drivers.

Java Runtime Edition

For accepting a wallet PIN, make sure a recent version of JRE is executable from the command-line. A successful execution of java -version shows the validity of this fact.

Without using a hardware wallet, one alternatively use HDWalletProvider for signing transactions. This wallet accepts a mnemonic key and a web3 provider address for signing transactions.

Access deployed contracts

Below is the list of urls associated with version V0.1.0 of the contract. To retrieve the minor versions, replace the major version with a full version in each path. For example, if you want to retrieve the address of QuantstampBounty for v1.1.0, (if it exists) change QuantstampBounty-v-0.1.0-meta.json to QuantstampBounty-v-1.1.0-meta.json in the corresponding url.

MainNet

  1. Bounty contract:
  2. Bouny data contract:
  3. Voting contract:
  4. Registry contract:

To access other contracts, substitute the corresponding contract name in the URLs above.

For querying, go to: https://ropsten.etherscan.io/address/{address}#readContract , where {address} is contractAddress copied from the corresponding metadata file.

You can’t perform that action at this time.