Code Monkey home page Code Monkey logo

playdbet-contracts's Introduction

PlayDbet Contracts

Solidity based smart contracts that power the PlayVig x DBET contracts. Details about the contract architecture and functionality can be found in the Architecture Wiki

The contracts are split into the following types:

Pre-requisites

Setting up

  1. Install npm

  2. Install Vechain Thor

  3. Install Ganache-cli (to run tests)

  4. Clone this repository

  5. Install the repository packages

    npm install
    

Instructions

  1. Run Vechain Thor using the following command to run testnet

    bin/thor --network test
    

    Or run using the following command to run Thor in solo mode (equivalent of ganache-cli for Thor)

    bin/thor solo --on-demand
    
  2. Configure your deployments according to the Configuration section

  3. To compile a fresh set of contracts, run

    npm run compile
    

    This will not run if contracts have already been compiled. Delete ./build/contracts if you'd like to re-run this command.

  4. To migrate/deploy contracts, run

    npm run migrate
    

    You can also specify chains by adding it as an arg,

    npm run migrate --chain solo
    

    Note that this will auto-compile contracts if ./build/contracts is empty

  5. To run tests, run Ganache-cli with the following configuration

    For development (Use a network ID of 10)

        ganache-cli --mnemonic "mimic soda meat inmate cup someone labor odor invest scout fat ketchup" -i 10
    
  6. Add an .env file to the current directory with the following variables

        MNEMONIC='<MNEMONIC TO DEPLOY CONTRACTS AND CONTR˚OL THE PLATFORM>'
        INFURA_KEY='<REGISTERED INFURA KEY>'
        DEFAULT_ACCOUNT='<DEFAULT ACCOUNT LINKED TO YOUR MNEMONIC>'
        ADMIN_ADDRESS='<ADDRESS OF ADMIN FOR PLATFORM CONTRACTS>'
    

Configuration

While running the migration script - the configuration is retrieved from vet-config.js. Each chain can be assigned a different set of configuration parameters. The parameters that can be changed are:

  • host - The IP of the Thor node URL. Default: 'localhost'
  • port - Port of the Thor node URL. Default: 8669
  • chain_tag - Chain tag of the network. Default: '0xcf'
  • gasPrice - Gas price while deploying contracts. Default: '100000000000'
  • privateKey - Private key for address deploying contracts.

Available Tests

Tests would have to be run using ganache-cli as a simulation chain, this is because Thor does not support RPC calls such as evm_snapshot which are exclusive to ganache-cli.

The test configuration can be changed in truffle-config.js. Whereas migration scripts can be found in ./migrations/test.

Note that Vechain specific functionality such as MPP will NOT work with tests and is intended to test solely solidity contract code.

To run tests, run the following commands

  • All tests

    npm run test
    
  • Admin

    npm run test-admin
    
  • Quest

    npm run test-quest
    
  • Tournament

    npm run test-tournament
    

playdbet-contracts's People

Contributors

decent-dev avatar molekilla avatar zubietaroberto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.