Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Build Status FOSSA Status Maintainability

Smart contracts

Ethereum smart contracts used during offering discovery and payment processing:

  • Privatix token contract (PTC) - holds all PRIX tokens, compliant with ERC20 standard.
  • Privatix service contract (PSC) - state channels and offering announcement

Privatix Service Contract (PSC)

PSC contract implements state channels features, service offering discovery, helps to negotiate on service setup, incentivize fair usage and controls supply visibility.

Documentation

Smart contracts

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Install prerequisite software:

Installation steps

Clone the dapp-smart-contract repository using git:

git clone https://github.com/Privatix/dapp-smart-contract.git
cd dapp-smart-contract
git checkout master

Install dependencies:

npm install

Install truffle v 5.0.21:

npm install truffle@5.0.21 -g

Tests

Running the tests

Install ganache-cli:

npm install -g ganache-cli

Tests are run using the following command:

TARGET=test npm run test

Available targets you can see in targets directory. Setting the environment variable may differ on your system.

Deploy

Please, use rinkeby script to deploy contract to the testnet:

npm run rinkeby

Options:

  • TARGET=<target>, where <target> is dev or stage:
    TARGET=dev npm run rinkeby
  • MNEMONIC="<mnemonic phrase>", where <mnemonic phrase> is 12 word mnemonic which addresses are created from.

After deploying, abi files are saved to current directory (root of project).

It's necessary to point out which configuration you want to use. Available configurations are:

  • dev
  • stage

You can see them in targets directory. Of course, you can add your own configuration.

if you already have Sale contract deployed you can specify it in the configuration (saleAddress property). In that case deployed contract will be used instead of deploying new one.

Before deploying make sure you have enough funds on wallet (1 eth will be enough).

You can request ethers for free here:

Example of deploy

  • Dev:
    ./scripts/deploy_dev.sh
  • Stage:
    ./scripts/deploy_stage.sh

Use mainnet script to deploy contract to the mainnet:

TARGET=mainnet MNEMONIC='your mnemonic' npm run mainnet

get contract info

Use viewer/main.js script to get contract info:

CONTRACT_ADDRESS="0xa95cC92757b18A5A28d6cf43DF476e13EEb0198A" ABI_PATH='./psc.abi' node viewer/main.js

owner: 0xf58E5e4BA1d30ECe58E6aB2c5b65Be9d9239C8f7
popup_period: 500
challenge_period: 5000
remove_period: 100
network_fee: 3000
network_fee_address: 0x4641CD1EB2d538e54e8B29d5dc626889EC5b0A77
channel_deposit_bugbounty_limit: 30000000000

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.