-
Notifications
You must be signed in to change notification settings - Fork 18
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
[7 MARCH] Periodically fetch stream end dates and donation data #1148
Comments
@jainkrati to do more research on https://powerpool.finance/ to see if it can handle this computation job |
We'll do background cronJobs to query the status of recurring donations and update their status in the Giveth DB We need to update the amount of tokens donated and the USD value on a daily basis. we'll need some way to know the amount of tokens donated and usd value between two dates for calculating QF and GIVbacks related to #1483 and Giveth/giveth-dapps-v2#3284 |
Since powerpool will charge us per use, as of now we are dropping powerpool integration. Instead, we will continue the normal way we automate blockchain calls - using cron job. In order to calculate the amount of tokens donated by each person, we will need to create a new table in database for recurring donation per person (including the equivalent $ or fiat value donated in this interval) where we add a donation record every 6 hours or 10 hours or N hours depending on token price fluctuation (the duration for which token price is stable). This duration could be different for different tokens. Example: For token A, we can calculate donation dollar equivalent every X hours and for Token B every Y hours and so on. Then we will write an API which simply queries the sum of all such donations in a specific interval for a person or everyone etc |
Just adding this here, I would definitely check out the accounting API I mentioned above This allows us to track multiple tokens streamed between two periods of time and its USD value for a specific address This takes in a couple parameters:
the response gives you the total amount of tokens and its usd value split up into the virtualization periods you specified for the timestamp range you gave. it will split up the responses if the flowrate was changed during the timestamp ranges (donor increased or decreased their flowrate) So for the cronjob service it might be as easy as querying this API, making some calculations (to get the total) with the returned info and saving it somewhere. You can see a detailed example in their documentation: |
@mohammadranjbarz please take this up. @aminlatifi can also weigh in on the high level plan. @divine-comedian could you setup 20 min thursday sometime to set context and invite me, mohammad and @aminlatifi |
Is this same as #1243 @divine-comedian ? if yes can we keep only one? |
@CarlosQ96 This is another issue related to get recurring donation info from blockchain |
I had to look at both issue to double check what I wrote :P I will close Giveth/giveth-dapps-v2#1243 as I think this issue has more context inside of it |
@CarlosQ96 to begin on this today. |
Mohammad left a cronjob to put the logic for this there. Carlos needs to fill in the logic Everyday we check the donation and create a stream donation for it How do we show the total donated amount when we check everyday we need to update the totalDonated field and totalDonatedUSD call the accounting API everyday and save it as a new donation each day but we hide it on the front-end won't be an issue for database size since we include it from most queries run cronjob everyday to check the status - add the new donations and see if the recurring donation is still active if it isn't (user ran out of funds or they ended the stream themselves we mark it as finalized) We need to also run this subgraph query on each donor to know when their super token balances will run out (and their recurring donaitons will end from insufficient funds
|
Date of Completion 22st feb |
Ok I added the logic for knowing which super tokens are almost running out. |
Related to #1148 |
Finishing Donation Creation Logic, will push tomorrow. |
Carlos needs test Anchor Contract with recurring donations.. can @alireza-sharifpour or @MohammadPCh help |
Regarding the help Alireza provided, the api of superfluid is blocked by this. I requested from superfluid to add optimism sepolia. They will do it this week and that it shouldnt take a lot of time. We should in the mean time also add optimism sepolia to our networks and contract, in a separate issue related to this too. |
So I'm currently blocked by not having real tests at the moment. |
@CarlosQ96 pls create another issue for tests and merge this PR to unblock FE. |
This issue is on in progress in zenhub board, is the status correct in zenhub ? or It should be in UAT status and is ready for testing? @CarlosQ96 and I couldn't understand the acceptance criteria of this issue could you please tell me more about this? @divine-comedian |
In order for this to pass we should ensure the following:
@CarlosQ96 - maybe we should find some test values when you make this cronJob so testing can be done faster than one month 😂 We could try 30 mins / 1 hour The USD values might be off since they are tricky/not available for some tokens on OP Sepolia but we need to make sure they work properly with production values. |
@maryjaf - it could be that this isn't hooked up to the notification center or it isn't finished yet @CarlosQ96 is there a way to test this right now? |
I've tested this and it should be assigned to the developers again to completing implementation because the tests were failed |
@CarlosQ96 pls take this up |
related to: #1431 merged |
I didn't receive any notification and email for recurring donation (more than 1 $) @CarlosQ96 @RamRamez This is my last recurring donation and it was more than 1 $ https://optimism-sepolia.blockscout.com/tx/0x38dbe9bcda631031a9feac355f54420c6d016234d2a779bcd504df0c27b22187 |
It seems it's related to this |
@MohammadPCh I put it back into in-progress, needs your attention! thanks |
I put it to done and we continue testing on notif issue #1416 AND |
For users to be notified when their super token balances are about to run out we'll have to check periodically their balance & net flowrate (max one time daily) for each token, for each chain and trigger an email & notification if conditions are met.
each notification should only trigger once and they all should be reset when the user has modified their stream balance (withdrawn or deposited tokens). Related to Giveth/notification-center#62
In the subgraph we do have many options to experiment with to find the most efficient way of getting data
https://docs.superfluid.finance/superfluid/developers/subgraph
Can also see the accounting API:
https://superfluidhq.notion.site/Using-the-Stream-Accounting-API-3d161745acfe4750acf43c546f84c724
https://accounting.superfluid.dev/v1/swagger
The text was updated successfully, but these errors were encountered: