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

SERVICES-1379: compute undistributedBoostedRewards #982

Closed
wants to merge 11 commits into from

Conversation

dragos-rebegea
Copy link
Contributor

@dragos-rebegea dragos-rebegea commented Mar 3, 2023

compute undistributedBoostedRewards including unclaimed rewards

Reasoning

  • Currently undistributedBoostedRewards only returns the amounts that has been collected using collectUndistributedBoostedRewards. Since undistributedBoostedRewards should contains also the uncollected, we should compute the value.

Proposed Changes

  • Calculates the total undistributed boosted rewards for a given smart contract address (scAddress) up to the current week (currentWeek) by first fetching the undistributed boosted rewards and the last week when these rewards were collected. If the period of unclaimed weeks is more than the maximum number of weeks a user can claim, it only considers the rewards from the last USER_MAX_CLAIM_WEEKS. It then calculates the rewards remaining to be distributed for each week starting from the week after the last collection up to the week derived from subtracting the maximum claim weeks from the current week. The total of these remaining rewards is then added to the previously fetched undistributed boosted rewards to get the total amount.

How to test

  • Test by providing a smart contract address (scAddress) and the current week (currentWeek). Check that the function returns the correct total undistributed boosted rewards.
  • Test the edge case where the starting week is later than the ending week, the function should return the undistributed boosted rewards without calculating the remaining rewards.

dragos-rebegea and others added 8 commits March 3, 2023 15:50
- use only Active pairs for token price computation if there are at least
1 active pair
- use all pairs for token price computation if there are no active pairs

Signed-off-by: Claudiu Lataretu <[email protected]>
…ute-price

[SERVICES-1695]: fix token compute price EGLD
…r-update

[SERVICES-1704] fix new pair filtering for events
# Conflicts:
#	src/modules/farm/v2/farm.v2.resolver.ts
#	src/modules/farm/v2/services/farm.v2.abi.service.ts
#	src/modules/farm/v2/services/farm.v2.getter.service.ts
@codecov
Copy link

codecov bot commented Jul 6, 2023

Codecov Report

❗ No coverage uploaded for pull request base (development@dab39d6). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@              Coverage Diff               @@
##             development     #982   +/-   ##
==============================================
  Coverage               ?   56.39%           
==============================================
  Files                  ?      233           
  Lines                  ?     7747           
  Branches               ?      518           
==============================================
  Hits                   ?     4369           
  Misses                 ?     2935           
  Partials               ?      443           
Flag Coverage Δ
unittests 56.39% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dragos-rebegea dragos-rebegea changed the base branch from main to development July 10, 2023 08:36
@dragos-rebegea dragos-rebegea dismissed claudiulataretu’s stale review July 10, 2023 12:45

The merge-base changed after approval.

@dragos-rebegea dragos-rebegea dismissed claudiulataretu’s stale review July 14, 2023 07:59

The merge-base changed after approval.

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.

2 participants