From dbabd455258ace7e854044fe9e7eaf9c8744819e Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Sun, 5 Jul 2020 07:48:01 +0530 Subject: [PATCH 1/3] Update README.md --- README.md | 127 ++++++++++++++++++++++++++++++++++++------------------ setup.py | 2 +- 2 files changed, 85 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 1e5e239..6e3199f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,62 @@ -# Quadratic Funding +### Quadratic Funding This is an open source implementation of quadratic funding or liberal radicalism, a design for philanthropic and publicly-funded seeding which allows for optimal provisioning of funds to an ecosystem of public goods. This concept was adapted from [a paper](https://poseidon01.ssrn.com/delivery.php?ID=660029082067073116118109064122080113007059056088020045126118025097091089104095118005013117053102018063007119114004031115071017112038078013065115004125088127124090068088040053112098119108124088124100127091000084029019003094031089072104067086002002114101&EXT=pdf) written by Vitalik Buterin, Zoë Hitzig and Glen Weyl of liberal radicalism fame. +### Usage -# How it Works + +#### Possible Parameters + + +| Parameter | Allowed Values | Mandatory | Default | Status | +|-----------------------------------------------------------------------------------|----------------------------|-----------|------------|--------| +| [positive_contributions](#positive_contributions) | `[]` | ✓ | | x | +| [type](#type) | `pairwise` \| `individual` | | `pairwise` | x | +| [threshold](#threshold) | `` | | `25.0` | x | +| [normalize_on_saturation](#normalize_on_saturation) | `True` \| `False` | | `False` | x | +| [cap_at](#cap_at) | `` | | `None` | x | +| [previous_round_contributions](#previous_round_contributions) | `[]` | | `None` | x | +| [previous_round_contributions_weightage](#previous_round_contributions_weightage) | `` | | `0.33` | x | +| [negative_contributions](#negative_contributions) | `[]` | | `None` | x | + +###### positive_contributions + + // Description + Format + +###### type + + // Description + Format + +###### threshold + + // Description + Format + +###### normalize_on_saturation + + // Description + Format + +###### cap_at + + // Description + Format + +###### previous_round_contributions + + // Description + Format + +###### previous_round_contributions_weightage + + // Description + Format + +###### negative_contributions + + // Description + Format + + + + +### How it Works The idea of a quadratic voting system was the starting point for Gitcoin's funding open source experiment. @@ -25,7 +76,7 @@ Using LR/CLR in open source ideally helps to prevent the "tragedy of the commons LR puts an emphasis on the number of donations, rather than the size of the donation itself. This is the intended feature of the LR mechanism. Projects that can get more people to donate to them represent public goods that serve a larger public, so the tragedy of the commons problem is more severe, and hence, contributions to them should be multiplied more to compensate. -# Problems Observed (Rounds 1 & 2) +### Problems Observed (Rounds 1 & 2) Sybil resistance: We know that grants which receive many small contributions result in a larger "top-off" value from the benefactor, incentivizing an attack vector to create multiple dummy accounts to try to confuse the system. @@ -35,7 +86,7 @@ Reliance on philanthropists: In practice, CLR still suffers from reliance on a b Prior knowledge: One of the drawbacks of this entire experiment is the fact that once the mechanism is known, people will know how to game it. -# Pairwise Mechanism (DRAFT) +### Pairwise Mechanism (DRAFT) BENEFITS OF PAIRWISE number of donations matters more @@ -52,7 +103,7 @@ collusion with pairs is much easier to find (you can use something like time, da HOW DID PAIRWISE ALLEVIATE ROUND 1 & 2 PROBLEMS? -# Problems Observed (Round 3-5) +### Problems Observed (Round 3-5) Identity: @@ -60,51 +111,41 @@ Saturation of the round: Discoverability of new grants: -# Further Development - -# Additional Reading - -Foundations: - -[Standard Bounties Contract](https://github.com/Bounties-Network/StandardBounties) - -[EIP-1337](https://github.com/ethereum/EIPs/pull/1337) - -[Gitcoin Grants](https://github.com/gitcoinco/grants1337) - -Research Papers: - -[Liberalism Radicalism: A Flexible Design For Philanthropic Matching Funds](https://poseidon01.ssrn.com/delivery.php?ID=660029082067073116118109064122080113007059056088020045126118025097091089104095118005013117053102018063007119114004031115071017112038078013065115004125088127124090068088040053112098119108124088124100127091000084029019003094031089072104067086002002114101&EXT=pdf) - -[Pairwise Coordination - A New Quadratic Funding Design](https://ethresear.ch/t/pairwise-coordination-subsidies-a-new-quadratic-funding-design/5553/9) - -[Minimal Anti-Collusion Infrastructure](https://ethresear.ch/t/minimal-anti-collusion-infrastructure/5413/2) - -Blog Posts: - -[Gitcoin Grants: Q1 Match + 2020 Roadmap](https://gitcoin.co/blog/gitcoin-grants-2020/) - -[Gitcoin Grants](https://gitcoin.co/blog/gitcoin-grants/) +### Further Development -[Experiments with Liberal Radicalism](https://gitcoin.co/blog/experiments-with-liberal-radicalism/) -[Gitcoin Grants: CLR Matching](https://gitcoin.co/blog/gitcoin-grants-clr-matching/) +### Additional Reading -[Radical Results: Gitcoin's $25K Match](https://gitcoin.co/blog/radical-results-gitcoins-25k-match/) +**Foundations** -[Gitcoin Grants: $50K Open Source Fund](https://gitcoin.co/blog/gitcoin-grants-50k-open-source-fund/) +- [Standard Bounties Contract](https://github.com/Bounties-Network/StandardBounties) +- [EIP-1337](https://github.com/ethereum/EIPs/pull/1337) +- [Gitcoin Grants](https://github.com/gitcoinco/grants1337) -[Gitcoin’s Q3 Match: $100K+ to OSS projects](https://gitcoin.co/blog/gitcoins-q3-match-100k-to-oss-projects/) +**Research Papers** -[Gitcoin's Q3 Match The Radical Results](https://gitcoin.co/blog/gitcoins-q3-match/) +- [Liberalism Radicalism: A Flexible Design For Philanthropic Matching Funds](https://poseidon01.ssrn.com/delivery.php?ID=660029082067073116118109064122080113007059056088020045126118025097091089104095118005013117053102018063007119114004031115071017112038078013065115004125088127124090068088040053112098119108124088124100127091000084029019003094031089072104067086002002114101&EXT=pdf) +- [Pairwise Coordination - A New Quadratic Funding Design](https://ethresear.ch/t/pairwise-coordination-subsidies-a-new-quadratic-funding-design/5553/9) +- [Minimal Anti-Collusion Infrastructure](https://ethresear.ch/t/minimal-anti-collusion-infrastructure/5413/2) -[Gitcoin Grants Round 4 Results](https://gitcoin.co/blog/gitcoin-grants-round-4/) -[ -Gitcoin Grants Round 5: Funding Our Future](https://gitcoin.co/blog/gitcoin-grants-round-5-funding-our-future/) +**Blog Posts** -[Gitcoin Grants Round 6](https://gitcoin.co/blog/gitcoin-grants-round-6/) +- [Gitcoin Grants: Q1 Match + 2020 Roadmap](https://gitcoin.co/blog/gitcoin-grants-2020/) +- [Gitcoin Grants](https://gitcoin.co/blog/gitcoin-grants/) +- [Experiments with Liberal Radicalism](https://gitcoin.co/blog/experiments-with-liberal-radicalism/) +- [Gitcoin Grants: CLR Matching](https://gitcoin.co/blog/gitcoin-grants-clr-matching/) +- [Radical Results: Gitcoin's $25K Match](https://gitcoin.co/blog/radical-results-gitcoins-25k-match/) +- [Gitcoin Grants: $50K Open Source Fund](https://gitcoin.co/blog/gitcoin-grants-50k-open-source-fund/) +- [Gitcoin’s Q3 Match: $100K+ to OSS projects](https://gitcoin.co/blog/gitcoins-q3-match-100k-to-oss-projects/) +- [Gitcoin's Q3 Match The Radical Results](https://gitcoin.co/blog/gitcoins-q3-match/) +- [Gitcoin Grants Round 4 Results](https://gitcoin.co/blog/gitcoin-grants-round-4/) +- [Gitcoin Grants Round 5: Funding Our Future](https://gitcoin.co/blog/gitcoin-grants-round-5-funding-our-future/) +- [Gitcoin Grants Round 6](https://gitcoin.co/blog/gitcoin-grants-round-6/) +- [Vitalik's Blog - Review of Gitcoin Quadratic Funding Round 3](https://vitalik.ca/general/2019/10/24/gitcoin.html) +- [Vitalik's Blog - Review of Gitcoin Quadratic Funding Round 4](https://vitalik.ca/general/2020/01/28/round4.html) +- [Vitalik's Blog - Gitcoin Grants Round 5 Retrospective](https://vitalik.ca/general/2020/04/30/round5.html) -[Vitalik's Blog - Review of Gitcoin Quadratic Funding Round 3](https://vitalik.ca/general/2019/10/24/gitcoin.html) -[Vitalik's Blog - Review of Gitcoin Quadratic Funding Round 4](https://vitalik.ca/general/2020/01/28/round4.html) +### Licenses -[Vitalik's Blog - Gitcoin Grants Round 5 Retrospective](https://vitalik.ca/general/2020/04/30/round5.html) +- [Code - GNU AFFERO GENERAL PUBLIC LICENSE](../LICENSE) +- [Creative assets -- Attribution-NonCommercial-NoDerivatives 4.0 International](../app/assets/LICENSE.txt) diff --git a/setup.py b/setup.py index 70a1465..7c5f293 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ description='This is the open source quadratic funding implementation found on gitcoin.co/grants.', long_description='This is an open source implementation of quadratic funding, a design for philanthropic and publicly-funded seeding, which allows for optimal provisioning of funds to an ecosystem of public goods. You can find the live product implementation at gitcoin.co/grants', long_description_content_type='text/markdown', - url='insert github link', + url='https://github.com/gitcoinco/quadratic-funding', packages=setuptools.find_packages(), classifiers=[ 'Programming Language :: Python :: 3', From 9d492d640ed794d8d14ab515f88b4aeac23cb298 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Mon, 6 Jul 2020 12:23:27 +0530 Subject: [PATCH 2/3] quadratic-funding -> quadratic_funding --- {quadratic-funding => quadratic_funding}/__init.py__ | 0 setup.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename {quadratic-funding => quadratic_funding}/__init.py__ (100%) diff --git a/quadratic-funding/__init.py__ b/quadratic_funding/__init.py__ similarity index 100% rename from quadratic-funding/__init.py__ rename to quadratic_funding/__init.py__ diff --git a/setup.py b/setup.py index 7c5f293..b296815 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ long_description = fh.read() setuptools.setup( - name='quadratic-funding', + name='quadratic_funding', version='0.0.1', author='Frank Chen, Aditya Anand Michael Chelliah, Kevin Owocki', author_email='team@gitcoin.co', From 9a780f196a1b1475e892114ac6b28fd12d4b2837 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Mon, 6 Jul 2020 12:56:15 +0530 Subject: [PATCH 3/3] chore: setup pip install + .gitignore + add tests --- .gitignore | 138 ++++++++++++++++++++++ quadratic_funding/__init.py__ | 1 - quadratic_funding/__init__.py | 2 + quadratic_funding/tests/__init__.py | 0 quadratic_funding/tests/test_calculate.py | 8 ++ setup.py | 4 +- 6 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 .gitignore delete mode 100644 quadratic_funding/__init.py__ create mode 100644 quadratic_funding/__init__.py create mode 100644 quadratic_funding/tests/__init__.py create mode 100644 quadratic_funding/tests/test_calculate.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5391d87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,138 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ \ No newline at end of file diff --git a/quadratic_funding/__init.py__ b/quadratic_funding/__init.py__ deleted file mode 100644 index 576f56f..0000000 --- a/quadratic_funding/__init.py__ +++ /dev/null @@ -1 +0,0 @@ -# coding: utf-8 \ No newline at end of file diff --git a/quadratic_funding/__init__.py b/quadratic_funding/__init__.py new file mode 100644 index 0000000..e1eac09 --- /dev/null +++ b/quadratic_funding/__init__.py @@ -0,0 +1,2 @@ +def calculate(): + return (u'derp package works') \ No newline at end of file diff --git a/quadratic_funding/tests/__init__.py b/quadratic_funding/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/quadratic_funding/tests/test_calculate.py b/quadratic_funding/tests/test_calculate.py new file mode 100644 index 0000000..a48160c --- /dev/null +++ b/quadratic_funding/tests/test_calculate.py @@ -0,0 +1,8 @@ +from unittest import TestCase + +import quadratic_funding + +class TestCalculate(TestCase): + def test_is_string(self): + s = quadratic_funding.calculate() + self.assertTrue(isinstance(s, str)) \ No newline at end of file diff --git a/setup.py b/setup.py index b296815..6849671 100644 --- a/setup.py +++ b/setup.py @@ -18,5 +18,7 @@ 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', ], - python_requires='>=3.6' + python_requires='>=3.6', + test_suite='nose.collector', + tests_require=['nose'] )