Skip to content

spike: Matching Estimates for Donations #1931

@boudra

Description

@boudra

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.

Metadata

Metadata

Assignees

Labels

spikesomething for the team to do research on

Type

No type

Projects

Status

Live

Relationships

None yet

Development

No branches or pull requests

Issue actions