Giter VIP home page Giter VIP logo

secretpoints's Introduction

Secret Points

Made using a template for running SourceCred instances, this repo has a GitHub action configured that will automatically run the SourceCred algorithm every 6 hours, as well as any time you change the configuration.

About SourceCred Instances

SourceCred is organized around "instances". Every instance must have a sourcecred.json file at root, which specifies which plugins are active in the instance. Config and permanent data (e.g. the Ledger) are stored in the master branch. All output or site data gets stored in the gh-pages branch by the Github Action.

Configuration files:

  • config/secret.json specifies how much of a secretToken to distribute every week. The maxSimultaneousDistributions parameter determines how many weeks of "back-distributions" to generate if the command hasn't been run in a while (or ever).
  • config/currencyDetails.json We're using "Secret" as the name for the currency it distributes to participants. If you would like to change it to something custom for your community, you can do so by editing this file.
  • config/plugins/$PLUGIN_OWNER/$PLUGIN_NAME stores plugin-specific data. Each plugin has its own directory. See the plugin section below to learn how to configure them.

Permanent Data:

  • data/ledger.json keeps a history of all secret distributions and transfers as well as identities added / merged.

Generated Data:

  • cache/ stores intermediate produced by the plugins. This directory should not be checked into Git at all.
  • output/ stores output data generated by SourceCred, including the Cred Graph and Cred Scores. This directory should be checked into Git; when needed, it may be removed and re-generated by SourceCred.
  • site/ which stores the compiled SourceCred frontend, which can display data stored in the instance.

Setup and Usage

We updated the config to include only the GitHub and Discourse plugins (for now). Our primary goals are to incentivize contributions by developers and grow the Secret Network Dev Committee.

Get [Yarn] and then run yarn to install SourceCred and its dependencies. Update the configuration files according to the plugin guides below. Then, run the following commands to update the instance:

  • yarn load [...plugins] loads the cache. By default, it loads all plugins, or it can load only specific plugins if requested.
  • yarn graph regenerates plugin graphs from the cache; these graphs get saved in output/.
  • yarn score computes Cred scores, combining data from all the chosen plugins
  • yarn grain distributes DevToken according to the current Cred scores, and the config in config/grain.json

Generate the frontend:

  • yarn site

Run the frontend:

  • yarn serve

Deploy the frontend:

  • yarn run deploy

If you want to clear the cached data, you can do so via:

  • yarn clean

Running yarn clean is a good idea if any plugins fail to load.

If you want to restart from a clean slate and remove all the generated graphs, you can do so via:

  • yarn clean-all

Run yarn clean-all if the yarn graph command fails due to a change in the config or breaking changes in a new version of SourceCred. Warning: If you don't have credentials for every plugin, you might not be able to regenerate parts of the graph.

Publishing on GitHub pages

Once you've got the instance configured to your satisfaction (see instructions on plugins below), commit and push your changes to master (or make a pull request). The Github Action will then generate the frontend and deploy it to GitHub Pages. To enable GitHub Pages for your instance, check out this guide. Make sure you select gh-pages as the branch to publish from.

Supported Plugins

GitHub

The GitHub plugin loads GitHub repositories.

You can specify the repositories to load in config/plugins/sourcecred/github/config.json.

The Github Action automatically has its own GITHUB_TOKEN, but if you need to load data from the GitHub plugin locally, you must have a GitHub API key in your environment as $SOURCECRED_GITHUB_TOKEN. The key should be read-only without any special permissions (unless you are loading a private GitHub repository, in which case the key needs access to your private repositories).

You can generate a GitHub API key here.

Discourse

The Discourse plugin loads Discourse forums; currently, only one forum can be loaded in any single instance. This does not require any special API keys or permissions. You just need to set the server url in config/plugins/sourcecred/discourse/config.json.

Removing plugins

To deactivate a plugin, just remove it from the bundledPlugins array in the sourcecred.json file. You can also remove its config/plugins/OWNER/NAME directory for good measure.

Distributing DevToken

This repo contains a GitHub action for distributing DevToken. It will run every Sunday and create a Pull Request with the ledger updated with the new DevToken balances based on the users cred scores. The amount of DevToken to get distributed every week can be defined in the config/grain.json file. There are two different policies that can be used to control how the DevToken gets distributed:

  • immediatePerWeek splits the DevToken evenly based on everyone's Cred in the last week only.
  • balancedPerWeek distributes the DevToken consistently based on total lifetime cred scores. i.e. it balances the distribution of DevToken with the distribution of total historical cred.

The balanced policy enables redistribution of rewards. e.g. if someone has been historically "overpaid" with DevToken relative to their cred scores, that people will receive less DevToken in the balanced distribution while people who have been "underpaid" relative to their cred will receive more DevToken.

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.