-
Notifications
You must be signed in to change notification settings - Fork 41
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
Generate rolled up payouts #289
Comments
@EresDev @gentlementlegen @whilefoo @Keyrxng Guys pls check the description |
One potential issue is that issues get re-opened and permits get regenerated where the 2nd is a higher value than the first. Scenario:
The multiple permits per issue possibility is what made me doubt myself in ubiquity/.github#109 So how would we effectively manage the case where multiple permits on a task for a user considering the claimed amount is final and is intended to be so that once you claim that's it? |
Good point. We had this issue in the bot v1. I guess right now the
How it works:
|
Do you think we'd also need to:
|
This means that the user will need to sign in with Github (oAuth) so we can verify which user it is. Additionally we could remove
If we delete the penalty when the issue is closed as completed then the reward amount will increase For example:
|
I have been thinking differently about this. We will get two tables from the previous issue ubiquity-os-marketplace/text-conversation-rewards#64 reward, and permits.
To achieve the goal of this issue, what if we reduce the tables instead of increasing them? Keep the the credits and debits in the same table. This probably goes against the relational database normalization techniques, but based on our use case, this looks more efficient to me.
We should store the amount as a signed integer. So that we can store both credits and debits in one table. The benefit is simplicity. Less tables to understand. No separate aggregate function runs on the separate tables. I don't think we are going to store much data in details. In fact, I see reducing it even more because we can retrieve it from services and blockchain that are already storing it. We are not going to store Reloadly virtual card number in our DB. Why expose ourselves to risk? Reloadly has it. We can retrieve it when needed. In fact, we don't even need to store reloadly tx id, as we can just store the id of this table row in reloadly. |
This approach definitely breaks DB normalization but:
By the way supabase allows searching over JSON fields in a DB. If @whilefoo and @Keyrxng are fine with this "single table" approach then I'll update descriptions for ubiquity-os-marketplace/text-conversation-rewards#64 and current github issue. |
Yes
Yes |
Yes
I suppose it's better to keep the
Right now the plan for the "account abstaction" feature v1 is this simple flow:
In most cases (at least as I've seen so far) the reopened issue will be solved by another contributor, not the one who initially tried to solve it. But this example provides an interesting edge case where:
I believe the example flow with the removed penalty is still correct. Example (issue is solved by another contributor):
Example (issue is solved by the same contributor):
In both cases we treat the reopened issue as a new task and should reward the full amount (200$) even for a reopened issue regardless of who solved the issue 2nd time (initial solver or another contributor). |
In this case why would you remove penalty for user1?
I agree with this approach. I think it's also easier to query how much is the available amount by just summing all amount rows or displaying all transactions to the user. |
This is what you mean, right? |
So you agree with my approach? Because I thought you wanted to remove penalties when issue is closed by saying |
When thinking about this I've just remembered that we initially wanted that partners can set their own reward token which can be any ERC20 token which might not be pegged to USD and they could also set the network. By implementing rolled up rewards, we are practically restricting payment token and network to only one that we choose. @0x4007 rfc |
For simplicity we can make v1 of rolled up rewards only support a single asset on a single network I think that's reasonable. Ideally the user can select what asset and network and then roll them up. I think it's reasonable for me to start finding partners to try and settle either in wxdai or ubiquity dollars on gnosis chain / ethereum |
@rndquu Has the database schema been finalized? |
@rndquu I've just realised that we can't roll up rewards across all orgs since every org has their own wallet for permits, so we have to roll up based on the org so the user has to claim multiple times which is not ideal but better than doing it for every task. Unless we find another way like transferring the amount to our wallet and then generating a permit, for example:
However this flow is quite complex and a lot of points of failures like 1 permit can't be claimed so others have to be reverted...so probably not worth implementing |
We could roll up based on the wallet? Both our orgs use the same wallet, so perhaps from the perspective of the plugin it's essentially one "org" |
@whilefoo rfc |
We can optimize by also looking at the wallet but the UX might be confusing to the user, however I don't anticipate that many partners will have multiple Github organizations. Based on @EresDev 's schema and previous conversation I propose this modified schema:
We will need to remove the reward token and network option in the config since the user will choose which token and network they want on claim page (at first there will be only one option). Another area to consider is non-standard rewards such as NFTs and governance/utility tokens. Do we plan to support that @0x4007 ? |
The planned NFTs are basically POAPs and don't have monetary value. As for the governance/utility tokens, I suppose its up to the plugins themselves to handle them. It is nice to keep tabs on our ledger but we need to snapshot its market value at the time of payout. Perhaps the column name should be a reference to that "market value (at time of permit generation)" which would apply for all tokens, including stablecoins. |
Why would we need to keep the market value? If the reward is in governance tokens it should be paid out in governance tokens not USD, no? If we want to keep track of all different rewards we will need another column 'reward_type' which can be 'usd', 'poap', 'token'. |
Intuitively I feel that most companies would keep track of the value of the tokens going through the system for accounting and marketing reasons. I could see it on our UBQ.FI page under the network stats. But if it's too complicated then we can kick the can down the road. |
Depends on ubiquity-os-marketplace/text-conversation-rewards#64
This issue adds the "reward amount rollup" feature which adds a new DB table
rewards
.Overall right now (when ubiquity-os-marketplace/text-conversation-rewards#64 is solved) there are 2 tables related to contributors' rewards:
rewards
: matches a single github issue with a single user rewardpermits
: stores generated accumulated rewardsThe plan is to allow contributors to select the reward amount they want to redeem (either via permits either via gift cards).
Example flow with permits:
rewards
table has 1 DB entity).rewards
table has 2 entities)pay.ubq.fi
, selects 25 WXDAI to redeem and generates a single permit worth 25 WXDAI (a new entity is added to thepermits
table).pay.ubq.fi
again, selects 5 WXDAI to redeem and generates a single permit worth 5 WXDAI (a new entity is added to thepermits
table).pay.ubq.fi
again, selects 100 WXDAI to redeem and gets an error since there are no more funds availableExample flow with gift cards:
rewards
table has 1 DB entity).rewards
table has 2 entities)pay.ubq.fi
, selects 25 WXDAI to redeem and generates a new gift card worth 25 WXDAI (a new entity is added to thegift_cards
table).pay.ubq.fi
again, selects 5 WXDAI to redeem and generates another gift card worth 5 WXDAI (a new entity is added to thegift_cards
table).pay.ubq.fi
again, selects 100 WXDAI to redeem and gets an error since there are no more funds availableSo as a part of this issue we should:
rewards
table).gift_cards
table)permits
table that already exists)The text was updated successfully, but these errors were encountered: