Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spike: Matching Estimates for Donations #1931

Closed
boudra opened this issue Jun 9, 2023 · 0 comments · Fixed by #2022
Closed

spike: Matching Estimates for Donations #1931

boudra opened this issue Jun 9, 2023 · 0 comments · Fixed by #2022
Assignees
Labels
spike something for the team to do research on

Comments

@boudra
Copy link
Contributor

boudra commented Jun 9, 2023

We want to be able to show users the impact of their donation: to incentivize donations and to educate users about how Gitcoin works.

Timebox: 1-2 days

How we did it in cGrants

Where the calculations happens:
https://github.com/gitcoinco/web/blob/master/app/grants/clr.py#L569
Show all the predictions for 0,1,10,100,1000 on the UI
https://github.com/gitcoinco/web/blob/master/app/assets/v2/js/grants/_detail.js#L13
The checkout page:
https://github.com/gitcoinco/web/blob/master/app/assets/v2/js/cart.js#L1567

We basically create predictions of matching values for donations of 0, 1, 10, 100, 100 etc. and then use those values to estimate the amount based on the user donation, by averaging and checking the closest value.

This could be an HTTP endpoint in the indexer, that returns the list of predictions, and it could be cached.

Spike

/**
 * Pseudocode
 * - get matching amount without user contribution
 * for each donation amount:
 * - get amount after user contribution by running linearQF with the added vote
 * - deduct match amount w/o user contribution to get new matching
 * - return new matching
 *  */
  • Needs to be in the indexer because downloading all votes is very costly.
  • can be cached with a ttl at cost of inaccurate results, or per vote-hash with little perf benefit but accurate
  • Client calls the endpoint using indexer client.
  • We fit a curve to the points, and allow the user to drag a point on the curve which changes the donation amount.
  • we only do this on the page when adding the project to cart.
  • a problem might arise due to the matching estimate being different on the project page and during checkout. we can solve this by only showing the total estimated matching for all projects together, not per-project.
@boudra boudra added this to Grants Lab Jun 9, 2023
@boudra boudra changed the title Matching Estimates for Single Donations Matching Estimates for Donations Jun 9, 2023
@michellema1208 michellema1208 changed the title Matching Estimates for Donations spike: Matching Estimates for Donations Jun 12, 2023
@michellema1208 michellema1208 added the spike something for the team to do research on label Jun 12, 2023
@michellema1208 michellema1208 moved this to Todo in Grants Lab Jun 20, 2023
@vacekj vacekj moved this from Todo to In Progress in Grants Lab Jun 21, 2023
@vacekj vacekj self-assigned this Jun 21, 2023
@vacekj vacekj moved this from In Progress to PR Review in Grants Lab Jun 27, 2023
@vacekj vacekj moved this from PR Review to Live in Grants Lab Jun 28, 2023
@vacekj vacekj linked a pull request Jul 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spike something for the team to do research on
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants