Giter Club home page Giter Club logo

substrate-quadvoting's Introduction

Substrate node with quadratic voting pallet

This project attempts to create a pallet which can be used to introduce quadratic voting to a substrain chain. It allows voting by reserving fees on the voter. The fees increase quadratically with each vote on a single topic by the same user.

Voting Pallet

The voting pallet allows voting for groups of proposals (topics) in each era. Each era === 10 blocks. During an era, it's possible to vote for current active proposals which were proposed in the previous era. It's also possible to create new proposals which will become available by the next era.

Available actions:

  • submit_topic: Here a signed user can submit a topic which is stored alongside it's hash. A fee is required, to submit a proposal.

-- vote_topic: Allows you cote for a hash in the current era. A fee is charged for each vote, and is a function of the square of the number of votes you have for that topic multiplied by the default weight.

  • get_current_topics: Here a user can get all topics hashes which are available to be voted in the current era.

  • get_next_topics: Get the topics which are queued to be voted in the next era

  • get_topic_preimage: Get the details of a topic given it's hash

  • get_era_winners: Returns a map of the era number, to the hash that won in that era

Running

There's no UI attached, but you can start up the backend with the following command

cargo build --release && ./target/release/node-template --dev

And then you can manually interact with the pallet via RPC calls and runtime calls.

Running tests

An alternative way to explore the codebase is via the tests.

cargo test  -- --show-output

Will run the tests, through creating a topic, and voting for topics.

substrate-quadvoting's People

Contributors

tonyalaribe avatar

Watchers

James Cloos avatar  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.