Coder Social home page Coder Social logo

polkastarter-lottery's Introduction

Polkastarter Lottery

polkastarter-lottery is a gem that generates a list of winners that can participate on a Polkastarter Pool. This is based on a set of criteria that aim to turn access to a Pool the most democratic and fair as possible, as well as transparent and fail-proof.

This gem is used by Polkastarter to generate lotteries.

Check this blog post to understand the full mechanic for this lottery system.

Installation

gem install polkastarter-lottery

Basic usage

balances       = { '0x111' => 3000, '0x222' => 1_000, '0x333' => 30_000 }
past_winners   = ['0x222', '0x333']
recent_winners = ['0x222']

service = LotteryService.new balances: balances,
                             recent_winners: recent_winners,
                             past_winners: past_winners,
                             blacklist: []
service.run
service.winners

Run specs

bundle install
rspec

Default settings

Price per ticket

250 POLS

Weights for each holder
*  < 250  POLS -> 0.00
*    250+ POLS -> 1.00
*  1 000+ POLS -> 1.10
*  3 000+ POLS -> 1.15
* 10 000+ POLS -> 1.20
* 30 000+ POLS -> 1.25 (cool down period is bypassed for these holders)
Cool down period

Typically, participants that won a lottery in the previous 7 days will enter a cool down period and will not be able to participate on any other Pool during those 7 days.

However 10% of them (randomly) will still be able to win and participate.

Also, holders with >= 30 000 POLS will also automatically bypass this cool down period and will be able to always participate.

Top 10 holders

Top 10 holders are always winners. They can always particiapte at any pool and also bypass the cool down period.

polkastarter-lottery's People

Contributors

miguelcma avatar

Watchers

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