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

adds the ability for phantom funding of a grant #5054

Merged
merged 14 commits into from
Sep 11, 2019

Conversation

owocki
Copy link
Contributor

@owocki owocki commented Aug 21, 2019

Description

adds the ability for phantom funding of a grant.

this allows anyone who is featured flagged to "signal" that they support a specific project.

so that we can get wider amount of contributions from the community, by skipping all the blockchain-ey parts.

to go live:

  • need list of usernames for feature flag
  • design cleanup
  • copy cleanup
  • kudos air drop after grant fulfill
  • v2 - script that actually includes these signals in the CLR calculations
Refers/Fixes

vivek was going to write a ticket, i dont think he has yet tho.

Testing

tested it locally.

Screen Recording 2019-08-28 at 02 30 PM

@owocki owocki changed the title adds the ability for phantom funding of a grant WIP - adds the ability for phantom funding of a grant Aug 22, 2019
@owocki
Copy link
Contributor Author

owocki commented Aug 22, 2019

what should we call this feature? https://gitcoincore.slack.com/archives/CBDTKB59A/p1566408751001400
‘value signals’
phantom contributions

vivek 8:34 PM
we will actually contribute on their behalf
maybe community contributions
so people don’t think they aren’t real contributions
?

@codecov
Copy link

codecov bot commented Aug 23, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@787ebbd). Click here to learn what that means.
The diff coverage is 30.76%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #5054   +/-   ##
=========================================
  Coverage          ?   30.88%           
=========================================
  Files             ?      220           
  Lines             ?    17752           
  Branches          ?     2446           
=========================================
  Hits              ?     5482           
  Misses            ?    12042           
  Partials          ?      228
Impacted Files Coverage Δ
app/kudos/views.py 22.67% <0%> (ø)
app/marketing/admin.py 83.56% <100%> (ø)
app/grants/admin.py 43.37% <100%> (ø)
app/app/context.py 50% <25%> (ø)
app/marketing/models.py 61.72% <80%> (ø)
app/grants/models.py 59.82% <83.33%> (ø)
app/grants/views.py 14.25% <9.09%> (ø)
app/marketing/utils.py 30.9% <9.09%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 787ebbd...0833579. Read the comment docs.

@owocki
Copy link
Contributor Author

owocki commented Aug 27, 2019

@vs77bb should you take this forward or should i?

@danlipert any comments on the existing code before we push it across the finish line?

@@ -900,3 +900,25 @@ class MatchPledge(SuperModel):
def __str__(self):
"""Return the string representation of this object."""
return f"{self.profile} <> {self.amount} DAI"

class PhantomFunding(SuperModel):
"""Define the structure of a subscription agreement."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add something that describes what this is for or why we created it? Looks like this is from a cut-and-paste job ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

'grants.Grant',
related_name='phantom_funding',
on_delete=models.CASCADE,
help_text=_('The associated Phantom Funding.'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change help text to something like The grant being Phantom funded

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

'dashboard.Profile',
related_name='grant_phantom_funding',
on_delete=models.CASCADE,
help_text=_('The associated Phantom Funding.'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change help text to The user profile creating the Phantom Funding

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@owocki owocki changed the title WIP - adds the ability for phantom funding of a grant adds the ability for phantom funding of a grant Aug 29, 2019
@owocki
Copy link
Contributor Author

owocki commented Aug 30, 2019

any more feedback? @danlipert -- @vs77bb is pestering me to get this live

@owocki
Copy link
Contributor Author

owocki commented Sep 4, 2019

@gitcoinco/engineers ?? cc @vs77bb


"""

round_number = models.PositiveIntegerField(blank=True, null=True)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frankchen07 this is the new model that will contain info about when people phantom fund.

two ways we can manage this:

  1. you just build phantom funding into your existing reports
  2. myself or engineering builds a finalize_phantom_funding job that runs once per round, at end of round, that
    a. closes out phantom funding for that round
    b. makes the phantom contribs into actual contributions (both on chain and in the DB)
    c. anything else??

cc @danlipert 4 other ideas

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I'm assuming the data model reflects this in a way where it's easy to build it into the reports. I think as long as it tell me the contributor, which grant(s) they've committed to and how much, it can be easily integrated into the report at the end of the CLR round.

  2. from a product perspective, point number 2 is the trickier one, especially with As a funder I want to see previous contributions to projects and what my expected CLR match is #3663 - since this is part of the product update that vitalik requested (a nifty little feature that tells us in "real" time, how much potential a contribution has in the LR context, and this needs all the contributions, real and phantom in order to be the most accurate). I might be overthinking it in the sense that if the data exists it can be used in the feature, and the phantom_funding job is a completely separate "payout" related action at the end.

In a related conversation, Dan suggested that we do some kind of simplified calculation and cache the results so we can give them a range, since doing a live calculation with real data every time someone changes a number in an input box can be performance hell.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. yea it does that (tho 'how much' is inferred by 5/(num_votes_cast_by_contrib)
  2. hmm.. yeah As a funder I want to see previous contributions to projects and what my expected CLR match is #3663 does make it more complicated. ill add a note there about phantom funding.

agree with @danlipert s thoughts.

Copy link
Contributor

@danlipert danlipert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just 1 small thing and changing the toggle to a POST request to prevent CSRF/etc.

round_number = 3
can_phantom_fund = request.user.is_authenticated and request.user.groups.filter(name='phantom_funders').exists()
phantom_funds = PhantomFunding.objects.filter(profile=request.user.profile, grant=grant, round_number=round_number)
is_phantom_funding_this_grant = can_phantom_fund and request.user.is_authenticated and phantom_funds.exists()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra auth check here already checked when can_phantom_fund is created

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updating

show_tweet_modal = False
if can_phantom_fund:
active_tab = 'phantom'
if can_phantom_fund and request.GET.get('toggle_phantom_fund'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This we need to turn into a POST request so that it can't be exploited

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updating

@owocki
Copy link
Contributor Author

owocki commented Sep 9, 2019

@danlipert just fixed both your comments in 70bb11b

@owocki
Copy link
Contributor Author

owocki commented Sep 9, 2019

anyone else have feedback? this needs to go in weds release @enginneering

@danlipert
Copy link
Contributor

@thelostone-mc @octavioamu Lets make sure we get this one in Wednesday

Copy link
Member

@thelostone-mc thelostone-mc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code wise lgtm !
Need to re-indent stuff but yeah

@octavioamu octavioamu merged commit 3e3871e into master Sep 11, 2019
@thelostone-mc thelostone-mc deleted the kevin/phantom_funding branch June 27, 2020 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants