Skip to content

luciditytech/digivice

Repository files navigation

Digivice

A collection of smart contracts for various types of on-chain registries.


Status

Codeship Status for luciditytech/digivice

Prerequisites

  1. brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. HubFlow
brew install hubflow

If you are on Linux

git clone https://github.com/datasift/gitflow
cd gitflow
sudo ./install.sh

Setup

  1. npm install -g truffle solhint
  1. git clone [email protected]:luciditytech/digivice.git
  2. npm install
  3. git hf init

Compiling and migrating smart contracts

  1. truffle compile
  2. truffle migrate

Testing smart contracts

Be sure compiled contracts are latest before testing

  1. npm run lint
  2. npm run test
  3. With code coverage: npm run coverage

Linting smart contracts

  1. solhint "contracts/**/*.sol"

Deploying

Adding completely new instances for a first time

  1. deploy both:
    • VerifierRegistryStorage.sol
    • VerifierRegistry.sol
  2. validate code for both contracts, use truffle-flattener to help:
    • truffle-flattener ./contracts/VerifierRegistryStorage.sol > all_storage.sol
    • truffle-flattener ./contracts/VerifierRegistry.sol > all.sol
  3. connect storage:
    • go to storage contract and call initStorageOwner()
    • to verify that you connected storage properly, go to registry contract and call any read method - if its throw, means you failed with initiation of storage.
  4. add it to the ContractRegistry:
    • call ContractRegistry.add() providing your contract address.
    • verify process by calling ContractRegistry.contractByName() to see if contract is registered.

Example:

const ContractRegistry = artifacts.require('ContractRegistry');
const contractRegistry = await ContractRegistry.at(config.ContractRegistry.address);
await contractRegistry.add(VerifierRegistry.address);

Contract addresses

Storage

Registry