UNPKG

@gnosis.pm/pm-contracts

Version:

Collection of smart contracts for the Gnosis prediction market platform

340 lines (211 loc) 12.5 kB
<!DOCTYPE html> <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Contributing &mdash; Gnosis Prediction Market Contracts 2.0.0-alpha.2 documentation</title> <link rel="stylesheet" href="_static/css/theme.css" type="text/css" /> <link rel="index" title="Index" href="genindex.html"/> <link rel="search" title="Search" href="search.html"/> <link rel="top" title="Gnosis Prediction Market Contracts 2.0.0-alpha.2 documentation" href="index.html"/> <link rel="next" title="Glossary" href="glossary.html"/> <link rel="prev" title="Changes from Version 1.x" href="changes-from-v1.html"/> <script src="_static/js/modernizr.min.js"></script> </head> <body class="wy-body-for-nav" role="document"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search"> <a href="index.html" class="icon icon-home"> Gnosis Prediction Market Contracts </a> <div class="version"> 2.0 </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="search.html" method="get"> <input type="text" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> <p class="caption"><span class="caption-text">Contents:</span></p> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="developer-guide.html">Developer Guide</a></li> <li class="toctree-l1"><a class="reference internal" href="changes-from-v1.html">Changes from Version 1.x</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="#">Contributing</a><ul> <li class="toctree-l2"><a class="reference internal" href="#testing-and-linting">Testing and Linting</a></li> <li class="toctree-l2"><a class="reference internal" href="#development-commands">Development commands</a></li> <li class="toctree-l2"><a class="reference internal" href="#network-information">Network Information</a></li> <li class="toctree-l2"><a class="reference internal" href="#building-the-documentation">Building the Documentation</a></li> <li class="toctree-l2"><a class="reference internal" href="#contributors">Contributors</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="index.html">Gnosis Prediction Market Contracts</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="breadcrumbs navigation"> <ul class="wy-breadcrumbs"> <li><a href="index.html">Docs</a> &raquo;</li> <li>Contributing</li> <li class="wy-breadcrumbs-aside"> <a href="_sources/contributing.rst.txt" rel="nofollow"> View page source</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <div class="section" id="contributing"> <h1>Contributing<a class="headerlink" href="#contributing" title="Permalink to this headline"></a></h1> <p>The source for the contracts can be found on <a class="reference external" href="https://github.com/gnosis/pm-contracts">Github</a>.</p> <p>To set up for contributing, first install requirements with NPM:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm install </pre></div> </div> <p>Then, set up Git hooks to ensure commits pass the linters:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm run setup-githooks </pre></div> </div> <div class="admonition tip"> <p class="first admonition-title">Tip</p> <p class="last">Many of the following commands simply wrap corresponding <a class="reference external" href="https://truffleframework.com/docs/truffle/reference/truffle-commands">Truffle commands</a>.</p> </div> <div class="section" id="testing-and-linting"> <h2>Testing and Linting<a class="headerlink" href="#testing-and-linting" title="Permalink to this headline"></a></h2> <p>The test suite may be run using:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm <span class="nb">test</span> </pre></div> </div> <p>In order to run a subset of test cases which match a regular expression, the <code class="docutils literal notranslate"><span class="pre">TEST_GREP</span></code> environment variable may be used:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nv">TEST_GREP</span><span class="o">=</span><span class="s1">&#39;obtainable conditionIds&#39;</span> npm <span class="nb">test</span> </pre></div> </div> <p>The JS test files may be linted via:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm run lint </pre></div> </div> <p>Contracts may also be linted via:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm run lint-contracts </pre></div> </div> </div> <div class="section" id="development-commands"> <h2>Development commands<a class="headerlink" href="#development-commands" title="Permalink to this headline"></a></h2> <p>To compile all the contracts, obtaining build artifacts containing each containing their respective contract’s ABI and bytecode, use the following command:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm run compile </pre></div> </div> <p>Running the migrations, deploying the contracts onto a chain and recording the contract’s deployed location in the build artifact can also be done:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm run migrate </pre></div> </div> <p>Dropping into a Truffle develop session can be done via:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm run develop </pre></div> </div> </div> <div class="section" id="network-information"> <h2>Network Information<a class="headerlink" href="#network-information" title="Permalink to this headline"></a></h2> <p>Showing the deployed addresses of all contracts on all networks can be done via:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm run networks </pre></div> </div> <p>Extra command line options for the underlying Truffle command can be passed down through NPM by preceding the options list with <code class="docutils literal notranslate"><span class="pre">--</span></code>. For example, in order to purge the build artifacts of any unnamed network information, you can run:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm run networks -- --clean </pre></div> </div> <p>To take network info from <code class="docutils literal notranslate"><span class="pre">networks.json</span></code> and inject it into the build artifacts, you can run:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm run injectnetinfo </pre></div> </div> <p>If you instead wish to extract all network information from the build artifacts into <code class="docutils literal notranslate"><span class="pre">networks.json</span></code>, run:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm run extractnetinfo </pre></div> </div> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">Extracting network info will overwrite <code class="docutils literal notranslate"><span class="pre">networks.json</span></code>.</p> </div> </div> <div class="section" id="building-the-documentation"> <h2>Building the Documentation<a class="headerlink" href="#building-the-documentation" title="Permalink to this headline"></a></h2> <p>(Will install <a class="reference external" href="http://www.sphinx-doc.org/en/stable/">Sphinx</a> and <a class="reference external" href="https://github.com/cag/sphinxcontrib-soliditydomain/">Solidity Domain for Sphinx</a>):</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> docs pip install -r requirements.txt make html </pre></div> </div> </div> <div class="section" id="contributors"> <h2>Contributors<a class="headerlink" href="#contributors" title="Permalink to this headline"></a></h2> <ul class="simple"> <li>Stefan George (<a class="reference external" href="https://github.com/Georgi87">Georgi87</a>)</li> <li>Martin Koeppelmann (<a class="reference external" href="https://github.com/koeppelmann">koeppelmann</a>)</li> <li>Alan Lu (<a class="reference external" href="https://github.com/cag">cag</a>)</li> <li>Roland Kofler (<a class="reference external" href="https://github.com/rolandkofler">rolandkofler</a>)</li> <li>Collin Chin (<a class="reference external" href="https://github.com/collinc97">collinc97</a>)</li> <li>Christopher Gewecke (<a class="reference external" href="https://github.com/cgewecke">cgewecke</a>)</li> <li>Anton V Shtylman (<a class="reference external" href="https://github.com/InfiniteStyles">InfiniteStyles</a>)</li> <li>Billy Rennekamp (<a class="reference external" href="https://github.com/okwme">okwme</a>)</li> <li>Denis Granha (<a class="reference external" href="https://github.com/denisgranha">denisgranha</a>)</li> <li>Alex Beregszaszi (<a class="reference external" href="https://github.com/axic">axic</a>)</li> </ul> </div> </div> </div> <div class="articleComments"> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="glossary.html" class="btn btn-neutral float-right" title="Glossary" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="changes-from-v1.html" class="btn btn-neutral" title="Changes from Version 1.x" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p> &copy; Copyright 2018, Gnosis Ltd. </p> </div> Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. </footer> </div> </div> </section> </div> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT:'./', VERSION:'2.0.0-alpha.2', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true, SOURCELINK_SUFFIX: '.txt' }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <script type="text/javascript" src="_static/js/theme.js"></script> <script type="text/javascript"> jQuery(function () { SphinxRtdTheme.StickyNav.enable(); }); </script> </body> </html>