-
Notifications
You must be signed in to change notification settings - Fork 26
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
Reward amount rollup #64
Comments
/start |
Tips:
|
You might want to offer some clarity/help to the assignee @rndquu |
@rndquu Should the new tables you mentioned be added to this repo, or should they be part of the bot repo here: ubiquityos? |
@hhio618 Hey
Those are plugin related tables so definitely not part of ubiquityos. The https://github.com/ubiquibot/conversation-rewards plugin uses https://github.com/ubiquibot/permit-generation plugin for permit generation under the hood. To make things consistent it makes sense to add related DB migrations to https://github.com/ubiquibot/permit-generation/tree/development/supabase/migrations.
@0x4007 might know better. You may design DB as you see fit. I would start with a single
So the flow could be:
Overall there will be the following tables:
So as a part of this issue the Example 1:
Example 2:
No, this task is regarding solely for saving rewards (i.e. accumulating) in a DB. Notice:
One last thing is that the "reward amount rollup" should work this way (in order to be backwards compatible with our existing infrastructure):
This way we distinguish claimed and unclaimed rewards. |
Ideally DB design should be the one that supports different payout methods:
So DB tables could look like:
The issue with the
So I would prefer simplicity with 5 different tables (compared to the solution described above):
P.S. I think when the "permit or gift card generation on demand at pay.ubq.fi" feature is fully ready then it makes sense to refactor to v2 that would support different payout types |
@0x4007 What payout types do we plan to support except for permits, gift cards and virtual cards? |
The original idea was to support:
|
@hhio618 It occurred to me that the Check this example:
So we don't really need to match rewards with permits or gift cards. To calculate the available reward amount we can simply subtract the sum of generated permits and gift cards from solved rewards. TLDR; I think as a part of this issue only the |
@rndquu |
@rndquu
|
Sorry for the inconvenience, we're still contemplating over the DB schema, pls check these comments:
If this issue's description is updated (in favor of a single DB table mentioned here) then we'll increase this github issue's reward to cover refactoring costs. |
This github issue is solely regarding saving rewards in a DB so the following tasks should be solved as a part of this issue:
While this point is out of scope for this issue (since it will be solved here):
|
/start |
! hhio618 you were previously unassigned from this task. You cannot be reassigned. |
@rndquu Any news on this issue and the related one? |
I have a plan to keep the granularity of single permits, which is interesting in terms of administration, while rolling up rewards.
Based on 2, it would make a lot of sense for the database to include the issue's name. I would love to add an array stating what kind of contribution that reward refers to: writing a spec, reviewing or completing the task. There are a few more details I want to implement. I guess the downside of this approach is having to thrust a DB, but apparently other ends also do that. |
/start |
I've thoroughly analyzed this, and ultimately, I believe the table approach introduces way more risk than necessary. I propose we keep all related to payments on-chain, with adjustments to the current permit2 architecture. It is not common to permit directly from treasury, a standard solution to this problem is having a keeper contract. So my plan consists of the following steps:
We'll deploy a keeper for each possible treasury, which is the EOA that currently is the permit signer. The contracts will have whitelist protected functions for those funding EOAs. We have a public mapping of userToBalance (address -> uint256), public token address for the reward (we can make it configurable and change a little the previous mapping). We have a permit function which we will call at the end of an issue, this will increment a user's token balance. We have a cancelPermit function that the funder can also call at any time. The user can then claim any amount at any time and isn't limited by individual rewards. We keep an on-chain log of rewards, permits, cancellations and redemptions. We could push those logs as objects to on-chain storage, whether we are on Gnosis or any other L2 gas is extremely cheap.
|
@UbiquityOS can you suggest any improvements to @zugdev's proposal? Can you suggest alternative solutions? |
Seems like a bad approach to deploy a contract per EOA but I'm not very knowledgeable on the implementation details |
! An error occurred |
We can have it configurable, we just add another variable to the mapping pot. That should not be a problem as we are in L2s. |
Right now the permit redeem flow is the following:
conversation-rewards
plugin generates a permit, saves it to a DB and displays it in github commentspay.ubq.fi
This PR introduces claiming rewards to gift cards.
The updated flow of the permit redeem should be following:
pay.ubq.fi
, generates either an on-chain single permit (possibly for multiple solved issues) either redeems to a gift cardSo as a part of this issue we should accumulate contributor rewards in a DB similar to how
0x4007
initially implemented it with thedebits, cerdits, settlements
tables.When this issue of accumulated rewards is ready we can just disable permit generation (via the plugin's
permitGeneration.enabled
option) and let contributors redeem only atpay.ubq.fi
.The text was updated successfully, but these errors were encountered: